thomblog

Tom 'voxel' Purnell's notes

Demonic Foundations, MSDOS puzzle/board game

Dos Game Jam

Last weekend I was feeling a bit despondent over not having made an entry for Dos Games July 2024 Jam, a periodically repeating jam with a nice community. The project I’d started for the jam had fizzled out, equally disintersting to develop and to play. So started drawing the game I’d like to make for the jam ‘if I had time’. A few hours later I had this mockup:

Demonic Foundations initial mockup

Someone once explained the boardgame of Santorini to me, and the mockup was my approximation of that concept, but set in some kind of pixellated hell. It’s a fairly simple concept - two players face off against eachother, each turn moving one demon, adding one tile to a stack. Demons can climb up to one step higher than their current position, and you win if your demon stands on top of a stack three tiles tall. Seems simple, enough so that I felt like I could manage to turn the game around within the week still remaining.

Development environment

I recently built a new desktop machine and so used it over my normal raspberry pi setup - but there’s nothing used during this jam that wouldn’t work perfectly well there.

Writing the game

I’ve written a few games for MSDOS both 16 and 32bit. Given that I wanted ‘nice graphics’ this time, I didn’t choose to limit myself in terms of graphics hardware. The game requires VGA graphics, though targeting the limited palettes of CGA, EGA adapters would definitely increase the ‘dos-feel’ of the game. I used the Allegro 4 library to handle all the low level details like initialising graphics modes, sound driver etc. Initially I was quite conservative with memory use and redrawing the screen - but once I decided I wanted a scrolling background I was having to redraw much of the screen every frame, so I just decided to redraw everything every frame. This reduces performance on pre-pentium machines I’m sure - possibly into the realms of unacceptable framerates.

But once I was committed to redrawing everything each frame, there was no reason to keep anything stationary. So I added ‘bounciness’ to the stacks of tiles, animated the movement of the demons, and added a dynamic camera that scrolls the map a little as you move the mouse - which also allows me to make the playfield slightly too large to fit onto the screen.

Taking the time to configure a nice debugging setup wasn’t part of my schedule, instead I relied on the time honoured and ever hated method of literring problem areas with print statements to output important state information to the console. This bit me when it came time to writing the computer opponent. There’s still a couple of bugs in its behaviour that I haven’t taken the time to analyse - I’m fairly certain stepping through with a debugger would make short work of that. I’m not a fan of using gdb from the command line, I should take the time to learn one of the gui frontends for it.

Cut content

I’d originally planned on adding multiple computer personalities to play against, with differing strategies. The ingame portraits were designed with those in mind, and would definitely be near the top of my todo list if I return to expand upon this game later. A short ‘campaign’ where you play against increasingly difficult opponents to reach the final boss of hell would be good too. Adding unique powers to each character is another option - I think some versions of Santorini do this as well - allowing for slightly asymetric play as each player has a different unique skill.

Results

You can download Demonic Foundations here. You’ll need a dos emulator, I didn’t take the time to make a web build that runs in the browser. People can download the game and play it on their own machines instead. I think it adds something to the DOS emulation experience, but it also reduces the number of people that will play my game - something I can live with.

Doing a graphics-focussed jam was great. Drawing little pixellated demons and portraits was definitely the highlight for me - but losing to the AI for the first time was also a highlight. So proud of my stupid little machine demon. Let me know if you play it!

Little corner demons