Palette swap

From TheAlmightyGuru
Jump to: navigation, search
A palette swapped dragon graphic in Final Fantasy.

A palette swap is a graphic which uses the same pixel layout as another, but with a different set of colors. An example of this is seen to the right. The game Final Fantasy uses three different color palettes for the ice dragon, fire dragon, and zombie dragon, but each uses the same bitmap graphic.

Palette swaps were very common in the 8 and 16-bit eras when designers were constrained by limited memory so games couldn't have a lot of unique graphics. However, game designers quickly realized that a graphic would look significantly different even if all you did was change its colors. Since alternate palettes and the code to change them took up comparatively less memory, palette swapping became a common tool for designers to get beyond the restrictions of the hardware and increase the variety of their graphics.

Blue and yellow player characters in Wizard of Wor.

In simultaneous two-player games, it was extremely common for designers to use a palette swap for the second player's character. This was not done out of laziness, but to conserve what limited memory the hardware possessed. The player character sprite was often one of the most animated sprites in a game, which meant it also took up a large chunk of graphic memory. Were a designer to create a wholly unique set of graphics for a second player's character, it would leave very little memory left for enemies and backgrounds, so designers of the time almost universally used palette swaps for the second player character.

All 14 palette-swapped stages in Centipede.

Many early games would swap, not just a single graphic, but all the colors on the screen. For example, each time a player advances to the next level in Centipede, all of the colors change. This adds variety to the game and helps distract from the fact that the weak hardware could only support four unique colors at once, one of which remains black through the whole game.

Palette swapping for lighting effects.

Game designers also realized that you could swap palettes for ambient lighting effects. For example, when you enter the underground regions in Super Mario Bros., the bright colors of the goombas and koopa troopas are swapped to a darker palettes with less saturation. This, combined with a darker palette for all the background graphics as well, gives the underground levels their nice shadowy effect.

Palette swapping for damage.

Another common use for palette swaps is showing injury. In Dragon Warrior, when you hit a monster in combat, its entire body flashes red. The programmers accomplished this by briefly switching all of the monster's colors to red then back to their original color. No doubt, this programming trick impressed one of the game's designers because they used the same trick to create one of the game's more difficult monsters, the all-black Demon Knight which is composed of the same bitmap as the Wraith Knight, only with all of its color indexes set to black.

An undesirable artifact of palette swapping in The Legend of Zelda.

While palette swapping was a common tool, the limitations of early video game hardware made implementing it problematic for designers. In most early video game platforms, a game could only display a limited number of colors on the screen at once, and those colors had to be chosen from a larger, yet still limited, palette of possible colors. For example, the Nintendo Entertainment System could only display 16 colors on the screen at any given time, and those colors had to be chosen from a set palette of 55 unique colors. If you were to change one color on the screen, every other color using that same index would also change with it.

For example, when you start a new game in The Legend of Zelda, you'll notice that both Link and the shop keeper are wearing a green tunic. However, if the player gets an item that changes the color of Link's tunic, the shop keeper's tunic, which uses the same color index, also changes color! This is an undesired artifact since it doesn't make any sense for the shop keeper to change clothes to match Link, but it's difficult to avoid with the limited hardware.

Personal

I remember seeing palette swapping on the first home console I played, the Atari 2600. However, it wasn't until I saw Mario and Luigi in Super Mario Bros. that I began to understand what must be happening inside the game. I loved how getting the rings in The Legend of Zelda forced the shop keepers and Zelda to change their clothes to match Link's. Later, I began to really enjoy looking at the color varieties seen in the monsters of RPGs like Dragon Warrior and Final Fantasy. I still find the concept of swapping a color palette on a graphic to be an enjoyable experience, and sometimes take a sprite from an old video game and change the colors just to see how if I can make it look more interesting.

The NES port of Tetris uses palette swapping on the tetrominoes each time the player advances a level. For fun, I hacked the ROM to provide an alternate palette.

Links