A technique used in (mostly) older sprite-based video games to conserve video memory and cartridge space, and also to keep the artists from having to draw too many graphics.

Basically, every pixel on a sprite is a number, and each of those numbers corresponds to a color on that sprite's palette. If you want to change every instance of a particular color on a sprite, you just attatch a different palette to it, with the new color at the value the old color used to be at. Voila. That graphic can now be reused for something else. Like a harder version of the same monster.

That explanation is a complete bastardization, but I'm not a programmer and I'm trying to keep it simple.

Examples of palette swapping: Scorpion, Sub-Zero, and Reptile in the Mortal Kombat series; the red and green Koopa Troopas (turtles), and Mario himself with and without flower power, in the Super Mario Brothers series; Link's different armors and swords in the Legend of Zelda series; virtually every enemy in any 2/3 view beat-'em-up (like Final Fight, Teenage Mutant Ninja Turtles: The Arcade Game, Streets of Rage); alternate costumes in fighting games (like the Street Fighter series, the Samurai Showdown series, the King of Fighters series); many of the enemies in the Diablo series.

I suppose the modern equivalent would be re-skinning a 3d model; a few games with skeletal animation systems (like Tekken Tag and Quake III Arena) will even take a new model and just reuse the old animations. Both of these techniques are infinitely cooler, more satisfying, and less cheap feeling than palette swapping.

Palette swapping is also used to produce animation effects in old 256 color computer games and Windows 9x.

Basically, in the days of 386s and ISA video cards, video bandwidth was very limited. So limited that it was difficult to impossible to redraw a 640x480 screen quickly enough for animation. By drawing the graphics and manipulating the palette cleverly, it was possible to create simple animations with very little processor and bus usage.

In computer terms, a 256 color bitmap is actually stored in video ram as byte-long indexes into a color palette. Using the color palette, the video card turns the indexes into RGB color which gets sent to the monitor. The upshot of which is, by changing the color of an entry in the palette (a few bytes of information), you change the color of every pixel on the screen with that particular index (thousands and thousands of bytes).

One of the finest examples of palette swapping animation that I've seen is Sim City 2000. All the blinking city lights, moving cars, and water animations are done by palette manipulations. For example, one set of pixels will turn grey while another set turns black, giving the appearance that cars are moving along the streets.

Another use of palette swapping is in the Windows 9x startup screen. The pixels along the bottom of the screen are not actually changing... Windows is simply cycling the colors in the palette indexes associated with those pixels so that one set of pixels turns slightly darker blue while another set turns slightly lighter blue.

Palette swapping can also be seen in fade-in/fade-outs of older games and in Fractint's beautiful color cycling mode.

Log in or registerto write something here or to contact authors.