This page is a mirror of Tepples' nesdev forum mirror (URL TBD).
Last updated on Oct-18-2019 Download

More than 3 colors in a sprite?

More than 3 colors in a sprite?
by on (#54154)
I have drawn a character that must use 5 colors in all(red,blue,black,white and skin color). I have used 12 sprites(3x4) to draw this character. The only reason why I chose to use 8x8 tiles is that I want to use different set of colors in top 2 rows of the character.

If somehow I can have 4 or 5 colors in 1 sprite then I would prefer using an 8x16 sprite instead.

In one of the existing topics in the forum I read something like "Sprite Pile" but I did not understand what it means.

Can this color limit be overriden somehow?

by on (#54155)
"Sprite pile" or "overlay" is two sprites drawn at the same location in two different palettes. All six Mega Man games use this for the main character's face. The obvious disadvantage is that it takes up more of the eight sprites you can show on a single scanline.

The character you describe has exactly the same colors as Mario. Let's see how each SMB game has handled it:
  1. Super Mario Bros.: skin color represents white, and brown represents blue and black.
  2. Super Mario Bros. 2: blue represents black, and an overlay sprite is used for the whites of Mario's eyes.
  3. Super Mario Bros. 3: skin color represents white, and black represents blue.
    In SMB3, close-up still shots such as those in the "spade" and "N-spade" bonus games get away with using more colors because they can overlay a sprite on the background, as was done in Contra's title screen.


Can you post a sketch of your character to photobucket or something?
Re: More than 3 colors in a sprite?
by on (#54156)
Nadia wrote:
I read something like "Sprite Pile" but I did not understand what it means.


It means you can stack sprites on top of other sprites. The most common example is Mega Man. Notice how his sprite uses black, blue and cyan for the most part, but his face is skin colored. They do this by placing an extra skin colored sprite with the shape of his face on top of everything (you don't even have to worry about sprite priorities if the shape of the "top" sprite is cut out on the "bottom" sprite).

The disadvantage is that the NES has a very low limit of sprites per scanline (only 8), so unless you plan this very well stacking sprites can be a big waste of them that will result in a lot of flickering during the game.

I do this for Sonic in the game I'm making, because he definitely needs more than 3 colors to be accurately represented. One "layer" has two blues and white, and the other has reds/skin tones. I try not to use more than 4 sprites in a scanline for Sonic, so that other objects have a fair chance to be displayed. Sometimes I have only 3 in a given scanline, for some of his animation frames I need 5 occasionally, but I always try to keep the count as low as possible when designing the sprites.

by on (#54159)
tepples wrote:
"Sprite pile" or "overlay" is two sprites drawn at the same location in two different palettes. All six Mega Man games use this for the main character's face. The obvious disadvantage is that it takes up more of the eight sprites you can show on a single scanline.

The character you describe has exactly the same colors as Mario. Let's see how each SMB game has handled it:
  1. Super Mario Bros.: skin color represents white, and brown represents blue and black.
  2. Super Mario Bros. 2: blue represents black, and an overlay sprite is used for the whites of Mario's eyes.
  3. Super Mario Bros. 3: skin color represents white, and black represents blue.
    In SMB3, close-up still shots such as those in the "spade" and "N-spade" bonus games get away with using more colors because they can overlay a sprite on the background, as was done in Contra's title screen.

Can you post a sketch of your character to photobucket or something?


See my current avatar. It is the character. I am sorry its a bit small :)

by on (#54160)
Nadia wrote:
See my current avatar. It is the character.

Could you save it in PNG format? JPEG obscures sharp transitions between black and red or between yellow and white.

by on (#54162)
tepples wrote:
Nadia wrote:
See my current avatar. It is the character.

Could you save it in PNG format? JPEG obscures sharp transitions between black and red or between yellow and white.


the avatar image is now .png.

by on (#54163)
I'd draw that sprite with using two palettes: one with black, white and the skin color and the other with black, red and yellow. That way the bottom half of the body would need almost no overlapping, and the head would have some because of the hair.

Of course it would be better if you could have the other objects of the game make *some* use of these palettes as well, because there will only be two left for general use.

by on (#54164)
The first thing to go would probably be the white.

Image

Why is Mario wearing black?

tokumaru wrote:
Of course it would be better if you could have the other objects of the game make *some* use of these palettes as well, because there will only be two left for general use.

Yup, Contra. Look at where the skin color palettes get reused. You'll find that a lot of bullets in NES games were drawn in skin color.

by on (#54166)
Well, basically there is 3 ways to draw sprites :
- One layer, one palette, limited to 3 colors (usually black + 2 colors). Example : Mario in SMB1 and SMB3, Link, Simon Belmont, FF1 fighter, All sprites of Dragon Warrior games, etc...
- One layer, two (or more palettes. Different areas of the sprite uses different palettes. Limited to 5 colors (more precisely 1 + 2n, where n is the amount of paletes) (transparent and black border is shared). Examples : Player 1 in contra, Billy & most enemies in Double Dragon, Black Mage & Thief of FF1, etc...
- Two layers, two (or more) palettes. The same area is covered by overlay sprites. (Pratically) not limited in colors, but the 8-sprites per line limitation is the real limit. Example : Mega Man, Rash&Zitz (Battletoads), playable characters in Just Breed, etc...

Note : When it comes to designing a character with red trousers and blond hair, I used to use red to represent the blond hair in my game projec,. Dragon Skill, when I figured at a later time that dithering a light red with skin color looked pretty close to blond, which I eventually adopted. I longly hesitated to overlay blond sprite too, but I'd better avoid the flickering this would cause as much as possible.

by on (#54170)
I would suggest something similar to what Bregalad was talking about with dithering. In my avatar, the character attacking Dracula is made of only 3 colors. You can't tell that black is one of those colors because the background is black. But I used dithering to make "other colors". But I, for one, find hair color to be of more importance than clothing color. So I would keep the hair color, or only modify it slightly to be more red (make it orange). Then I would take this color and dither it to create the color for the clothing. Also for highlights on clothing, take advantage of the fact that skin color is available in the palette. You might actually be able to dither skin color with black to make a light tone for what you wanted to be white. I would just mess around with dithering, and consider what colors are more important.

by on (#54171)
There is no way to tell how many colors an image has once you've saved it as a jpeg.

by on (#54174)
Celius wrote:
I would suggest something similar to what Bregalad was talking about with dithering. In my avatar, the character attacking Dracula is made of only 3 colors. You can't tell that black is one of those colors because the background is black. But I used dithering to make "other colors". But I, for one, find hair color to be of more importance than clothing color. So I would keep the hair color, or only modify it slightly to be more red (make it orange). Then I would take this color and dither it to create the color for the clothing. Also for highlights on clothing, take advantage of the fact that skin color is available in the palette. You might actually be able to dither skin color with black to make a light tone for what you wanted to be white. I would just mess around with dithering, and consider what colors are more important.


What is the size of this character?

by on (#54175)
tepples wrote:
The first thing to go would probably be the white.

Image

Why is Mario wearing black?

tokumaru wrote:
Of course it would be better if you could have the other objects of the game make *some* use of these palettes as well, because there will only be two left for general use.

Yup, Contra. Look at where the skin color palettes get reused. You'll find that a lot of bullets in NES games were drawn in skin color.


But we can always reload the pallette with new values(colors) while the game is running. right?

by on (#54176)
Nadia wrote:
But we can always reload the pallette with new values(colors) while the game is running. right?


Yes, you can even change it every frame if you wanted (look at Mario getting a star, or Link getting hit).

by on (#54177)
Nadia wrote:
But we can always reload the pallette with new values(colors) while the game is running. right?

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.

by on (#54181)
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.

by on (#54183)
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.