Gameboy Game Made Quick

The above video is the result of a couple of days work learning the ZGB engine I posted about earlier.  The game I’m making is for the “GAMES MADE QUICK??? 1½” game jam being held to coincide with SGDQ 2017.  I’m using this opportunity to push myself to learn Gameboy dev faster.  Because there is no official theme for GMQ I’m using the theme for the bitbitjam 4, which is “Velcro Sheep.”

So far the learning curve has been decently steep.  Most of my time is spent finding the limitation of what is possible to do on the Gameboy or at least in the ZGB engine.  Some things like displaying text and numbers are not as simple as I thought it would be.  For the jam’s sake, I’m not including any text or score in my game, but my plan is to dive deep into the engine and see if I can’t add text display.

I did manage to have four digit numbers display on-screen and it worked fine, but having labels that say what those numbers meant was much harder somehow.  The problem I found was that since there is no OOP and that sprites can only be squares of certain sizes each element of a HUD has to be a separate sprite.  Each digit is its own entity, each letter or empty space as well.  Anyway, ditched UI for the time being.

All that being said, here are some things I learned about working with the ZGB engine:

  • The sprites used by the engine are essentially separate objects and multiple can be spawned and their ‘custom_data’ won’t overlap, but to make them behave differently you have to get creative.  I found that you can create an array of pointers to the new sprites and set the pointers when spawning new elements.  From there, you can modify the ‘custom_data’ directly from the ‘Game State’ and in the sprite’s update you can decide what behaviours it has based on the ‘custom_data.’
  • To get objects to move in screen space, for example, a HUD, you can access the scroll offsets by including ‘Scroll.c’ add the offset value to the base position on-screen and the sprite will move with the “camera.”  The base position is the screen space position in pixels you want your object to reside.
  • The ZGB engine converts .MOD files to music that can be used on the Gameboy, but how do you make a .MOD music file?  I used MODPlug Tracker, but you can’t use just any samples because the Gameboy won’t read it right.  So what I did was take the template audio that comes with gbt-player legacy (the file is “template.mod”) and used that as a sample because I know it already works on the game boy.

So those are some things that took me 3-4 hours each to discover, but I did figure them out.  There aren’t many resources out there, but the challenge makes it that much more fun.

Here is the repo for the game: https://github.com/CarloAlbino/ZGBEngineGame

🙂

Leave a Reply

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