Ziggurat

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.

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.

Confidential Magazine #7 October/November 1989

While they didn't reveal actual subscription figures, the situation sounded a bit grim - the membership fee was to increase and there was a plea for readers to spread the word.

Meanwhile the helpline seemed to have switched to be a largely answering machine based service, and there was a request for solutions to a bunch of big recent adventures.

In this issue:

  • The news included details of several upcoming adventures from Electronic Arts and Gary Gygax consulting for Infogrames on "Drakkhen".
  • A look at "Talespin", a hypercard type package that allowed people to combine images and text into a series of pages connected via links.
  • Details of the "Rainbow Warrior" game that featured arcade sequences depicting Greenpeace campaigns.
  • Game industry agent Jacqui Lyons filed a report of a trip to the Soviet Union to meet with developers.
  • A preview of "Elvira".
  • A profile of strategy/role playing specialists SSI.
  • An inteview with Horrorsoft's Mike Woodroffe.
  • Play By Mail game "Gothick".
  • Part 2 of the "Writing Your Own Adventures" series.
  • Advice on how to go about running your own LARP events.
  • This month's story was "Future's End" by Simon Scarrow.