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

User avatar
Nadia
Posts: 92
Joined: Thu Nov 05, 2009 8:31 am

More than 3 colors in a sprite?

Post by Nadia » Fri Dec 18, 2009 8:43 am

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?

tepples
Posts: 22014
Joined: Sun Sep 19, 2004 11:12 pm
Location: NE Indiana, USA (NTSC)
Contact:

Post by tepples » Fri Dec 18, 2009 9:51 am

"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?

User avatar
tokumaru
Posts: 11748
Joined: Sat Feb 12, 2005 9:43 pm
Location: Rio de Janeiro - Brazil

Re: More than 3 colors in a sprite?

Post by tokumaru » Fri Dec 18, 2009 10:03 am

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.

User avatar
Nadia
Posts: 92
Joined: Thu Nov 05, 2009 8:31 am

Post by Nadia » Fri Dec 18, 2009 12:00 pm

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 :)

tepples
Posts: 22014
Joined: Sun Sep 19, 2004 11:12 pm
Location: NE Indiana, USA (NTSC)
Contact:

Post by tepples » Fri Dec 18, 2009 12:16 pm

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.

User avatar
Nadia
Posts: 92
Joined: Thu Nov 05, 2009 8:31 am

Post by Nadia » Fri Dec 18, 2009 1:03 pm

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.
Cheers,
Nadia

User avatar
tokumaru
Posts: 11748
Joined: Sat Feb 12, 2005 9:43 pm
Location: Rio de Janeiro - Brazil

Post by tokumaru » Fri Dec 18, 2009 1:17 pm

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.

tepples
Posts: 22014
Joined: Sun Sep 19, 2004 11:12 pm
Location: NE Indiana, USA (NTSC)
Contact:

Post by tepples » Fri Dec 18, 2009 1:23 pm

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.

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

Post by Bregalad » Fri Dec 18, 2009 2:08 pm

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.
Life is complex: it has both real and imaginary components.

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

Post by Celius » Fri Dec 18, 2009 6:00 pm

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.

User avatar
Dwedit
Posts: 4329
Joined: Fri Nov 19, 2004 7:35 pm
Contact:

Post by Dwedit » Fri Dec 18, 2009 6:28 pm

There is no way to tell how many colors an image has once you've saved it as a jpeg.
Here come the fortune cookies! Here come the fortune cookies! They're wearing paper hats!

User avatar
Nadia
Posts: 92
Joined: Thu Nov 05, 2009 8:31 am

Post by Nadia » Fri Dec 18, 2009 8:40 pm

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?
Cheers,
Nadia

User avatar
Nadia
Posts: 92
Joined: Thu Nov 05, 2009 8:31 am

Post by Nadia » Fri Dec 18, 2009 8:43 pm

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?
Cheers,
Nadia

User avatar
Memblers
Site Admin
Posts: 3857
Joined: Mon Sep 20, 2004 6:04 am
Location: Indianapolis
Contact:

Post by Memblers » Fri Dec 18, 2009 9:01 pm

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).

User avatar
tokumaru
Posts: 11748
Joined: Sat Feb 12, 2005 9:43 pm
Location: Rio de Janeiro - Brazil

Post by tokumaru » Fri Dec 18, 2009 9:13 pm

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.

Post Reply