Page 1 of 2

More than 3 colors in a sprite?

Posted: Fri Dec 18, 2009 8:43 am
by Nadia
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?

Posted: Fri Dec 18, 2009 9:51 am
by tepples
"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?

Posted: Fri Dec 18, 2009 10:03 am
by tokumaru
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.

Posted: Fri Dec 18, 2009 12:00 pm
by Nadia
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 :)

Posted: Fri Dec 18, 2009 12:16 pm
by tepples
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.

Posted: Fri Dec 18, 2009 1:03 pm
by Nadia
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.

Posted: Fri Dec 18, 2009 1:17 pm
by tokumaru
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.

Posted: Fri Dec 18, 2009 1:23 pm
by tepples
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.

Posted: Fri Dec 18, 2009 2:08 pm
by Bregalad
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.

Posted: Fri Dec 18, 2009 6:00 pm
by Celius
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.

Posted: Fri Dec 18, 2009 6:28 pm
by Dwedit
There is no way to tell how many colors an image has once you've saved it as a jpeg.

Posted: Fri Dec 18, 2009 8:40 pm
by Nadia
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?

Posted: Fri Dec 18, 2009 8:43 pm
by Nadia
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?

Posted: Fri Dec 18, 2009 9:01 pm
by Memblers
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).

Posted: Fri Dec 18, 2009 9:13 pm
by tokumaru
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.