It is currently Fri Dec 15, 2017 6:48 pm

All times are UTC - 7 hours





Post new topic Reply to topic  [ 6 posts ] 
Author Message
PostPosted: Thu Sep 15, 2005 9:20 am 
I am a little confused with the 8 sprite limit per scanline rule.

If sprites 57-63 are drawn in the first 10 pixels of a scanline and sprite 5 is drawn at 100 pixels in and sprite 6 is drawn at 200 pixels then which sprite is drawn? 5 or 6? i.e. does the limit go from sprite 63.0 or what is drawn from left to right on a scanline?

Also, if sprite 10 (bg sprite) is drawn on pixel 123 of a scanline and sprite 11 (fg sprite) is drawn on the same pixel then the latter wont get drawn. Do any games exist so that we can test this?


Top
  
 
PostPosted: Thu Sep 15, 2005 10:20 am 
Offline
User avatar

Joined: Sun Sep 19, 2004 10:59 pm
Posts: 1393
james123 wrote:
If sprites 57-63 are drawn in the first 10 pixels of a scanline and sprite 5 is drawn at 100 pixels in and sprite 6 is drawn at 200 pixels then which sprite is drawn? 5 or 6?


Both - in that setup, you will see sprites 5, 6, 57, 58, 59, 60, 61, and 62. X position has nothing to do with sprite priority, since it doesn't even get checked until after the PPU has chosen its 8 sprites to render (based entirely on Y coordinates, choosing the first 8 sprites it finds starting at sprite #0 and ending at sprite #63).

Quote:
Also, if sprite 10 (bg sprite) is drawn on pixel 123 of a scanline and sprite 11 (fg sprite) is drawn on the same pixel then the latter wont get drawn. Do any games exist so that we can test this?

Yes - Super Mario Bros. 3 uses this exact trick whenever an item comes out of a [?] block or whenever something enters or exits a pipe (either Mario or an enemy).

_________________
Quietust, QMT Productions
P.S. If you don't get this note, let me know and I'll write you another.


Top
 Profile  
 
 Post subject:
PostPosted: Thu Sep 15, 2005 10:29 am 
Offline

Joined: Thu Sep 15, 2005 9:23 am
Posts: 1194
Location: Behind you with a knife!
Thanks for the second one, but WedNESday can only run NROM games at the moment...

What i mean by the first one is if sprites 64,64,63,62,61,60,59 are drawn at the start of a scanline, and sprite 57 is drawn at pixel 100 and sprite 58 is drawn at pixel 200 BOTH can't be drawn because that would be 9 sprites. What I mean is does the NES increment from sprite 64th...1st or increment when it finds a sprite on a scanline? (kinda hard to explain)

_________________
http://www.jamesturner.de/


Top
 Profile  
 
 Post subject:
PostPosted: Thu Sep 15, 2005 10:55 am 
Offline
User avatar

Joined: Sun Sep 19, 2004 10:59 pm
Posts: 1393
The LOWEST numbered sprites are the HIGHEST priority - this means that if all 64 sprites are on the first scanline, you will only see sprites 0, 1, 2, 3, 4, 5, 6, and 7 (SPR-RAM $00-1F).

_________________
Quietust, QMT Productions
P.S. If you don't get this note, let me know and I'll write you another.


Top
 Profile  
 
 Post subject:
PostPosted: Thu Sep 15, 2005 11:10 am 
Offline
User avatar

Joined: Mon Sep 27, 2004 8:33 am
Posts: 3715
Location: Central Texas, USA
I'm pretty sure Castlevania uses this "lower-numbered sprite behind the background to mask a sprite in front" technique when you walk through the door at the beginning and when a hidden money bag ascends from the floor (the first of which is hidden within a few hundred pixels of the door mentioned above). These didn't appear correct in my emulator until I implemented the "background pushed in front of front sprites" behavior you're referring to.

As far as sprites per scanline, it's really very simple. For each scanline, scan sprites from 0 to 63, in that order. Examine each sprite's Y coordinate in combination with the global sprite height (8 or 16) to determine whether any of its lines fall on this scanline. Once eight sprites are found for the scanline (or all sprites have been examined), stop and draw them.


Top
 Profile  
 
 Post subject:
PostPosted: Fri Sep 16, 2005 12:19 pm 
Offline
User avatar

Joined: Fri Nov 12, 2004 2:49 pm
Posts: 7317
Location: Chexbres, VD, Switzerland
blargg wrote:
I'm pretty sure Castlevania uses this "lower-numbered sprite behind the background to mask a sprite in front" technique when you walk through the door at the beginning and when a hidden money bag ascends from the floor

I'm absolutely sure, myself. It's a shame that games such as Just Breed didn't use this techniques to allow the player to pass behind trees, chimneys, etc...

_________________
Life is complex: it has both real and imaginary components.


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

All times are UTC - 7 hours


Who is online

Users browsing this forum: Yahoo [Bot] and 9 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