It is currently Fri Oct 20, 2017 5:45 am

All times are UTC - 7 hours





Post new topic Reply to topic  [ 7 posts ] 
Author Message
 Post subject: Sprite Info?
PostPosted: Fri May 05, 2006 11:10 pm 
Offline
User avatar

Joined: Sun Mar 19, 2006 12:37 am
Posts: 223
Location: San ANto, TX
Up to how many sprites can i have on a screen at one time?


Top
 Profile  
 
 Post subject:
PostPosted: Fri May 05, 2006 11:41 pm 
Online
User avatar

Joined: Sat Feb 12, 2005 9:43 pm
Posts: 10063
Location: Rio de Janeiro - Brazil
There are always 64 sprites. If you want to use less than that, the unused ones must be placed outside of the visible area (below the bottom of the screen).

Sprite size is selectable between 8x8 pixels or 8x16 pixels. Many games use the 8x16 mode, since you can effectivelly draw more stuff with them (they have twice the area of the 8x8 ones).

If more than 8 are placed on the same scanline, only the 8 with higher priorities will be displayed. If the game needs more than 8 sprites in a scanline, some cycling of the priorities has to be performed, so that diferent sets of sprites are shown each frame. That introduces flickering, wich is still better than no sprite at all.

A full character (Mario, for example) is made of several sprites, it is not a single sprite.


Top
 Profile  
 
 Post subject:
PostPosted: Fri May 05, 2006 11:54 pm 
Offline
User avatar

Joined: Fri Nov 12, 2004 2:49 pm
Posts: 7231
Location: Chexbres, VD, Switzerland
Great sumarry, tokumaru.
I'd add something, tough.
tokumaru wrote:
Sprite size is selectable between 8x8 pixels or 8x16 pixels. Many games use the 8x16 mode, since you can effectivelly draw more stuff with them (they have twice the area of the 8x8 ones).

I prefer myself use the 8x8 mode, because 8x16 mean that each sprite is two consecutive tiles. The tile index is AND-ed with #$fe, clipping the lowest bit, and the even tile (lowest bit to 0) is at the top, and the tile just after it (lowest bit to 1) is at the bottom. The actual lowest bit is the pattern table index instead, so you can adress both pattern table. This will often waste a lot of pattern table, even if you can use both, it often is a huge waste and do nothing but reduce BG tiles space available.

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


Top
 Profile  
 
 Post subject:
PostPosted: Sat May 06, 2006 3:31 am 
Offline
User avatar

Joined: Sun Mar 19, 2006 12:37 am
Posts: 223
Location: San ANto, TX
is it better to use sprites as numbers to scroll up and down the number to find a value. i want to do a simple addition of numbers program (2+2=4) . Ive seen code that uses ascii font tables.


Top
 Profile  
 
 Post subject:
PostPosted: Sat May 06, 2006 5:52 am 
Offline
User avatar

Joined: Wed Sep 07, 2005 9:55 am
Posts: 299
Location: Phoenix, AZ
you would have to draw a font in chr and set the sprite tile number equal to the tile number of the character you want to display. then position it on the screen where you want it.


Top
 Profile  
 
 Post subject:
PostPosted: Sat May 06, 2006 2:42 pm 
Online
User avatar

Joined: Sat Feb 12, 2005 9:43 pm
Posts: 10063
Location: Rio de Janeiro - Brazil
Bregalad wrote:
I prefer myself use the 8x8 mode, because 8x16 mean that each sprite is two consecutive tiles. The tile index is AND-ed with #$fe, clipping the lowest bit, and the even tile (lowest bit to 0) is at the top, and the tile just after it (lowest bit to 1) is at the bottom. The actual lowest bit is the pattern table index instead, so you can adress both pattern table. This will often waste a lot of pattern table, even if you can use both, it often is a huge waste and do nothing but reduce BG tiles space available.

Yeah, I did not get into much detail about the 8x16 sprites. You pretty much summed it up.

I can see when 8x8 sprites are more usefull. I know you like RPG's, where characters are usually 16x16 pixels, right? When they walk, you can animate just the legs (bottom 8 pixels) and keep the head, something not posible with 8x16 sprites, where you'd have to draw the same head twice, wasting CHR space.

I prefer 8x16, however, and I'll also explain why. I enjoy platform games, such as Sonic The Hedgehog. Characters and enemies tend to be larger, so using 8x16 sprites allows you to effectivelly put more stuff on the screen. Also, there are usually many items in the level (in Sonic's case, spinning rings). On the NES, A big row of rings can only be represented with the background, or it would all flicker a lot. BUT, it is desirable that the same ring graphics be used as sprites, when Sonic looses his rings, for example, or to place a ring where it would not be aligned to the background. In that case, drawing the same ring twice would be a waste of space. I many times want to use the bg graphics as sprites, and that is only possible with 8x16 sprites.

Also, in the case of the spinning rings, if their animation is achieved through CHR bankswitching, it would make much sense to use the ring that's already there, spinning and all, but in the bg side of the patterns. Repeating the animation on the sprite side would also be a big waste of space.

Well, that's why I like 8x16 sprites. Both have advantages and disadvantages, depending on what you're doing.


Top
 Profile  
 
 Post subject:
PostPosted: Sun May 07, 2006 2:43 am 
Offline
User avatar

Joined: Fri Nov 12, 2004 2:49 pm
Posts: 7231
Location: Chexbres, VD, Switzerland
I think you're right, if 8x8 or 8x16 the best really depends of the game.
However, in some case, 8x8 can be better even for a platform game, such as MegaMan, that is always made of 8x8 sprites. His head is another color than his armor, and his head is just a 8x8 sprite. If Capcom would have coosen 8x16 sprites for their MegaMan games, they would be forced to make the head sprite 8x16, and that would be 4 sprites on the same line below the head (there is 3 normally), so it would involve more useless flickering in the game.
What I hate with 8x16 sprites is that even if you're drawing a small ball or something that is only 4 pixels large and 4 pixels whide, you still have to waste 2 full tiles for it. Your pattern talbe is going to be mostly blank if you use a lot of small bullets and items, such as in Contra.
Even for platformers, I think 8x8 really helps to animate characters while keeping the pattern table not too big.
8x16 is really usefull only to merge BG and Sprite tiles, as you explained.
Bah, you could still have two copies of the ring tiles in both pattern tables, that would be 2 tiles or so in each pattern table. To annimate them, you could use CHR-RAM and write the data to them periodically. Of course that works fine as long as you annimate *only* them. If you're doing other background annimation, then you're fine as you said. Exept that if you're using an MMC3, you cannot use it's IRQ, because the lines that have sprites in the first pattern table will false the counter and the IRQ will happen too early randomly.

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


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

All times are UTC - 7 hours


Who is online

Users browsing this forum: No registered users 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