More than 3 colors in a sprite?

Discuss technical or other issues relating to programming the Nintendo Entertainment System, Famicom, or compatible systems.

Moderator: Moderators

Celius
Posts: 2157
Joined: Sun Jun 05, 2005 2:04 pm
Location: Minneapolis, Minnesota, United States
Contact:

Post by Celius » Sat Dec 19, 2009 12:39 am

Nadia wrote:What is the size of this character?
The character in my avatar? I believe that particular graphic of the character is 4x4 tiles. It might be 3x4. When the character is standing still, it's only 2x4. This isn't including the sword, by the way.
Dwedit wrote:There is no way to tell how many colors an image has once you've saved it as a jpeg.
This is true.
tokumaru wrote:Like Memblers said, yes, but since there are only 4 sprite palettes active at any given time, using 2 of them just for your main character means using half of what you have for one single character. Making the main character's palette(s) usable elsewhere is a way to minimize the loss.
Yeah, this is a major disadvantage to having two palettes for the main character. Perhaps you should try something similar to what I've done. I've come up with a system that allows me to make enemies/objects that are a lot of different colors. Take a look at my palettes (the character palette is not included):

Note: brightness is indicated by a number 0-3, 0 being darkest, and 3 being the lightest.

Palette 1:
Color 1 - Black
Color 2 - Red 1
Color 3 - Grey 2

Palette 2:
Color 1 - Black
Color 2 - Green 1
Color 3 - Yellow 2

Palette 3:
Color 1 - Black
Color 2 - Purple 1
Color 3 - Blue 2

Notice how in the last two palettes, I pair Green with Yellow. If I want to make a yellow enemy, I can make it mostly yellow with green and black shadows. If I want to make a green enemy, I can make it mostly green with black shadows and yellow highlights. Since these two colors can almost be seen as part of the same color scale, they work well together in the same palette, but they're different enough so you can make distinctly green or yellow sprites. The same goes for purple and blue. They are different and similar simultaneously.

The first palette is a little different though. With this, I can make grey-scale objects and red objects. Red objects will have grey highlights and black shadows while grey objects will have red and black shadows. It's a little weird for the second one, but it's not that weird. Anyways, the point is I actually have a lot of flexibility with these palettes. If you have a system like this, you could do a little bit of layering with one of these palettes and the character palette, but not be making sacrifices since you're re-using the palettes that you're layering on top of the character's graphics.

User avatar
Bregalad
Posts: 7890
Joined: Fri Nov 12, 2004 2:49 pm
Location: Chexbres, VD, Switzerland

Post by Bregalad » Sat Dec 19, 2009 3:41 am

Yeah I can confirm Celius' system is very clever and flexible. You'd want to use white and skin color for the last palette too, because those 2 colors are neeeded. Replacing the gray with orange in the first palette is good as well, depending on what you want to do. The advantage of coming with a constant palette set is that it saves you headaches, and simplify things a lot. Even very advanced games with good graphics like Battletoads & Double Dragon does this.

For my system tough I have 3 constant and 1 variable palettes (like the original Battletoads). This has the advantage of allowing more flexibility in enemies' palette swap by using the variable palette.

PS : As for dithering, you shold be carefull only to dither colors that are already close enough. If you dither light red and skin color, it will work out to give you some blond. If you dither somehting like skin color and black, it will actually look like a chessboard and won't give you the "dark brown" that averaging both colors would. Even with NTSC filter it looks like a chessboard with diagonl lines going in. The color just won't blend.
Life is complex: it has both real and imaginary components.

Post Reply