Finally, I completed the development of BugSprayer, but not without some struggles!
7:28 PM (AEST), Dec 12th, 2025
After a long week of development, BugSprayer is finally complete... but not without its challenges!
As you saw in my previous post, the game was shaping up nicely. Both gamemodes were done, and I just needed testing, menus, sound effects, and polish. But as soon as I started those final touches, I hit the dreaded "Warning: Write from one bank spans into the next. 0x7ff0 -> 0x800f (bank 1 -> 2)" error. Suddenly, I wasn't as close to done as I thought.
I didn't realize throughout development how important it was to keep an eye on my ROM space and how much I had remaining in each bank. It's a miracle I managed to get everything completed, by the end I was so tight to the bank limit, it's crazy!
Basically, the Game Boy's CPU can only see and access 32KB of ROM at one time. For bigger games over 32KB, the ROM is split into multiple 16KB chunks called banks. Bank 0 is the fixed bank and is loaded at all times; everything else needs to be switched in and out when needed—which is where my problem with BugSprayer came in.
I developed without really understanding how banks worked, so all my game was built into Bank 0 and 1 with autobanking. If I switched to Bank 2 to expand, it would break a bunch of logic since half my game was in Bank 1. Basically I needed to reorganize everything so it was properly spread across each bank, instead of stretching between two.
While I understand how banks work now and will keep this in mind for my next GBDK project, this one was too deep into development to sort out the mess. For BugSprayer, I decided to keep it within banks 0 and 1, sticking to 32KB, and just refactor things to be smaller to fit the remaining polish I wanted to implement.
The first step was redrawing all my sprite sheets—I had so much opportunity for space saving here. I removed duplicates, unused sprites, and built a new sprite sheet for letters and numbers that I could keep in RAM for quick access. Having a letter sprite sheet let me ditch printf calls (which I learned are very expensive) and draw scores, pause menus, main menus, game over screens, etc., all with the same pre-loaded data. Sprite sheet refactoring was a huge first step for ROM space.
Next I tackled the code: removing unneeded for loops, storing constants as variables, replacing lists/collections with algorithms, cutting duplicate code, and using the right unsigned ints (UINT16/32 only when needed). These are things I should do anyway, but after years in modern engines, you forget how critical they are!
After many hours going back through everything—sprite sheets, code, music, sound effects—to squeeze my game into the first fixed and first bank, I finally completed development. And in the end, I genuinely think all this crunching made a better product! Leaning into the limitations and doing the best I could within my ROM size ended up creating something more charming and satisfying when it finally worked again.
BugSprayer can be downloaded below, but it's also available on itch.io for browser play! Please check it out and let me know what you think. Thanks so much for reading this far—I'm really proud of what I've made and hope at least a few people enjoy playing it as much as I genuinely have. Thanks very much!