thomblog

Tom 'voxel' Purnell's notes

Quokka Wokka, a small GBA game

Using the environment configured in the previous post, I’ve created a small game as an entry to the game boy advance gamejam gbajam24, Quokka Wokka.

Quokka Wokka logo

This was my first time writing a GBA game, and there was quite a lot to learn. I used the tonc library to do most of the heavy lifting, but I still needed to understand how to working with the GBA video memory, making sure data was in the right format and the right place in memory. I opted for a fairly simple, straightforward game to try and limit the development difficulty, not wanting to combine learning a new platform with trying to perform complex programming. So, Quokka Wokka is a 2D ‘single screen arcade platformer’ where you play as a Quokka that needs to clear each screen, avoiding touching the enemies, throwing your babies as weapons, and eating as many leaves as possible.

Quokka throwing some babies

Gameplay

The goal is to clear each room of enemies. There are two ways to do this - throw your babies at an enemy to stun them, and then run into them to send them flying across the screen. When they land they’ll turn into delicious fruit. The other method is to collect all the small leaves on each map - which triggers the ‘Bonus Game’ inspired by Rodland, turning all enemies into giant harmless leaves that can be touched to create bonus letter pickups - collect all six letters to get an extra life.

The Quokka is an Australian marsupial largely known for being willing to sacrifice its children while fleeing from predators, physically dropping them as it runs away. I’m not sure that throwing one at a crab would stun it very effectively, but there’s some basis in reality here.

Graphics

Grafx2 image editor

The graphics were drawn in Grafx2 and Aseprite. Aseprite is definitely a more fully featured editor, but Grafx2 is much snappier on limited hardware like my Raspberry Pi, as well as being much easier to install and get running.

For simplicity, I kept most of the graphics in a single spritesheet. The GBA can hold more than this in graphics memory, especially when using ‘4bit’ palettised graphics - but again to keep things simple for myself I used ‘8bit’ colour support - all graphics take up twice as much memory but share a single large palette. If I were to develop this into a full game I’d start by switching to ‘4bit’ graphics to allow for swapping palettes at runtime, and allowing for a greater variety of sprites to be visible onscreen at once.

Music

Milkytracker music editor

I tried to find a musician to contribute music for the game, but the responses were from people that were unfamiliar with the formats the game would need. I can’t fault anyone, but I increasingly see musicians drop links to their portfolios in the discussion boards for popular gamejams, even when their music is produced entirely through a modern workflow incompatible with the target platform for the games. GBA music is bbest created as a ‘.mod’ or similar format - small audio samples packaged with a midi like sequence of notes telling the machine when to play each sample, at what pitch and volume etc. It’s not trivial to go from a modern ‘Digital Audio Workstation’ to the spartan limiations of a tracker. A musically talented family member did try, but it’s a lot to learn! So in the end I created the music using Milkytracker, and although it’s not a great soundtrack, it turned out better than I feared.

Programming

Writing in C feels like a holiday after being down in the 6502 assembly mines. Though it won’t net me the best possible performance for the machine, C gets pretty close, and the game is so simple that it’s not really a concern. If I wanted 3D, some very fast matrix maths or similar, then I’d look to peppering in some assembly. Libtonc is not just a library of useful functions, it’s also a well documented api with an extensive tutorial. I had to re-read some sections on how videoram is mapped and interpreted when things didn’t behave how I expected, and I had some interesting effects when I pushed the sprite hardware the wrong way. Definitely a library and workflow I’d like to use again :)

Hardware

Game boy advance and game cartridge

I grabbed some cheap ‘pirate carts’ from aliexpress. It was a bit of a gamble as not every cart is compatible with my cartridge flasher (the device I use to copy my game from the development machine onto the cartridge, which can then be inserted into the game console). A ‘blank’ cart sells for around $30, but these ‘game reproductions’ only cost $4 each, and work great. The same can’t be said of my printer, which has decided to no longer output blue ink, causing the sticker label to be quite pink. I have modded this Game Boy Advance to use a backlit screen, which means I haven’t been able to check how readable the graphics are on the ‘unlit’ display the original GBA shipped with. Hopefully someone will let me know if it’s unplayable.

Summary

Quokka fighting the boss

Quokka Wokka is a short, easy game. As a ‘full game’, it would need more bosses, a lot more maps, and perhaps a few extra gameplay mechanics. I think it’s more suited to platforms a little older than the GBA, where less gameplay complexity is expected.

I enjoyed making something simple while learning about the workings of the GBA. It’s a lot more powerful than I realised, and writing a game for it in C, rather than the assembly I work with for the original Game Boy and NES, made the process fast.