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


IMPLEMENTATION TYPE ONE: TILE-BASED (PURE)


In this case, character movement is limited to tiles, so you can never stand halfway between two tiles. Animations may be used to create the illusion of smooth movement, but as far as the game logic is concerned, the player is always right on top of a specific tile. This is the easiest way to implement a platform game, but it imposes heavy restrictions on the control of character, making it unsuitable for traditional action-based platformers. It is, however, popular with puzzle and cinematic versions. Examples of tile-based platformers


include Prince of Persia, Toki Tori, Lode Runner and Flashback.


HOW IT WORKS The map is a grid of tiles, each one storing information such as whether it’s an obstacle or not, what image to use, what kind of footstep sound to use, and so on. The player and other characters are


represented by a set of one or more tiles that move together. In Lode Runner, for example, the player is a single tile. In Toki Tori, the player is 2x2 tiles. In Flashback, which is unusual due to the smaller size of its tiles, the player is two tiles wide and five tiles tall (see image above, right) when standing, but only three tiles tall when crouching. In this kind of game, the player will rarely


– if ever – be moving diagonally, but, if he is, the movement can be decomposed in two separate steps. Likewise, he will likely only move one tile at once, but multi-tile movement can be done as multiple steps of one tile, if needed (in Flashback, you always move two tiles at once). The algorithm is then as follows:


1 - Create a copy of the character where he’d like to move to (e.g. If moving one tile to the right, make a copy where every tile of the character is shifted one tile to the right). 2 - Check that copy for intersection with the background and other characters. 3 - If an intersection is found, the character’s movement is blocked. React accordingly. 4 - Otherwise, the path is clear. Move the character there, optionally playing an animation so the transition looks smooth.


This kind of movement is very ill-suited for traditional arc-shaped jumps – so games in this genre often have no jump at all (Toki Tori, Lode Runner), or only allow vertical or horizontal jumps (Prince of Persia, Flashback), which are nothing but special cases of linear movement. Advantages of the pure tile-based system include simplicity and precision. Since the games are more deterministic, glitches are much less likely, and the gameplay experience is more controlled, with less of a need to tweak values depending on circumstances. Implementing certain mechanics – such as grabbing ledges – becomes a breeze, compared to more complex movement styles – all you have to do is check whether the player tiles and the background tiles are aligned in the one specific way that allows for a given action. In principle, this system doesn’t allow


steps of less than one tile, but that can be mitigated in a few different ways. For example, the tiles can be a bit smaller than the player (say, a player is 2x6 tiles), or you can allow a visual-only movement to take place inside a given tile, without affecting the logic (which is the solution that I believe that Lode Runner: The Legend Returns takes).


Flashback, shown with tile boundaries


If you’re unsure which type of platformer you want to


implement, and you want to do an action game, I suggest going smooth tile-based. It’s very flexible, relatively easy to implement, and gives you the most control. It’s no wonder that the majority of the best action platformers of all time are based on this type.


Rodrigo Braz Monteiro, Bossa Studios


IMPLEMENTATION TYPE TWO: TILE-BASED (SMOOTH)


Here collision is still determined by a tilemap, but characters can move freely around the world (typically with 1px resolution aligned to integers. See next month for more). This is the most common form of implementing platformers in 8-bit and 16-bit consoles, and remains popular today, as it is still easy to implement and makes level editing simpler than more sophisticated techniques. It also allows for slopes and smooth jump arcs. If you’re unsure which type of platformer


you want to implement, and you want to do an action game, I suggest going for this one. It’s very flexible, relatively easy to implement, and gives you the most control of all four types. It’s no wonder that the majority of the best action platformers of all time are based on this type. Examples include Super Mario World, Sonic the Hedgehog, Mega Man, Super Metroid,


DEVELOP-ONLINE.NET


Contra, Metal Slug, and practically every platformer of the 16-bit era.


HOW IT WORKS Map information is stored in the same way as with the pure tile technique; the difference is merely in how the characters interact with the background. The character’s collision hitbox is now an Axis-Aligned Bounding Box (An AABB; a rectangle that cannot be rotated), and is typically still an integer multiple of tile size. Common sizes include one tile wide and one (small Mario), two (big Mario, crouched Samus) or three (standing Samus) tiles tall. In many cases, the character sprite is larger than the logical hitbox, to make for a more pleasant visual experience and fairer gameplay (it’s better for the player to avoid getting hit when he should have than for him to get hit when he should not have). In the image right, you


Mega Man X, shown with tile boundaries and a ‘smaller-than- character’ player hitbox, which together allows for a more visually pleasing and rewarding experience


JULY 2012 | 57





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