Occasional ramblings on games, generally retro related

​When my parents brought home a ZX81 one day (complete with wobbly 16K RAM pack, of course) I discovered the joy of programming. But it wasn't until I got my hands on a ZX Spectrum that my obsession with games really began, which continued with the C64, Amiga, right through to this day. The 80s and early 90s were an amazing time for games, not just for the games themselves but for the fascinating people behind them - it was truly a time of pioneers and creativity.

I myself have spent the last (almost) 20 years working in the games industry on all manner of platforms, most recently iOS. Ziggurat Development Ltd is my company here in NZ that provides contract programming services.

Confidential Magazine #8 December '88/January '89

As we bid goodbye to the 80s, the Editor pondered what lay ahead in the coming decade. After the world had lived in fear of nuclear annihalation for so many years, the arrival of the likes of Gorbachev meant we could now focus on the "prospect of irreversible doom" thanks to global warming. Technology would, of course, play a significant role in what was to come: "Our ability to manipulate information and communicate the results to the whole World within seconds, could lead us into chaos."

Overall, a cheerful way to open this issue.

As for the rest of the mag, it featured:

  • A report from the PC Show at London's Olympia.
  • An interview with the team behind the Cthulu inspired adventure, "The Hound Of Shadow" from Electronic Arts.
  • With the bombshell news reported in a previous issue that "Scapeghost" would be the last adventure game from genre legends Level 9, Confidential wanted to find out what was behind the decision, and what to expect next. There were a raft of reasons, but declining sales was - unsurprisingly - the primary, and they were tight lipped about their plans aside from saying "Contractual secrecy prevents me saying much about Level 9's future games, except that they are 16-bit, with state-of-the-art animated graphics."
  • A guide to the Kingdom of Kerovnia, the setting for the games of Magnetic Scrolls.
  • A look at to the upcoming titles from Sierra: "Hero's Quest", "The Colonel's Bequest", "Codename: Ice Man", "Leisure Suit Larry 3" and "Sorcerian" (unreleaased).
  • Game agent Jacqui Lyons continued her reporting from behind the iron curtain.
  • This month's Play By Mail game was "Pop Star" from Ideal Games.
  • An interview with adventure game reviewer/journo Keith Campbell.
  • A preview of Novalogic's naval sim "Wolfpack".
  • The Adventure '89 convention saw twenty multi-user games represented.
  • The third part of "Writing Your Own Adventures".
  • A guide on running your own LARP events.

Diary of a Game: Part 2 - Matching and Testing

Once again a depressing amount of time has passed since my last update. Given what's on my plate workwise over the next few months I suspect the sporadic nature of my posts will continue. Thankfully I have continued to find time to chip away at the game, and some progress has been made.

After I managed to get a super rough first pass of the (very) initial base of the game done (with the balls/bubbles/whatever falling down the board and stacking up correctly), the next thing to tackle was the colour matching. This ended up being a rather humbling endeavour as my initial confidence met the realities of my inexperience with 6502 coding.

The first step was get the connecting neighbours for each any given cell on the board, which was straightforward enough.

 Finding the neighbours of each cell.

Finding the neighbours of each cell.

With a simple routine to return a list of neighbours for a given cell, I could move on to figuring out all of the matching connected items. This is where things got a little complicated. The board on which the items appear can be viewed as a graph/network of connected nodes. Most nodes have up to 6 neighbours, whereas those on the edges & corners of the board have up to 2, 3 or 4 depending on their position. Chains of connected items can potentially use every cell on the board. So I decided to use a basic graph/network search, which looks something like ...
For a given item:

  1. Push the item onto the "open" stack (items that need to be visited)
  2. While the open stack has items on it:
  3. Pop an item
  4. Mark it as matched & visited
  5. Get a list of matching neighbours
  6. Iterate through each neighbour, and if they haven't been visited then push them onto the open stack.
  7. Go to step 2

While this is the kind of thing I've done many times in more fully featured languages, I really struggled to get my head around doing it with 6502. The fact that I didn't have decent chunks of time to sit down and focus on it didn't help. I eventually got there, though, and the moment where it finally worked was one of the most satisfying achievements for me in recent times, which is somewhat amusing.

 Testing the matching chains of items.

Testing the matching chains of items.

What this all highlighted for me was that I really needed to spend some time improving my testing and debugging process. The C64Debugger was useful, though I just can not seem to get it to load symbols - I keep meaning to download the source and have a poke around. I had never really explored debugging in VICE, but I found this blog post a great introduction. Once I realised I could load symbols, VICE was a huge help (I had previously been manually printing out addresses at compile time in KickAssembler).

But as I went back to refactor and optimise routines I found myself getting pretty frustrated at subtle bugs creeping in which became difficult to track down. Thankfully there is a nice unit test solution for the C64. Yes, unit testing on the C64. Michael Taszycki of the excellent 64Bites video series has created the 64spec framework, which allows you to setup unit tests and run them on the 64 (or in an emulator). This now allows me to make changes and have some confidence that if I break anything I'll be able to catch it early.

 One of unit tests. I have multiple files for each major component.

One of unit tests. I have multiple files for each major component.

 Oh dear, something went wrong somewhere. Time to debug.

Oh dear, something went wrong somewhere. Time to debug.

And so now things are at the point where balls/bubbles/whatever fall down, stack up and get removed when chains of 3+ matching items are found. Next on my plate is some more refactoring and optimisation, then I need to tackle using sprites for the moving items so they look a little less crap.