Palette shifting

Someone I follow on twitter shared this a while ago: 8-Bit color cycling in HTML5 canvas.

And while it’s basically a sort of HTML5 tech-demo, it shows a very old but interesting technique used in games and interactive media back in the day: Animating complex landscapes by cycling colors in the palette. This is how complex background scenes were given life in old games, where particle-based rain or big-sized moving cloud sprites were beyond the capabilities of the hardware.

It turns out that changing a color in the palette was a very quick and inexpensive operation, so they devised this method to generate rich environments using little to no processor time and a negligible amount of extra memory.

The only downside of this technique is that it requires a lot of extra and duplicate entries in the palette (depending on the animation). If you check the examples in the page above, a rich animated background can easily use more than 75% of the palette space, leaving little room for the rest of the game elements. And because every element or object in the screen that is supposed to stay constant in color (like the player, enemies, text, etc) requires entries in the palette apart from the ones that are being cycled (even if the colors are the same) this leads to a sort of race condition in design-time between background and foreground elements.

The technique -however- is unbelieavably clever and shows how creativity can solve big technical problems. Modern devices have no problem animating rain drops one by one, or simulating volumetric clouds or bodies of water, or even storing full-screen frames of a complex sequence that will play in the background, but back in the day that was definitely impossible due to memory and processor constrains.

This technique was also used in small elements to avoid creating full frames of animation where only a few details changed between frames.

And this helps to answer the question of why did old games run better on their contemporary hardware than current games run nowadays in ours. Or why do modern games lag even on the best hardware configurations? Is it because old games were “too simple” even for the hardware back then? Is it because they weren’t pushing their hardware to the limit? The fact this technique was invented gives us a hint of the answer:

I think it’s just that -for the most of it- we just stopped being clever.

 

Leave a Reply

Your email address will not be published. Required fields are marked *