Announcing Spectral Dungeons

2013-06-23

I've toyed with the idea of writing a game for the ZX Spectrum ever since discovering the ZXBasic compiler. I even wrote an article giving reasons why it makes sense to develop for retro computers. And this month I finally put my money where my mouth was. Gentlemen, I give you... Spectral Dungeons!

This is not only my first serious game for the Speccy, but also my first completed roguelike, so development hasn't been smooth.

By far the biggest problem I faced was getting used to the incredibly tight resource constraints of the platform. You'd think setting aside 6600 bytes to store the level maps is no big deal, but the Speccy only has 40K available for program code, and that includes the heap/stack, plus an area of about 8K that you shouldn't use unless your game really is too big(?!) Mine shouldn't be, so I ended up just storing the random seeds for the levels and regenerating them every time.

You have to go through that to truly appreciate the ingenuity of game developers back in the day. Take the Dizzy series. Each of the games has about twenty complex, colorful screens. But if you look carefully, each screen is only about 15x6 tiles. Now, 15 times 6 times 20 equals 1800 bytes or just... 3 (three) of my levels!

Or take another classic and favorite of mine, Lords of Midnight, a strategy game with an absolutely giant map. But unless I'm mistaken, said map can't be much larger than 80x50 -- the size of a default FreeCiv game. And that still means only 2000 bytes...

(Edit: turns out it's 64x64, or twice that. Still smaller than mine.)

That puts things in perspective in another way as well. Traditionally, roguelikes have an 80x20 map. Newer titles consider that too small and implement huge scrolling levels which are mostly empty. I was afraid that my 30x20 levels would be puny by comparison, but in fact they offer plenty of opportunity for exploration. Pro tip: use BSP trees with confidence. With minor tweaks, they can generate a variety of complex levels you can easily lose yourself in.

Having to work within tight constraints also helped in another way. The lack of objects, or even structs, drastically limited what features I could easily code. But that's what allowed me to finish the game at all, on "just" my fifth or sixth attempt at making a roguelike. And you can get surprisingly far with just tables.

What didn't work so well? The compiler is slow (and fussy). The code it generates is also slow, mocking my attempts at optimization. And I don't feel like re-learning Z80 assembly, or for that matter all the platform-specific tricks that are apparently needed to make games run smoothly on the Speccy. Sorry, but I'm getting old. It took me three weeks to write 1500 lines of code, and if it hadn't been a lot of fun I would have given up long before the finish line.

That said, I'm already thinking about the next game in the series. But I have too many other ideas to take care of first.