Game Boy – A World of Adventure Awaits!

For some reason a year ago I decided that I wanted to learn how to develop for the Game Boy.  I am a nostalgic person and making a game for the first console I ever owned sounded like a really fun idea.  The issue with embarking onto this adventure is that the Game Boy is very old relatively speaking and it’s not as if modern game engines compile to Game Boy.  While doing research on how to work on GB, it sometimes feels like I’m an archaeologist.

Quick Googling lead me to the GBDK, a development kit that compiles Game Boy games.  My dream had come true, a way to make Game Boy games.  More Googling lead me to a great wiki with many resources and tutorials.  The first thing I did to get my feet wet was to follow the video tutorials listed there.  The following gif is the result of those tutorials, and the repo can be found here.

I created sprite versions of a few emojis (I thought it would be a fun), and I made my own Input Manager that can check for button hold, pressed and released.  I had to learn the differences of C quickly to keep up, but it’s super fun managing memory and bitwise operations.  I’m not being sarcastic, I’m sincere in saying that it’s fun.  I always try my best to be efficient, but when working with hardware like the Game Boy’s it’ s a necessity.

Anyway, once I had those tutorials done I decided to start doing a bit more complex things, like having objects and collisions.  The problem, I realised very quickly, was that object-oriented programming isn’t a built-in concept in C.  So I started looking around and it turns out there is a way to emulate object-oriented programming in C.  I tried it out but had some trouble allocating and freeing up memory, reading the documentation for the GBDK I found that the malloc function may be broken so the OOP direction I wanted to go didn’t work out.

I took a day off of researching after a frustrating day with not much progress and decided to look at the GB Dev wiki to see if there was anything else that could help me out.  What I found was something of a miracle.  The ZGB engine.  This wonderful engine does so much of the heavy lifting in terms of programming and memory management.  It also adds a Start()/Update() structure to the code is familiar to Unity and Unreal devs.  ZGB takes care of audio, collisions, animations, scene changing, “camera” scrolling, it’s great.

It did take me a bit of time to install it and set up a nice work environment, but it is well worth it.  That being said, it’s still a work in progress and learning experience, I’ve only been at it for a few days after all.  Here is what I got so far (basically just the tutorial with a very annoying, yet familiar music loop I made in the background):

I will keep going with this project.  My goal is to have a nice bundle of tools ready to go for the next game jam I participate in so that I can make something cool for the Game Boy.  This is gonna be fun. 😮

Leave a Reply

Your email address will not be published. Required fields are marked *