Tri-colored sprite demo

A place where you can keep others updated about your NES-related projects through screenshots, videos or information in general.

Moderator: Moderators

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

Tri-colored sprite demo

Post by Bregalad » Sat Dec 01, 2012 4:42 am

Normally sprites can only have 2 colours and a black outline, or 3 colours without black outline.

This demo however dynamically updates the VRAM (nametable + pattern table) in order to have the background tiles below the sprite form the black outline. Which makes it possible to have 3 colours + black outline without using multiple layers which would eat on the 8-sprites per line limitation.

Graphics from Dragon Quest IV and Just Breed.
Attachments
Spr_tricolored.7z
(11.25 KiB) Downloaded 335 times

Denine
Posts: 398
Joined: Wed Feb 17, 2010 5:42 pm

Re: Tri-colored sprite demo

Post by Denine » Sat Dec 01, 2012 6:22 am

This is one i REALLY like, I know how it works, but same technique can't be used for platformers, can it?
It's easy in your demo cause you have grid movement...

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

Re: Tri-colored sprite demo

Post by tepples » Sat Dec 01, 2012 8:08 am

Say you have a 24x16 pixel character (size of Balloon Fight guy or Mega Man). In a grid-movement game, you'd need up to nine tiles, using method B when moving horizontally or C when moving vertically. In a free movement game, you'd need 12 tiles, and that'd use so much CHR RAM bandwidth that you'd probably need to extend vertical blanking.

Code: Select all

,-------.---.   ,-,-------.-.   ,---+---+---.   ,---+---+---.
|       |   |   | |       | |   ,-------.   |   | ,-------. |
|   +   |---+   +-|   +   |-+   |       |---+   +-|       |-+
|       |   |   | |       | |   |   +   |   |   | |   +   | |
|   +   |---+   +-|   +   |-+   |       |---+   +-|       |-+
|       |   |   | |       | |   |   +   |   |   | |   +   | |
`-------'---+   +-`-------'-+   |       |---+   +-|       |-+
|   |   |   |   |   |   |   |   `-------'   |   | `-------' |
`---+---+---'   `---+---+---'   `---+---+---'   `---+---+---'

A. 6 tiles      B. 9 tiles      C. 8 tiles      D. 12 tiles

slobu
Posts: 275
Joined: Tue Jul 12, 2011 10:58 am

Re: Tri-colored sprite demo

Post by slobu » Sat Dec 01, 2012 9:21 am

Does this gracefully deal with multiple tri-colour sprites overlapping?

Also, for platformers.. can't you be cheap and just make sure the background is always black (like most areas in Super Pitfall)

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

Re: Tri-colored sprite demo

Post by Bregalad » Sat Dec 01, 2012 9:41 am

This technique will probably only work for RPGs, or any other genre where the main character's sprite is 16x16 and moves only in a direction (vertical or horizontal) at a time on a gird based background.

Reason for this is that I have only 6 tiles for the background which is behind the hero, it is arranged 3x2 when moving horizontally and 2x3 when moving vertically. When you stand still, the last 2 tiles are dummy and are unused.

It could be generalized for arbitrary movement, using 9 tiles, but not only this would need extra blanking time, but also the logic, which is already complex in my demo, would be even much more complex.
Also remember than in an actual game the logic would be more complex than what it is in my demo, because of scrolling and the fact the name table could not be accessed directly like I do in the demo.
Does this gracefully deal with multiple tri-colour sprites overlapping?
Nope, this technique can only work for a single sprite, typically the main character's sprite which is what the player will be looking at constantly, so it's worth adding extra colours in it !

Post Reply