This page contains a Flash digital edition of a book.
GAME DESIGN // 2D PLATFORMERS| BUILD


• 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.


DEVELOP-ONLINE.NET AUGUST 2012 | 71


Page 1  |  Page 2  |  Page 3  |  Page 4  |  Page 5  |  Page 6  |  Page 7  |  Page 8  |  Page 9  |  Page 10  |  Page 11  |  Page 12  |  Page 13  |  Page 14  |  Page 15  |  Page 16  |  Page 17  |  Page 18  |  Page 19  |  Page 20  |  Page 21  |  Page 22  |  Page 23  |  Page 24  |  Page 25  |  Page 26  |  Page 27  |  Page 28  |  Page 29  |  Page 30  |  Page 31  |  Page 32  |  Page 33  |  Page 34  |  Page 35  |  Page 36  |  Page 37  |  Page 38  |  Page 39  |  Page 40  |  Page 41  |  Page 42  |  Page 43  |  Page 44  |  Page 45  |  Page 46  |  Page 47  |  Page 48  |  Page 49  |  Page 50  |  Page 51  |  Page 52  |  Page 53  |  Page 54  |  Page 55  |  Page 56  |  Page 57  |  Page 58  |  Page 59  |  Page 60  |  Page 61  |  Page 62  |  Page 63  |  Page 64  |  Page 65  |  Page 66  |  Page 67  |  Page 68  |  Page 69  |  Page 70  |  Page 71  |  Page 72  |  Page 73  |  Page 74  |  Page 75  |  Page 76  |  Page 77  |  Page 78  |  Page 79  |  Page 80  |  Page 81  |  Page 82  |  Page 83  |  Page 84  |  Page 85  |  Page 86  |  Page 87  |  Page 88  |  Page 89  |  Page 90  |  Page 91  |  Page 92  |  Page 93  |  Page 94  |  Page 95  |  Page 96  |  Page 97  |  Page 98  |  Page 99  |  Page 100