Home

What's in a Frame? 2

Kirby's Dream Land (GB, 1992)

The Game Boy's background tile map is a 32 by 32 tile square grid, but many games take place in a world that's wider or taller than 32 tiles. How is it possible to keep scrolling in one direction without running into (or off) the edge of the map?

There are two important properties of the background to remember. First, the background loops: if you scroll beyond the right edge, you see the left side again. Likewise, if you scroll down far enough, you end up at the top again. Second, the tile map is bigger than the screen, so there are always parts of the tile map not shown on screen.

That means that whatever direction we're scrolling in, there will always be a part of the background tile map "ahead" of us, i.e. a part that's off-screen, but about to scroll onto the screen. The trick is to update that part of the tile map with the next piece of the level data. If we keep updating the map at the same speed we're scrolling, we can effectively scroll forever.

This solution can be found in virtually every Game Boy platformer and top-down RPG, and is illustrated here by Kirby's Dream Land. As Kirby moves to the right, the viewport moves to the right. While one column of tiles is scrolling off the screen to the left, another is scrolling onto the screen from the right. The area of the tile map just to the right of what we can see on the screen is continuously updated with the next chunk of the level.

If Kirby turns around and moves to the left, the game updates the tile map to the left of the screen instead. The same principle can be applied to up/down scrolling.

Continuously adding new strips to the tile map means continuously writing over older data in the tile map, which isn't a problem. All that matters is that the section of the map shown on screen at any instant comes from the correct part of the level data.

Kirby's Dream Land uses objects to draw the player and enemies, and the background to draw the environment, which is typical for platform games. The window layer is used to draw a fixed status bar along the bottom of the screen, which doesn't scroll with the background. This is a common technique, also seen in games such as Battletoads (GB, 1991), Donkey Kong Land (GB, 1995), Shantae (GBC, 2002), etc., but many other games draw status bars using different methods.

Mario and Yoshi (GB, 1992)

Mario and Yoshi is another simple game that exemplifies a common design pattern: items falling from the top of the screen are drawn using objects, then moved to the background layer when they lock into place. This pattern can also be found in games such as Tetris (GB, 1989), Klax (GB, 1991), Worms (GB, 1995), Kirby's Star Stacker (GB, 1997), Trouballs (GBC, 2001), etc.

However, the game also shows that objects aren't strictly required when we want to move things around on the screen. When the player swaps two columns, or clears a column with an egg, this is animated by changing the background tile map.

Another interesting feature of Mario and Yoshi is the plain background. This adds a fourth colour to all objects for "free", since the background colour will appear through any transparent areas of an object. Mario's face and hands, as well as Yoshi's eyes and chest (frames 416–512), are transparent and get their colour from the background behind them.

Further information