Gold of the Kingdoms - an XNA/C# homebrew game
Last updated on February 20, 2014, 8:10 by Sebastian Mihai
Gold of the Kingdoms was born of my desire to create a complete game, decently balanced and with music and sound effects. Although I haven't developed a game for Windows in a long time, I read that XNA is friendly to use, and the added benefit of being able to program in C# (which I'm currently using at work) convinced me to follow this route. The game took just over three months to create.

For more technical details, check out the Development section below.

Gold of the Kingdoms has you guide a caravan between various kingdoms where goods can be traded in order to make a profit. During travel, the caravan can encounter various hazards such as wolves and bandits. As such, upgrades can be purchased in order to reduce losses to such hazards. At the other end of the spectrum, scoundrels can be hired, and they will steals from others and bring you the spoils!

The ultimate goal of the game is to influence all kingdoms in the realm, which is accomplished by paying a large sum of gold in each kingdom.


Installer - installer for Windows. Download this to play. Tested in Windows XP and 7.
Source - source code (Visual Studio solution).



While most of the resources such as songs, sound effects, and textures were taken from free game development resource sites, the Gold of the Kingdoms program was designed and written from scratch. This includes things like mouse routines, UI elements design, etc.

My approach is to first program the fundamental game rules in their own heavily-tested and well-covered assembly (called Core). Then the development shifted almost entirely to the XNA interface elements. Once I was happy with how the game felt, I invested time in balancing it, revisiting some of the Core code. Here is a chronological progression of where the effort was spent.

Here are a few code statistics:

95% Core test coverage

84 out of 100 Maintainability index (Visual Studio report)

Largest class: 205 lines of code

As part of testing, I've also ensured that there are no memory leaks by creating a user defined report in Windows' Perfmon, and then playing the game intermittently for about two hours. The report contained nothing remarkable, which was good news.

In terms of what I could have done better, I considered using StructureMap for dependency management and injection at a point in time, but decided against it. Towards the end of development, it became apparent that it would have saved me a bit of time and code.

More time than anticipated went into finding and editing resources, but it was also fun. I think that during the development of indie games there is a certain moment in time when the program stops feeling like a program you have been writing every evening and starts feeling like a game.

Enjoy the game!
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