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!

Downloads


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

Screenshots



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!


Locations


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
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.

RGB Overdose (my entry at the GMD game programming competition)

Gameboy development - Burly Bear vs. The Mean Foxes

Project One - An action RPG engine

Neo Geo development - Neo Thunder

Sega Genesis development - Gen Poker

Airplane Vegas slot machine

Animal Keeper - a JavaScript and HTML5 Canvas game

Gameboy Advance development - smgbalib library

Gameboy Advance development - Balanced Diet

Super Nintendo development - Bucket

Atari 2600 development - Snappy (batari basic)

Nintendo NES development - Invaders must die!

Atari Lynx development - Catkanoid

TurboGrafx-16/PC Engine development - Alddee

Colecovision development - Mowleco

Sega Master System development - Burgers of Hanoi

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

Nintendo Virtual Boy development - Real Danger

Vectrex development - Scalar Ownage

ZX Spectrum development - simple input/graphics example

Atari 5200 development - Shooting Gallery

Neo Geo Pocket Color development - NGCollector

My homebrew cartridges

Mowleco (ColecoVision) featured in Retro Gamer issue 106

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

Capacitor study circuit

Catch That LED! - an electronic game circuit

555 timer and 4017 decade counter - traffic lights circuit

A simple Atari 2600 joystick tester circuit

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

Video compilation of my classic console homebrew games

Novice calligraphy - Gothic hand, with letter guide

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

Fractals in JavaScript and HTML5 Canvas

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

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

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

Nintendo DS development - Geoincursion