Game Boy Development


In mid-2001, I stumbled across some Game Boy development websites, and discovered that most every thing I needed to create a GB game can be found on-line. I decided to play around a bit. Working on modern games can be very interesting, but with platforms like the N64 and Playstation 2, the game engines require a lot of work. It takes a team of fifteen or twenty people to make even a simple game in less than a year. With the Game Boy, though, a lone programmer with an idea can still make a game. Another nice thing is that it is very similar to the first console I ever worked with... the Sega Game Gear, for all of about three weeks as a newly hired technical support guy at Sega of America.

Here you can find several demos I put together over a few evenings once I started looking into the Game Boy, including source code.

On the technical side... all the demo files below include code files in the form of a single assembly file (testGame.asm) and several other files. The compiled version was run on the NO$GMB emulator. Initially I was compiling with the TASM assembler, but starting at test4 I switched to RGBDS, which is much more functional, but required some syntax changes.

For more technical info and tools for the Gameboy, see the links section at the bottom of the page.


Test 1 - Getting the System Running

This first test was just to get the Game Boy running and displaying something on screen. It loads a small tile set and a map, and then scrolls the screen to the left.
test1.zip (5 Kb)


Test 2 - Getting the Sprites and Joypad Running

The second step was to get the sprite display and joypad working. This demo adds a simple sprite that you can move around the screen with the joypad.
test2.zip (7 Kb)


Test 3 - Beginnings of a Game


For the next step, I decided to make the sprite display more complex... the little spaceship now points in the direction you fly it, and you can fire bullets with the A button.
test3.zip (9 Kb)


Test 4 - Scrolling a Larger Background


The fourth version of the demo adds the ability to scroll through a background map that is 32x64 tiles (twice the height of the Game Boy background map). I do this by adding tiles to the background tile map just off-screen every time the scroll goes past another 8 pixels. You can toggle the direction of scroll (up or down) by tapping the B button. After finishing this demo, I then modified it to compile under RGBDS, a more functional (and free) assembler than TASM... I've included both versions here.
test4.zip (12 Kb) **** test4_rgbds.zip (12 Kb)


What's Next?


The fifth version of my test game split the previous test into multiple files, and then improved the scrolling. Now, the game world is made up of a map of tile-blocks, each block 16x16 tiles or 128x128 pixels. The current world is 8 tile blocks tall and 4 wide (or 512x1024 pixels). It also adds a vram buffer than can be loaded with commands to load info to vram, making the vram loading during vblank as fast as possible. The scrolling is now tied to the little ship, rather than automatic. Move the ship, and the background scrolls.

It also now includes a little actual art. Previously, it just had my little spaceship and a bunch of numbers for testing the scrolling. But then Bruce Kreuger, a friend and former co-worker from the days when I worked at Sega, was kind enough to cobble up some asteroids and other stuff for me. I've only added the asteroids so far, but he also provided a couple of new spaceships and bullets for me, which I'll play around with at some point.

The first 4 demos should be enough for anyone trying to learn the basics of the system, so I hope nobody minds if I don't include the source code for my engine code... if you really need to know, you can always reverse engineer it in no$gmb!

test5.zip (3 Kb)


Further Advancements


With version 6, the actual demo hasn't changed much, but there have been a bunch of improvements under the hood. The only noticable change is the animating bullets (I have 4 tile animations now in the game, and I pick a different one each time you fire a bullet). However, on the inside, a lot of the sprite and bullet stuff that was hardcoded has now been made general purpose, so I now have most of a sprite engine, a simple tile animation engine, and most of a bullet engine.

Graphically, there have been some changes... I studied Bruce Krueger's asteroids, and then spent some time building a general purpose tile set for generating asteroids and stars, and used it to create a more interesting game world.

Also, if you hit the second button, you will change your ship into a different ship type... I built a bunch of tiny ships in a moment of creativity.

test6.zip (3 Kb)



Gameboy Technical Links

Jeff Frohwein's Technical Info Page - the best website for information about the GameBoy, it also includes information about the GameBoy Advance and other hardware and software systems.

Gameboy Technical Doc (Gbspec.txt - 60 KB) - this document holds all the technical information about the Gameboy... if you are going to do any Gamyboy programming, you need a copy of this file.

TASM Z80 Assembler with Gameboy support (tasm69.zip - 146 KB) - the first assembler I used to compile Gameboy code. The first 3 demos on this page were built for this shareware compiler. Note that this assembler is shareware... if you plan to use it beyond a week or two of playing around, you will need to pay for it!

RGBDS Gameboy Assembler (RGBDS95_110e.zip - 226 KB) - A much more functional and documented assembler than TASM, as well as being freeware. It is currently maintained at Otaku No Zoku, so go here for more info about RGBDS. I've never talked to Otaku, but we do have at least one thing in common... we have both worked on Battletanx games for 3DO (according to his website, Otaku worked on BTX GBC).

No Cash Gameboy Emulator and Debugger - A wonderful little shareware emulator and debugger for the Gameboy... using this you don't even need a Gameboy to work on Gameboy games. They are maintained at the No Cash Emulators website. I've discovered that it is useful to have both versions of the emulator... the Windows version is great for doing most of your work, but the DOS version runs much smoother and provides a larger game screen (at least for my Windows display settings).

Game Boy Tile and Map Editors - I used these simple-to-use art tools to do the art for my demos. They are maintained on Jeff Frohweins's page.


You can send me mail at opus@opusgames.com