O'Reilly logo

Retro Gaming Hacks by Chris Kohler

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Add Tiles and Sprites to Your GBA Game

Make your portable masterpiece come alive with tiled graphics.

Writing directly to the video buffer with bitmapped video modes on the Game Boy Advance [Hack #76] is all well and good, but uses a lot of memory and can be slow if you want to try any sort of complicated animation. The reason game consoles and portables are able to produce such brilliant visual effects, despite their low hardware specs compared to PCs, is because of their highly specialized graphics hardware.

In the case of the GBA, and most consoles made for 2D graphics, this comes in the form of specialized handling of tiled graphics. In this hack, I’ll show you how to use tiled graphics to reduce the amount of memory taken up by an image and increase the speed at which it can be displayed.

The first step in getting a GBA to display tiled graphics is, of course, to create the graphics it will be using. Tiles are essentially 8 x 8 squares that can used to draw a larger image. Larger and non-square tiles can be made up of multiple 8 x 8 tiles. Figure 8-24 shows a set of eight 16 x 16 tiles or, from the GBA’s perspective, thirty-two 8 x 8 tiles.

Once you have a usable set of tiles, it’s time to make the map data that will actually tell the GBA which tile to display where. There are several tools available on http://www.gbadev.org/ for creating map data, one of which is Warder1’s GBA Map Editor. When you launch Map Editor, two windows open up. One is the Tools window, where you can ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required