Building Pong for the Nintendo Game Boy Advance

Video Tutorial

You can watch this tutorial in video form. Get the full code on the Project's GitHub

We'll be using the C programming language and the GBA tools from devkitPro to develop our simple pong game.

Getting Your Foot in the Door

When building games and programs for new hardware, or using a new language or framework, building a simple game like pong is one of the best ways to familiarize yourself with the platform. For the same reasons, if you are just getting into game development, or getting into homebrew development for the first time, pong makes an excellent first game to learn the fundamentals. Without much code, building pong teaches you about:
  • User Input
  • Rendering Graphics
  • Collision Detection
  • Designing Game Logic
  • Creating a Points System
  • Computer Players / AI
  • Managing Game States
If the GBA, game dev, homebrew, or any the items above are new to you, hopefully this example game and it's code can help you start to familiarize yourself with them.

Other uses for it include:
  • Practicing ROM Hacking with a small game and source code you can check
  • Testing core functionality for a GBA emulator you're developing
  • Practicing porting a game to other consoles with an easy example
This game has a very simple menu that is primarily included to demonstrate switching between game states in a game loop, and to allow the player to choose when they start a new game. It is not meant to show you how to create a proper menu, but I suppose you could modify the code to handle more menu options and sub menus if you wanted.

Additionally, if you want to learn about more advanced game dev features you can extend the game with your own code to:
  • Use sprites and more complex graphics
  • Add a multiplayer mode
  • Add more menus and the ability to edit settings
  • Build a 3D version
This game uses mode 3, one of the bitmap modes for the GBA (3, 4, and 5 are bitmap modes). This is one of the simplest modes to work with, but has its limitations. Updating pixels with the CPU is not particularly fast. For more intense graphics for 2d games, using one of the tile modes is usually a better choice for the GBA. But bitmap modes do have their place. For simple 2d graphics like in this game, or highly dynamic graphics such as those used in 3d games and semi-3d (raycaster) games, bitmap modes are often needed for software rendering. If you do plan on building a graphically intense game in a bitmap mode, keep in mind you'll have to do a fair amount of optimization to get it to run at a good speed. This certainly can be done, and there are impressive ports of Doom, Wolfenstein, and even Tomb Raider to the GBA that use bitmap modes. For our purposes mode 3 will be sufficient.

Watch the Video Tutorial above for instructions on how to start writing the code yourself. The full code and additional details about compiling and running it are available on the Tutorial's GitHub page.