Gameboy Advance programming

A buddy of mine (Shu) and I decided yesterday to get together for the day and see how much of a GBA game we could write in a day. It was a fun learning experience. Both of us came to the table complete noobs in the GBA homebrew space and left the evening feeling pretty comfortable with how GBA games are designed and developed.

We targetted a platformer-esque game because we thought originally that it would be the easiest. Well it is and it isn’t. Platformers have very large maps and the GBA has big limitations on what size background images you can draw (256×256 or 512×512). Relying on the GBA hardware to handle the terrain/world/map (whatever you want to call it) isn’t ideal in a platformer. We ended up coding something that built the background on the fly using a much larger array stored in memory and a tile set. I then invested the rest of my time building a force-based approach to moving Mario so he could slide and skid around the map, and Shu spent his time building sprite code so Mario could chuck fireballs.

The biggest hang-up for me and the reason I think we didn’t get farther was the toolset and the documentation. Beware if you’re considering getting into GBA development: I would recommend you just stay away from all the tutorials that are out there. I tried following several of them and they’re not only poorly written, but in many cases they’re outdated and innaccurate. I wasted probably 2-3 hours just trying to figure something out in one of the tutorials that just wasn’t possible on the latest version of the devkit. If you want to get into GBA development just go to the devkitpro website and don’t leave it.

Another big hang-up with the toolset were the map editors people have written for GBA. I hate to knock free software, but frankly they’re just a complete waste of time. One of the map editors only exports half of your data, and the other one adds nonsensical padding information into your map making a 33×31 map where it should be making a 32×32 map. In the end I scrapped the map editors and decided to just write the game so that I could pause it and edit the map directly in game. To retrieve my edited map the Visual Boy Advance emulator has a feature where you can dump a location of memory to a binary file. I edit the map and then in the game code I copy the data to a fixed, (hopefully) unused location in memory, dump the data to a binary file using VBA, and then use the ‘raw2c’ command line tool that comes with devkitarm to make a header file out of the new map. Instant map editor, and I can play the results as I go along.

Leave a Reply