Saturday, 26 March 2016

Losing my direction... and optimisations.

Since my survey suggested that using directional controls on Knight Lore was more popular than rotational, I decided to look further into adding directional support. I fired up the ZX Spectrum version in MESS, selected directional, and started a game. The controls were still rotational.

So tonight I studied the portions of the input handler that I've previously ignored until now, and duly discovered that directional controls are only supported for joystick input. Odd, but it explains my confusion. A bit lazy on the input menu; they should have disabled selection of directional input when the keyboard is selected. Obviously these Stamper guys were complete amateurs, and likely never amounted to anything.

So for now, rotational it is. There's still just under 2KB free, so we'll see.

As for the CocoFEST demonstration, it's almost there. I do need to tweak the adaptive delay routine that is meant to temper the speed in the emptier rooms to make it more playable, and closer to the limit of the game (ie. when things get busy). I wonder how they did that back in the day - I certainly haven't decided on the most efficient course of action yet. I was thinking something along the lines of a FPS (or more likely, FPM) counter based off the GIME (slow) timer to get some idea of the effect of each object wiped and rendered.

At its worst, it probably is a tad slower than the Spectrum, though of course I haven't done a scrap of optimisation in the rendering, let-alone anywhere else in the code. There is a rather simple optimisation I can do, given the 128KB available to the Coco3, the 8KB banks of the GIME MMU, and the convenient fact that the sprite data is almost exactly 16KB and (by design) resides from $8000-$BFFF. And that is, create a second bank of sprite data that is HFLIP'd already. As you can imagine, flipping a sprite about its vertical axis (horizontally) is quite computationally expensive, and this optmisation would reduce a flip to setting a pair of bytes (or a single word) in the GIME MMU.

That aside, and play testing aside, I'm pretty happy with it. I've added a text-mode splash screen that lets the player select between RGB and composite palettes, though I might need to re-visit the choices I made for the composite palette that I cooked up in a hurry. It's pretty awesome that MESS emulates both display types!

I might spend a night with Lode Runner - sooner rather than later - and set up the build as I have done with Knight Lore, and also add the splash screen rather than using the cumbersome BASIC loader to select the display. Maybe I can talk someone into demonstrating Lode Runner at CocoFEST too?

The only additional aspect I'd like to explore, once the above are complete, is adding support for the Amstrad CPC graphics (it'll be a separate cartridge image). If the optimisations are successful and I get even a little headroom, there should be ample performance for the 2BPP graphics. Then I can finally put this to bed and release the finished product. Then retire on the proceeds.

No comments:

Post a Comment