mailto: blog -at- heyrick -dot- eu

Navi: Previous entry Display calendar Next entry
Switch to desktop version

FYI! Last read at 10:39 on 2024/05/05.

Advent 2021 day 13

 

Mamie Fletcher's House 13

How Mamie was written

First, in BASIC

The original version, as I have already mentioned, was written in BASIC. The first thing to do was to create the look and feel of the game display. After that, to have basic left-right movement of the ghosts and Lucy.

The next stage, and the one that probably took the most time, was to have Lucy move in a more useful way. Up and down steps and ladders, falling, and of course interacting with the ghosts.

Essentially the game was built up by taking the basic "game loop" and adding things to it, like "today I'm going to add the headstones" or "today I'll sort out the teapots".

 

Then, in C

By the time it came to the rewrite in C, I had a much better idea of how everything interacted. I broke the code into thirteen modules. That's "module" as in modular coding, not as in Relocatable Module.
The source modules
The source modules.

The modules are:

There's one more thing.

 

Assembling Mamie

The Mamie executable contains not just the code, but all of the resources required by the game with the exception of the embedded advert (for AmCog's Haunted Tower Hotel) which was left separate so it could be changed if desired, and the audio samples as there is (currently?) no interface to the RDSP module to say "this block of memory of XX bytes is a sample, please play it once". So the samples were kept as files so they could be loaded into RDSP.
Everything else is a part of Mamie, and is loaded at the same time as the game code. While it might seem odd to have a three and a half megabyte game, we can be assured that once it has been loaded, it's all available. No delays seeking and loading in resources. No need for lots of code handling things that might not be present. Instead, one single big wodge to load in (which shouldn't be too long from an SD card or modern harddisc), and once it's loaded it's all available.

 

Lessons learned?

Part of the process of developing something like this from scratch is in learning from mistakes.

Generally, I'm quite pleased with how Mamie turned out, however there are two specific points worthy of note.

The first is the location tracking. It might be related to the use of larger tiles (it would likely be quite easy to track Lucy's position with 8×8 tiles) but the current code just seems overly complicated. It wasn't possible to change it because far too many parts of Lucy's movement worked with the setup as it was, and rewriting it all would be sliding down the snake back to square one.

The second? The level designs are actually simple text files that define what each tile is, and if said tile has any object on (almost every object assumes a standard floor tile). While this permitted easy and rapid creation of game levels, it is also limiting. For example, there is no way to have a spider above the top of a ladder.
There's nothing in the game code that should prevent a spider from being in such a place. The problem is the use of single characters to represent attributes, so "S" is a spider on the right hand side of a cobweb over a floor tile. A lower case 's', by the way, is the spider on the right hand side of a cobweb in a 'nothing' tile.
This isn't a big issue, admittedly, and it's a trade off between ease of creating levels and their flexibility. It's no good having a brilliant format that can handle all sorts of things, if it's a total pain to actually work with.

 

Tomorrow, a look some of those little touches that help enhance Mamie.

 

 

Your comments:

Jeff Doggett, 14th December 2021, 19:27
My doom port uses a 256 colour palette as the original doom source code is based on that premise. The palette is stored in a separate lump in the wad file, so is a relative simple matter to read it and pass it into the ColourTrans_WritePalette call.

Add a comment (v0.11) [help?]
Your name:

 
Your email (optional):

 
Validation:
Please type 88861 backwards.

 
Your comment:

 

Navi: Previous entry Display calendar Next entry
Switch to desktop version

Search:

See the rest of HeyRick :-)