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 then 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 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 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 math behind it will react purely to the input, and as a result after a while it becomes easier to compensate the spread by relying purely on the reflexes and instinct. Just to clarify: I'm not talking that a motion in 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 center 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 which allows you to look around 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 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 player. But I was wrong, to make game feel good bullets should not affect enemies physically, they should cut trough, 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: enemie'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 leaves a trail, as you may notice, but there is more to it - it is not stretched from where it was in game world to where it is now, it is stretched from it's position on the screen during the previous frame to it's 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 bullet hits one of those pieces, it turns the piece into many tiny blood splatters, but 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.