Neo Geo Pocket Color development - NGCollector
Last updated on March 31, 2012, 8:19 by Sebastian Mihai
I find the Neo Geo Pocket Color interesting because it was SNK's courageous attempt at dethroning the portable king Gameboy. While I like Gameboy's simplicity very much, the NGPC feels more advanced and cool. Also, it has the best directional pad on a portable system in my opinion. It's a miniature joystick which offers great precision. Despite having great potential, the NGPC was unable to defeat the Gameboy.

I thought it would be pretty cool to make a Neo Geo-themed game. Given my interest in collecting AES (home) cartridges, I chose that as the theme. You are a collector trying to get a full set of AES cartridges. The in-game prices should be reasonably close to actual game cartridge values, although they may be somewhat outdated depending on when you play this game!

Neo Geo collections can be expensive, so you will have to use a variety of ways to get money for your games! Gambling at the casino, robbing convenience stores, fishing at the flea market, working at a burger joint, or trading with a fellow collector, are all fair game!

You can only hold ONE of each game, so trade wisely! Now you too can experience the life of a Neo Geo collector, but without sacrificing your soul, disposable income, and sanity!


rom - the NGCollector rom. Should play in most Neo Geo Pocket Color (NGPC) emulators
source - the NGCollector source code. Use it with the dev kit
dev kit - the NGPC dev kit. Unzip it to C:\. It comes with an emulator, and the source code for NGCollector (and another example)
NOTE: The dev kit zip file is password protected, and the password is "ngpc". I have scanned the package with VirusTotal, and 1 out of the forty-something virus engines reported a most likely false positive. I still used it, although in an isolated virtual machine in VMWare Player. Use at own risk.
Leave at least one blank line at the end of each of your source files.
The dev kit doesn't work in Windows 7, but it does work in Windows XP. You can download VMWare Player, create a Windows XP virtual machine, and develop in it :)
NeoPop emulator - a good Neo Geo Pocket Color emulator. I used it as a run-time environment to try out my NGPC homebrew code


You can access your collection almost at any time. Games you own are marked in green, and you can change pages.

Here is the game running on real hardware!


flea marketHere you will find a bunch of games for sale. You can quickly add them to your collection, provided you have the cash.
fellow collectorWhen visiting this collector, he may offer trades, so keep an eye out!
casinoIf you're feeling lucky, then start gambling to raise money for the next "must have" game!
convenience storeEmbrace your dark side and attempt to rob the convenience store for some easy money. Hopefully the police won't catch you. But be careful... they learn!
Burly BurgerIf you'd rather earn honestly, then start flipping! You can work here as much as you wish, but the pay isn't great.

Technical Design

The program entry point is in ngcollector.c. This file takes care of loading the graphics into memory, showing the title screen, and calling the entry point to the game itself.
Note the carthdr.h file, in which you can set the name of your game, as well as program entry point (not that you'd have a solid reason to change it from "main").

graphics.c contains the actual tile definitions, somewhat well documented.
gamelist.c has a single entry point, and it shows and handles user input on the game list screen.
collection.c contains the collection definition, including game values, and which games the user possesses
levels.c has the code which builds the backdrops and scenery for each level
messagearea.c contains the logic for the message area at the bottom
events.c provides the brains for generating events, such as item trades, flea market finds, etc.

The main game code is found in gameplay.c. After initializing player location, palettes, etc., it enters the main game loop, which does the following:

- Reads user input
- Animates player
- Changes levels (screens)
- Handles events for buttons A and B
- Shows the game list screen

Changing levels
Each time the player approaches the end of the screen, the level is changed, assuming that there is another level towards the direction of the player. The following happen:

- Player sprite is moved
- Screen is cleared
- Level is loaded graphically
- Random event generation is attempted (finding a game, being caught by Neo Thieves)
- Event generation is attempted

Events make the game more diverse, and are of two types: random, and screen-based. Random events can occur on level transition, regardless of level. Screen-based events, or just "events", occur with respect to the current level, and certain other conditions.
Event generation and rendering are separate because the game is designed to NOT re-generate events when the user returns from the game list screen. Essentially, you enter a screen, get an event, and then if you check your game list and return, then the even should be the same one as before.

Here's an example of an event generation on the casino screen:

- Does player have enough money for at least the cheapest gamble amount?
If so, then create a "casino gamble" event
Otherwise, create a "casino broke" event

Rendering is done after generation, and after the player closes the game list screen.

Here's an example of an event handling for button A:

- Is the last created event a "casino gamble" event?
If so, then take away the respective amount from the player, call the appropriate function in events.c to generate a winning amount, and then either display winning amount and add the winnings to the player's money, OR display "You lost".
In the case of the casino, the generation of a new event is then attempted immediately, so that the player can gamble again.

Random events are special in which they have a small chance of happening on almost all screens. Their generation and rendering happen together and only ONCE, after which the random event is no longer present. This is because random events should not be shown more than once, as to not give the impression that it happened multiple times on the same screen when the player opens and closes the game list screen.

That's about it. Contact me if you have questions, or suggestions!
If you use the materials on this page, or any other page on this web site, you do so at your own risk. They are provided "as is". No warranty is provided or implied. I neither guarantee that the materials will work, nor that they will not be harmful in any way.

Electronic circuits - CMOS buffer

Electronic circuits - driving higher current loads through parallel port

Electronic circuits - interfacing a Nintendo NES from Snowdrop OS

Electronic circuits - 3-bit current buffered DAC

Electronic circuits - stepper motor driver controlled by Snowdrop OS

Electronic circuits - parallel port interface

Snowmine - a Minesweeper-like game for Snowdrop OS (in x86 assembly)

Storks - a matching game for Snowdrop OS (in x86 assembly)

Electronic circuits - interfacing with a 16x2 LCD via parallel port

Electronic circuits - square wave vs. sine wave (audio differences)

Electronic circuits - Catch That LED!

Electronic circuits - parallel port light show

Electronic circuits - the Annoizer (555 speaker circuit)

Intellivision development - Hotel Bunny

Coverage of my projects

Interviewed in the Retro Gamer magazine

My homebrew cartridges

ZX Spectrum development - Husband Chores (in Z80 assembly language)

No Snakes! - a multiplayer game over serial port

Sega Dreamcast development - Overbearing Burgers

Snowdrop OS - my operating system from scratch, in assembly language

libzx - ZX Spectrum game programming library (Z80 assembly language)

Compact Pong - game in C# for the Pocket PC (Windows Mobile 2003)

TOTP (time-based one-time password) authenticator in C# (.Net)

aSMtris - Tetris in assembly language (x86, 16-bit)

Balanced Diet (GBA) limited edition

Gameboy Advance development - Balanced Diet

Atari 7800 development - Poetiru

Arcade ROM hacking - Knights of the Round translation

PocketStation development - Pocket Worm

Sega Game Gear development - Burgers of Hanoi GG

Pokemon Mini development - Mini Cookie

Magnavox Odyssey2 development - Red Green

Sega Dreamcast VMU development - Raining Squares

Nintendo GameCube development - Mama Bear Puzzle

Nintendo Wii development - Groundhog Puzzle

Sega Saturn development - Saturnade

Atari Jaguar development - Jagmatch

Sega CD development - Blackjack CD

Nintendo 64 development - Don't Be Square

Commodore 64 development - Tube64

Sega 32x development - Eight Queens

WonderSwan (Mono) development - Swan Driving BW

WonderSwan Color development - Swan Driving

Animal Keeper - a JavaScript and HTML5 Canvas game

3DO development - Space Invaders Invaders

Sony PlayStation development - The 11th Power

Sony PSP development - Newton Voyage

Nintendo DS development - Geoincursion

Gold of the Kingdoms - an XNA/C# homebrew game

Blue Elf 2 309-in-1 JAMMA PCB - troubleshoot controls not working

Fractals in JavaScript and HTML5 Canvas

Angry Video Game Nerd (AVGN) theme song on the Gameboy Advance

Novice calligraphy - Gothic hand, with letter guide

Video compilation of my classic console homebrew games

Seven segment display circuit with the 4511 decoder and the 4029 counter

A simple Atari 2600 joystick tester circuit

555 timer and 4017 decade counter - traffic lights circuit

Catch That LED! - an electronic game circuit

Capacitor study circuit

BlackBerry PlayBook development - Sheepish Bearings (Native SDK, OpenGL)

Neo Geo Pocket Color development - NGCollector

Neo Geo development - Neo Thunder

Atari 5200 development - Shooting Gallery

ZX Spectrum development - simple input/graphics example

Vectrex development - Scalar Ownage

Nintendo Virtual Boy development - Real Danger

Gameboy Color development - Burly Bear vs. The Mean Foxes (GBC version)

Sega Master System development - Burgers of Hanoi

Colecovision development - Mowleco

TurboGrafx-16/PC Engine development - Alddee

Atari Lynx development - Catkanoid

Nintendo NES development - Invaders must die!

Atari 2600 development - Snappy (batari basic)

Super Nintendo development - Bucket

Gameboy Advance development - smgbalib library

Airplane Vegas slot machine

Sega Genesis development - Gen Poker

(2004) Project One - first university game programming club project

Gameboy development - Burly Bear vs. The Mean Foxes

(2006) RGB Overdose - university programming contest entry