Theme: Retro Challenge! – hosted by BleuLlama – June 2014

<– Return to Announcement Post

Back to Browse Entries

Dr. Maze

by FyberOptic - Mini LD 52 Entry

My first Mini-Ludum Dare entry!

I went with writing a DOS game, because that's what I have the fondest memories of programming in as a teen. I've learned a lot since those days, and I wish I could have known then the kinds of things I know now. But luckily, this project let me combine the past and the present, during which I still learned some new things!

The game is called Dr. Maze. The backstory, which I didn't really get around to adding into the game itself somehow, is that a brilliant scientist named Morton A. Zeman had an passion for mazes. Gradually this became an obsession for him, which leached more and more into his work, until eventually his peers began to ridicule him for it. He disappeared into an underground laboratory of his own design, becoming a recluse and referring to himself only as Dr. Maze from then on, vowing to get his revenge on everyone on the surface. Your job is to infiltrate his lab and retrieve his plans before it's too late!

Gameplay is pretty simple. Find your way through the mazes to the ladder at the end of the level, collecting the floppy disks along the way, while avoiding Dr. Maze's Mazerunner robots. If one of them catches you, they'll drag you back to the start of the level.

The mazes are dynamically generated, so you should always get a different gameplay experience.

WASD moves you around, and spacebar leaves behind a marker beacon to help you remember where you've been. Pressing it again on one will retrieve it. The arrow keys will pan the camera, letting you look farther ahead. Holding shift while doing so makes the camera pan faster. It'll automatically pan back to the player when you're done. But be careful, Mazerunners can still get you while you're looking ahead!

There's still some debug keys: number keys to play sound effects, N to toggle no-clipping, and holding shift while moving lets you move faster, although technically you might find it useful as a gameplay feature as well.

There are a couple of bugs that I'm aware of:
- Occasionally scrolling will cause graphical artifacts from sprites to remain on the screen
- Walking diagonally in some directions results in you not being able to place a marker at the same time, due to the way the keyboard matrix is designed I guess

It runs in 320x200x256, "mode Y" (aka unchained mode), with double-buffering. Plain old PC speaker sound effects. Default DOSBox settings should be able to handle it fine.

I started with an entirely different project (an isometric-style Minecraft-ish game), but that wasn't working out very well performance-wise, so I moved on to a proper tile engine. I'd read about John Carmack's work on the original Commander Keen before, so it was fun to finally trying to implement something like that myself. I found myself against a wall many times in terms of performance, and ended up converting various code into assembly loops to get the speeds I needed. I also had to split the rendering across two frames: the first handles scrolling, and the second handles sprites, making the game technically run at 35fps instead of the 70hz refresh rate of that video mode.

This was written using a dev environment of Notepad++, OpenWatcom, DOSBox, Paint Shop Pro 7 (yes, that old!), Tiled, and a couple of custom utils I wrote during this to convert PNGs and maps to C headers.

Source is included for you to peruse, but mind you that it's a total mess, due to switching game ideas, as well as having no real idea of what the game would be until the last few days, which resulted in lots of hacks for features and bugfixes.

Downloads and Links


Optimus6128 says ...
Jun 23, 2014 @ 10:59am

Wow, very nice! At first I thought those markers I leave where mines, and I was trying (unsuccessfully) to kill the robots. And the game might be fast enough for my 386. In dosbox at 3000 cycles is just right and at 2000 it slows down when there are many sprites, which 3000 might be similar to 386sx 16mhz.

dancan12345 says ...
Jun 23, 2014 @ 8:06pm

How would i run a DOS game on a mac?

FyberOptic says ...
Jun 24, 2014 @ 12:49am

@dancan12345 Pretty much every platform should be able to run it via DOSBox. You can grab it here:

You basically put the EXE from the ZIP into a folder, then run the command to mount that folder as a drive inside of DOSBox (which I think it gives an example of how to do when you start it), switch to that drive, and then type the filename to run the game.

FyberOptic says ...
Jun 24, 2014 @ 1:05am

Somehow I cut out the first part of my response!

@Optimus6128 Using them as mines is actually a pretty neat idea. I thought about implementing a gun at one point, but I'm no artist, and I would have needed to draw sprites from the front and back perspectives so that you could shoot in all four directions. So I used that as my convenient excuse to avoid projectiles. Unfortunately it's a bit light on gameplay, but I'm still satisfied with what I managed to pull off in the time.

If it would actually run on a 16mhz 386, I'd be pretty impressed! I was targeting mid-level 386 to lower-end 486s, but now that I think about it, I forgot to tell the compiler to optimize for anything beyond an 8086/8088. And I'm fairly sure I only used the original instruction set in my own assembly routines. So, theoretically, it would run very slowly even on an 8088!

Optimus6128 says ...
Jun 26, 2014 @ 6:34am

Well, 386 @ 16mhz is an estimation. Dosbox might be off (also it doesn't take account of slow graphics cards). I think I will try it at one point on my 286. Should put this back on my desk one day (my CPC+ now takes space there :)

You must sign in to comment.

[cache: storing page]