Game Boy Palette Tricks

A while ago I was looking into the palettes of the original Game Boy, I was reading some discussion about how to emulate the console’s sprite style. I discovered something rather neat, which might be useful for anybody making a Game Boy engine/game or emulating the sprite style.

First off, I’ll explain a bit about the Game Boy’s palette. It’s 2-bit, meaning that it can hold 4 different colours (2 bits can hold values of 00, 01, 10, and 11). These aren’t really “colours” as such, but rather monochrome shades; white, black, and two shades of grey. One of these is actually used as transparency (i.e. rendered invisible), meaning that sprites can be made up of 3 colours + transparency. Simple enough, right?

And if you take a look at the overworld sprites from Pokemon Red/Blue you can see that this is true enough. But if you look at the trainer sprites, you’ll see… 4 colours + transparency? How is that possible?

Well first of all, that’s not what’s going on. There are 3 colours + transparency, as there should be. But if you’ve played Pokemon Red/Blue you will remember that the background of the battles were pure white. What these sprites are doing is just letting the background fill in for the transparency.

It’s a bit hard to explain, so let me illustrate. Say you’re battling your rival, Blue:

gameboypalette1

You’ll see that both Red and Blue have 4 colours. Except they don’t; their fourth colour, white, is actually transparent. Let me show you what I mean. Say I magically turned the background green:

gameboypalette2

All of the white pixels in the sprites have been replaced with green. This is because they were never white, rather, the background was. They were just transparent, and the background was filling in for them.

To further illustrate, see what happens if they overlapped:

gameboypalette3

Obviously, very ugly. This is why the majority of sprites, such as overworld characters and so on, only have 3, and save the last for practical transparency. Luckily, trainer sprites are never seen above anything but the white background, and that’s just the thing; because of they never are and never need to be, they can utilise the background as a fourth colour. The same goes for in-battle Pokemon sprites.

Now technically speaking, they do actually have white in their palette, that’s the colour that the game interprets as transparent. That’s only for these sprites though, you can choose which colour is interpreted as transparent for each sprite.

That’s pretty much it! So if you’re ever making a game that keeps with the Game Boy restrictions, remember that any sprites that will only appear above a solid background can use that as an extra colour. And It doesn’t have to be white, as I said you can choose which colour is rendered as transparent for each sprite.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s