Week 106


The layout of the map is now up-to-date with the PC version, and all the chests and collectable objects can now be found where they should be.  This means you can run around the whole mansion as any of the four characters, collect objects, eat food, unlock doors, shoot ghosts, fall down trapdoors, run up stairs, and all that good stuff.  Each of the playable characters also now have their own unique weapon graphic.  I did flesh-out some more of the rooms - added a nice window & a wall shield to the 'upstairs', and some rocks, mushrooms, skeletons & skulls to the caverns.  Whilst doing that I realised I was probably getting ahead of myself - as I could easily use up all the available memory with these graphics, whilst forgetting all about the rest of the music, SFX, game logic, characters and the like which still need to be added.

This lead to another round of housekeeping and a roam through the code looking to where I could potentially save memory.  For a while I've had an internet page bookmarked regarding a new data compression method which can be used on the Z80.  A lot of the content in the game is compressed - there's simply no way it would all fit otherwise.  The graphics for each of the playable characters is compressed - since I only need one of them at a time.  The graphics for each type of room are also compressed, along with the stairs and trapdoor, as again, you only see one of them at a time.  For years I've been using the same compression method in all my games - called PuCrunch - as it's pretty fast to uncompress the data, and gives a pretty good compression ratio, but I wanted to check it against that new compressor I'd learned about, and another which has been praised of late.  To cut a long story short, the results where all very similar, but PuCrunch is still giving me better results on most of the data.  I could save a few bytes by swapping to a different compressor for certain things, but those savings would be lost by the inclusion of the code required to decompress that additional data type.  I've one more system I want to try - I'm not holding out much hope of any huge savings given my other tests, but it's worth a try.

I have gained some savings however by combining more objects together into a single larger compressed block, as you only get one set of overheads and the compression gets better the more you throw at it.  I've also removed some 'special case' graphics from the game which were only used in a single room, or added very little to the rooms they were in - I promise you'll never spot that they've gone, but it's another 1K+ saving to me which can be put to good use.

I'm not sure what aspect I'll be working on next - I should probably back everything up and take a few days off from staring at all this complicated code and maybe write something silly instead!

Comments

Log in with itch.io to leave a comment.

What language did you write this in? You talk about compression, but modern machines do not suffer with memory shortage on something like this anyway.

You’ve hit the nail on the head when you say that ‘modern machines do not suffer with memory shortage...’ - this is being written for the ZX Spectrum, a machine that’s 39 years old, and has only 128K of usable memory. It also has next to no hardware support, so that memory is for all the code, graphics, sprite routines, music, SFX, etc.  In order to get the most out of the machine and this memory the game is written entirely using Z80 machine code, and compression is the only way it will fit in memory.

For some reason i thought it was a PC version. i had a 48K spectrum with Atic Atac back in the day. i even bought a +3 with a divIDE over 10 years ago, but it seldom gets used. Still though, it looks good.

There is a PC version, which this is a conversion of:

https://bitglint.itch.io/melkhiors-mansion