Beast Scroll

by Joefish


Last edited on 28 Jun 2016 by Joefish. See all edits


Joefish - 14:15 27 June 2016 #

Runs on a 520 STFM with no hardware tricks - all software. It uses bitplanes to do the scrolling and self-modifying code for optimisation. It actually re-writes its own copy routine every frame of the game, then executes it to completely redraw the background; kind of like how Joffa did his scrolling on Spectrum games like Cobra. It takes just over one frame to redraw the scenery, so runs at 25fps. Incidentally, it's the full 320x200 pixels. The Amiga version is only 288 pixels wide.

The main point is the trees have been re-mapped to just 3 colours+transparent, stored in big 128x173 pixel slabs of scenery and pre-shifted to 4-pixel positions. To draw the screen, the addresses of the few 'slabs' visible on-screen are loaded into separate registers, and the copy routine copies the visible slices into the first two bitplanes. This mimics the Amiga's 'Dual Playfield' scrolling system, but with only 2 bits per layer instead of 3.

The various background strips are each only 2 colours+transparent, and the colours are swapped on the rasters between clouds, mountains and ground. These are pre-shifted to pixel positions. The clouds are only half a screen wide and the ground at the bottom is actually an animation rather than a scroll. The background data is copied in to the last two bitplanes, interleaved with copying the trees. The self-modified code makes the background pattern it's copying from wrap-around part-way across each row.

The real trick here though, is that by not using one of the possible colours of the back two bitplanes, that's actually four whole colours in the palette unused. I can then assign these to whatever I need for sprites.

There are 22 colours on the screen. Even if you just count the sky as one, that's still 17 - one more than normal for an ST. This despite throwing away 6 colour definitions for the playfield effect. Unlike a lot of scene demos that are a bit more sneaky with their bands of scrolling and rasters, those sprites could be drawn anywhere on the screen.

Joefish - 18:24 24 August 2017 #

See the brilliant game 'Crash Time Plumber' by Cerebral Vortex for another application of this "Spare-Colour-Playfield" technique. Note the three foreground colours (plus transparent, obviously), and only three colours in the background, which leaves four independent colours for the sprites: