It is currently Wed Sep 18, 2019 6:26 am

All times are UTC - 7 hours





Post new topic Reply to topic  [ 5 posts ] 
Author Message
 Post subject: Tri-colored sprite demo
PostPosted: Sat Dec 01, 2012 4:42 am 
Offline
User avatar

Joined: Fri Nov 12, 2004 2:49 pm
Posts: 7741
Location: Chexbres, VD, Switzerland
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 310 times
Top
 Profile  
 
PostPosted: Sat Dec 01, 2012 6:22 am 
Offline

Joined: Wed Feb 17, 2010 5:42 pm
Posts: 394
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...


Top
 Profile  
 
PostPosted: Sat Dec 01, 2012 8:08 am 
Offline

Joined: Sun Sep 19, 2004 11:12 pm
Posts: 21591
Location: NE Indiana, USA (NTSC)
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:
,-------.---.   ,-,-------.-.   ,---+---+---.   ,---+---+---.
|       |   |   | |       | |   ,-------.   |   | ,-------. |
|   +   |---+   +-|   +   |-+   |       |---+   +-|       |-+
|       |   |   | |       | |   |   +   |   |   | |   +   | |
|   +   |---+   +-|   +   |-+   |       |---+   +-|       |-+
|       |   |   | |       | |   |   +   |   |   | |   +   | |
`-------'---+   +-`-------'-+   |       |---+   +-|       |-+
|   |   |   |   |   |   |   |   `-------'   |   | `-------' |
`---+---+---'   `---+---+---'   `---+---+---'   `---+---+---'

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

_________________
Pin Eight | Twitter | GitHub | Patreon


Top
 Profile  
 
PostPosted: Sat Dec 01, 2012 9:21 am 
Offline

Joined: Tue Jul 12, 2011 10:58 am
Posts: 275
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)


Top
 Profile  
 
PostPosted: Sat Dec 01, 2012 9:41 am 
Offline
User avatar

Joined: Fri Nov 12, 2004 2:49 pm
Posts: 7741
Location: Chexbres, VD, Switzerland
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.

Quote:
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 !


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 5 posts ] 

All times are UTC - 7 hours


Who is online

Users browsing this forum: No registered users and 2 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group