Top-Down shooting mechanics

The Decay game from a while back. One of the first things I ever created. Here I will list some mechanics used in making Top-Down shooting enjoyable.

  • Smooth bullet spread: More than one bullet can be shot in-between frames, depending on the frame rate. So the function will distribute those bullets between the current and the following frame and displace them so it will not look like a few of them leave the barrel at the same time. It makes a fast change in direction feel smoother, and all targets between those directions can be hit.

  • No randomness in bullet spread: instead of using random kick for bullet spread, the displacement reacts to player movement and aiming. It may not make much difference in a top-down game, but some of my experiments with first-person shooting showed that I start to intuitively anticipate how the spread will go and makes me feel more in control. It should still look random, but the math behind it will react purely to the input, and as a result, after a while, it becomes easier to compensate for the spread by relying purely on reflexes and instinct. Just to clarify: I'm not talking that a motion in a certain direction creates an aim displacement in that direction, it will feel junky. It looks and feels like the kick in any other game (any other good game, hopefully), only subconsciously you will anticipate how it will go.

  • Displacing camera in the direction player is looking: Player's character doesn't have to be in the centre of the screen. It's better to show him more of the area in his aim direction.

  • Since the entire game is rendered with CPU, I later made an OpenGL wrapper that allows you to look around the current frame while the next frame is being drawn. The video below is not using that, but the one on the Home(Portfolio) Page does. There, during frame-rate drops, especially during explosions, the camera still reacts to mouse movement in a smooth fashion.

  • Feet script: Instead of using animation, I made a script that selects positions for the player's feet and moves them there. It makes movement a bit funny, but for some games, it may be fine.

  • No enemy kickback: I was always sure that a nice blast with a shotgun should kick the enemy back a few, and for a long time that how the game worked: bullets were pushing enemies away from the player. But I was wrong, to make the game feel good bullets should not affect enemies physically, they should cut through, they can trigger an animation, or make him change what he is doing, but not push him.

  • Expected effect, unexpected result: I learned this one from Halo developers, and from doom: enemy's actions should be somewhat predictable, but not entirely. If firing in his direction makes him take cover, it should work every time, he should look for cover every time, but which cover he will take can still remain unknown.

  • Bullet trace: Bullet is leaving a trail, as you may notice, but there is more to it - it is not stretched from where it was an in-game world to where it is now, it is stretched from its position on the screen during the previous frame to its current screen position. This is what would you would see in real life - as you move your head, the photons will keep hitting your eye retina and create sort of a smudge.

  • Gore: As you hit the enemy, he breaks into pieces. When a bullet hits one of those pieces, it turns the piece into many tiny blood splatters, but the bullet is not being slowed down by this impact. This way, when attacking a large horde, the bodies in front keep taking impacts the way you'd expect, but their ragdolls do not function as a shield for the ones behind them.