• Ascent control: Another physically implausible action, but very popular, as it gives you much greater control over the character. The longer you hold the jump button, the higher the character jumps. Typically, this is implemented by continuing to add impulse to the character (though this impulse can incrementally decrease) for as long as the button is held, or alternatively by suppressing gravity while the button is held. A time limit is imposed, unless you want the character to be able to jump infinitely. • Multiple jumps: once airborne, some games allow the player to jump again, perhaps for an unlimited number of times (as in the Space Jump in Super Metroid or the flight in
You should have leading animations for
things such as jumping and running, but if you care about how the game responds, make those cosmetic only.
Rodrigo Monteiro, Bossa
Talbot’s Odyssey), or for a limited number of jumps before touching the ground (‘double jump’ being the most common choice). This can be accomplished by keeping a counter that increases for each jump and decreases when you’re on the ground (be careful when you update this, or you might reset it right after the first jump), and only allowing further jumps if the counter is low enough. Sometimes, the second jump is shorter than the initial one. Other restrictions may also apply – the Space Jump only triggers if you’re already doing a spin jump and just began to fall.
ANIMATIONS AND LEADING In many games, your character will play an animation before actually performing the action you requested. However, on a twitchy action- based game, this will frustrate players – don’t do that. You should still have
leading animations for things such as jumping and running, but if you care about how the game responds, make those cosmetic only, with the action taken immediately regardless of the animation.
SMOOTHER MOVEMENT Using integers to represent the position of the characters is wise, as it makes it faster and stable. However, if you use integers for
everything, you will end up with some jerky motion. There are multiple solutions to this. These are just a few: • Use a float for all computations and for storing position, and cast to int whenever you’re rendering or computing collisions. This is fast and simple, but it starts losing precision if you move too far away from (0,0). This is probably not relevant unless you have a very large playfield, but it’s something to keep in mind. If it comes to it, you can always use a double instead. • Use a fixed point number for all computations and position, and again cast to int when you’re rendering or computing collisions. This is less precise than float and with a more limited range, but the precision is uniform and can, on some hardware, be faster (notably, floating point processing is slow on many common mobile phones). • Store position as an integer, but keep a ‘remainder’ stored in a float. When integrating position, compute the delta-movement as a float, add the remainder to the delta- movement, then add the integer part of this value to the position, and the fractional part to the ‘remainder’ field. On the next frame, the remainder will get added back in. The significant advantage of this method is that you’re using an integer everywhere except for movement, ensuring that you won’t have floating point complications elsewhere, and increasing performance. This technique is also very suitable
if you have some framework in which the position of the object has to be an integer, or where it is a float, but that same position is used directly by the rendering system. In that case, you can use the framework-provided float position to store integer values only, so as to make sure that the rendering is always aligned to pixels.
Check last month’s issue of Develop for part one of this special feature, where you’ll learn more on the nuances of platforming game design.
Rodrigo Braz Monteiro designs and programs games, and has done so since 1997. He currently resides in London, UK, working for Bossa Studios as a game developer. He is also a member of the indie group Studio MiniBoss. More of his writing is available at his personal website higherorderfun.com.