Melkhior’s Mansion – Project Update #16
Welcome to project update #16 for the conversion of Melkhior’s Mansion Spectrum Next!
Two weeks have passed since my last Melkhior’s Mansion Next update so here’s some more news.
The Windows room viewer app reached a milestone where it was ready to export the first batch of graphics. Time to create the Next Z80N side of the project!
The first hurdle…
I was eager to begin work on the isometric engine so evaluated the memory usage and CPU resources. The sound effects folder contained 62 files with a total runtime of 1m-46s !!! These were not going to fit in memory. The engine can stream multiple assets from SD card but four channels is a little excessive. Caching frequently used sound effects in SRAM would force a 2MB requirement which I want to avoid. The room data is also streamed.
The solution was to replace as many of the sample files as possible by emulating the original Ultimate sound engine. I was able to model most of the original classic Atic Atac and Knight Lore sounds in Z80N using the legacy 48K speaker. The speaker sound effects and player fitted within 8K of SRAM. 8-bit sample equivalents used around 5MB!
I have around 75-80% CPU left on HDMI 60Hz for the game logic and display engine.
So… the foundations for Melkhior’s Mansion are built around an audio engine because the sounds and music need to run at maximum priority (glitch-free) as you run around the game world.
I wrapped up the sound and music and went on a hard-drive scavenger hunt to raid code to build the game’s startup and initial skeleton.
The devkit build doesn’t have an operating system as it uses RAW SD card access. I wish to distribute a single file so I needed to create a .NEX boot loader to tag the 64MB game ROM onto the end. This would require the organization of the game data into a Doom-style WAD.
Some tech was also needed to allow the internal file system to handle both byte and block SD card addressing modes. The original KS1 cards use byte addressing so it has to work on those.
It makes life a little difficult as the poor Z80N has to do 32-bit maths to resolve the data’s location on the SD card. The asset tools have done most of the maths when they build the WAD making the Z80N code neat and simple.
The game now boots from the devit as well as a NextZXOS .NEX executable. It doesn’t work on the #CSPect emulator at the moment.
Preparing for the isometric engine…
I reviewed the game’s display configuration as the panel would need to be finalised to set the layer and sprite ordering in stone. The original version’s HUD extends to 480×270 pixels. The panel was not going to port ‘as is’ … I’ll keep you all guessing on the new design ?? ??
All the sounds and music are in and play at the correct pitch regardless of the video mode or refresh rate. All the RAW room backgrounds are in and streamable without sound glitch or slowdown – even on HDMI 60Hz. All collision maps and basic room meta-data are also in.
All data is currently streamed on-demand from SD card leaving most of the 1MB of SRAM available for game sprites. It’s looking very good at this stage for a 768K KS1 compatible release so fingers crossed.
The panel is progressing nicely and should be finished early next week. I will then tidy up any remaining loose ends and focus on the sprites where the real fun begins!
KevB aka 9bitcolor.
Leave a Reply