gbadev.org forum archive

This is a read-only mirror of the content originally found on forum.gbadev.org (now offline), salvaged from Wayback machine copies. A new forum can be found here.

Graphics > Why sprites from 512 upwards?

#6589 - MumblyJoe - Fri May 30, 2003 1:07 am

OK, I have been trying to nut this one out all morning.

If I use 16 color sprites I get character number 0 to 1023.

If I use 256 color sprites I get 512 to 1023.

If 256 color tiles take up twice as much room, why do I only get half the space? Wouldnt it make more sense to get twice as much?

Only reason I can think of for this is that the GBA calculates the number based on the color mode bit of the sprite, but this doesnt sound right.

I have re-read some tutorials and some other peoples code but still dont get it. Anyone wanna post a brief run down on the topic for me?
_________________
www.hungrydeveloper.com
Version 2.0 now up - guaranteed at least 100% more pleasing!

#6590 - Daedro - Fri May 30, 2003 1:20 am

Well, I don't know much about sprite display. Maybe you switched your mode to 4? that would cause a loss of half the sprites wouldn't it.

Quote:
If 256 color tiles take up twice as much room, why do I only get half the space? Wouldnt it make more sense to get twice as much?


This doesn't make sense, because if they gave you twice as much space to have asm many sprites as 16 colors then 16 colors wouldn't be used. It would also mean that it was possible to get twice as much space and therefor they would allow 16 colors to access that ability too and your back in the same situation. If 256 color sprites take more space then you would get less aom space than 16 colors and not more because then 16 could have more, its redundant.

Like I said, I don't know much about much, but specially not much about sprites.

#6593 - MumblyJoe - Fri May 30, 2003 3:51 am

OK, I think I kinda get it now...

16 color sprites are an 8x8 tile with one nibble (4 bits) per pixel

256 color sprites are an 8x8 tile, with one byte per pixel.

So because the 256 color tiles take up twice as much space, there can only be half as many of them.

So if I was to set a 256 color sprite to tile 512, would I still write to 0x6100000 as I would for tile 1 in 16 color mode, or would it be higher?
_________________
www.hungrydeveloper.com
Version 2.0 now up - guaranteed at least 100% more pleasing!

#6595 - Daedro - Fri May 30, 2003 5:55 am

I don't know I would have to re-read your paragraph. I am not speaking out of knowledge of programming, I am just speaking of logic towards your post. I am just mean that the whole idea behind them increasing the bandwidth for 256 to have as many as 16 because 256 take more space would make no sense because then they would increase 16 too. I do not know how they do it though. I haven't read up on sprites, just skimmed over what thepernproject tells. But it makes sense what you said from logic, but not knowledge, they could be using different formating for each type to do it another way (which makes no sense then 16 colors wouldnt have many advantages other than speed.)

#6597 - MumblyJoe - Fri May 30, 2003 7:06 am

Well I have been playing with sprites since my last post, nad I have them working at values under 512 in 256 color with no probs. Dunno what that means.

Wish someone would put together all the scattered info on the gba into one database. But I'm not gonna do it :-)
_________________
www.hungrydeveloper.com
Version 2.0 now up - guaranteed at least 100% more pleasing!

#6599 - Quirky - Fri May 30, 2003 7:45 am

"256 colour sprites" are sprites that, as you point out, use 1 byte per pixel. They take up more room than 16 colour sprites regardless of the screen mode.

The 512 thing only comes into acount when you use mode 3, 4 or 5. In these modes the screen takes up more vram than in the tile modes. The vram that gets swallowed belongs to the sprites' tiles, so instead of your sprite tiles starting at offset 0 (or 0x06010000), they start further up at sprite tile 512. i.e. attribute 2 for your sprite[0] would be 8192 in mode 4 and you have less sprite tile data.

See the cowbite spec, which is a gathering of all GBA information in one place ;)

http://www.cs.rit.edu/~tjh8300/CowBite/CowBiteSpec.htm

#6611 - hahcoe - Fri May 30, 2003 2:27 pm

Here's something to be aware of also when dealing with 256 color sprites, if you missed it:

"Note that the tile index references 32 bytes at a time, so in the case of 256 color sprite tiles, you will want to set your tile number to reference ever other index (i.e. 0, 2, 4, 6, etc.)."

#6616 - MumblyJoe - Fri May 30, 2003 4:46 pm

Sorry, I did some more research and I noticed that while 256 color halves the amount of room you have for sprite tiles that bieng in sprite mode 3,4,5 the amount if from 512 upwards because the memory is already taken. I had a shit tutorial and got lost in the numbers.
_________________
www.hungrydeveloper.com
Version 2.0 now up - guaranteed at least 100% more pleasing!

#6623 - Daedro - Sat May 31, 2003 2:17 am

[quote="Quirky"]"256 colour sprites" are sprites that, as you point out, use 1 byte per pixel. They take up more room than 16 colour sprites regardless of the screen mode.[quote]

Hope that last sentence isnt to refer to me, I ment that in mode 4 you start at sprite 512 because it uses more ram and cuts the sprite space in half. Check out www.thepernproject.com it has info on these things like the exact things quirky said. I ment exactly what he said, accept I didnt know about the 1 byte per pixel thing. Didnt know it was mode 2, 3 and 5 too. I need to go read that pern tutorial too and try to remember it.