Geenimetsuri's answer about colour cycling is a very good point that deserves a demonstration. :)
Here's a GIF taken from the end of the first level of Episode 1 of Jazz Jackrabbit. I've slowed it down so you can see the layers. (Jazz runs at 60Hz and is famous for its speed!)
Jazz Jackrabbit uses Mode X for the main gameplay screen. Mode X is a 256 colour mode which provides a single bitmapped layer of indexed colour pixels, like mode 13h. However, unlike mode 13h, it allows the programmer to use the panning and memory offset configuration fields of the VGA hardware to scroll the screen over a region of video memory to provide a large 'virtual screen'. This means that as the camera moves around the 2D world, only new tiles coming into view on the edges of the visible screen need to be drawn, instead of the entire contents of the screen being redrawn every frame†.
There seems to be a number of independent layers used in the Jazz Jackrabbit animation above:
- The static status bar that does not scroll with the rest of the screen.
- The large landscape graphic that moves freely.
- A coloured gradient sky in shades of blue.
- Jazz himself appearing on top of the landscape.
- The static sun sprite disappearing behind the cloud on the right.
Despite Mode X only allowing a single bitmap layer, Jazz somehow has all five elements moving independently, some partially overlapping others. Let's look at them in turn.
The static status bar is implemented using the automatic split-screen feature of the VGA that uses the Line Compare configuration fields to show a non-scrolling horizontal region beginning at a given screen line. This feature lets the programmer split the screen into an upper freely scrollable section, and a lower fixed section.
The upper section is the normal scrollable Mode X bitmapped indexed colour screen, so all the 'layers' you see in that region are either software sprites drawn onto and later erased by redrawing the landscape at that location, or effects created by manipulating the palette.
Look very closely at the blue sky gradient. Notice how it moves at a different rate to the camera when Jazz jumps - it's properly parallax scrolling! If you don't believe me, watch how the lightest bar of the sky matches the height of the green platform on the left when Jazz is standing, but descends slower than the landscape does when he jumps. Prompted by Justme in the comments, I've looked closer into how this effect was achieved:
Jazz (at least on this level) dedicates the last 100 VGA palette colour indices to containing the sky gradient. When background tiles are painted onto the display region, the transparent colour is replaced with a value between 156 and 255 based on the tile pixel's Y position in the world, increasing by 1 every two pixels down the world. This results in a looping pattern 200 pixels tall consisting of 2 pixel tall horizontal bands that repeats down the world behind all the visible foreground tiles. I've modified Dosbox to force the range 156-205 to be black-to-green and 206-255 to be red-to-yellow and recreated the jumping GIF with this forced palette so you can see it in practice:
Since the sky colours in this new GIF stay the same every frame, the green/red sky looks attached to the landscape like flat wallpaper rather than appearing with parallax. (You can tell from the twinkling red diamonds in the background that the rest of the palette is still able to be modified in real-time.)
To make the sky appear to move independently of the landscape when
COLOR ANIMATION is enabled, Jazz manipulates the sky colours in the VGA palette every frame. As the sky gradient colour set is copied into the VGA palette, it's offset to a new position based on the camera's vertical position (looping within the 156-255 region in the palette). This makes the coloured gradient bars appear to move at a different rate to the hardware scrolling on screen, even though the contents of the video memory aren't changing.
If you set Jazz to
NO COLOR ANIMATION in the Options menu, the palette copying only happens once when the level begins. Since the gradient bar colours remain at their positions in the palette, the sky is static and scrolls with the camera like it's a striped wallpaper on the same plane as the rocks, which it essentially is.
I originally thought the sky gradient was a set of raster bars (where a single dedicated colour index representing 'sky colour' is altered on a scanline-by-scanline basis in real time). Since you can see the red/green stripes in the GIF above, I was clearly wrong. :) You can read my explanation of how I suggested raster bars would be applied in this answer's edit log.
The static sun appears to be another layer, doesn't it? Unlike the Amiga, there are no hardware sprites for VGA to use for this. It's a software sprite drawn onto the Mode X screen (masked behind the existing scenery - reading, comparing, writing) and then erased and redrawn in a new position on the next frame. Jazz himself is drawn the same way, but not masked since he appears on top of the landscape. (When you jump, sometimes you can see Jazz and the sun disappear together when he crosses certain Y values in the world. I think that's to do with the Mode X screen coordinates vertically wrapping, meaning a whole new screen needs to be assembled from tiles and the sprites being ignored for that one costly frame (deliberately or otherwise).)
† Most versions of Jazz support an optional
/VGA command-line switch that uses an alternate renderer that (ostensibly) bruteforce draws the entire VGA display instead of using Mode X though. :D
See also this question: What DOS games used Mode X as described by Michael Abrash?