#27292 - mr_square - Fri Oct 08, 2004 4:36 pm
Sorry if this is a really dumb question - but for text backgrounds how many tiles can the GBA's memory hold at once - not the maps, but the actual tiles? Given that a tile is 8x8 pixels, whats the largest tile image that you can use?
Also, why does the tile data need to be an image with power of 2 dimensions?
thanks
#27294 - poslundc - Fri Oct 08, 2004 4:55 pm
mr_square wrote: |
Sorry if this is a really dumb question - but for text backgrounds how many tiles can the GBA's memory hold at once - not the maps, but the actual tiles? Given that a tile is 8x8 pixels, whats the largest tile image that you can use? |
Theoretically you could fit 2048 16-colour tiles into background VRAM (that's 32 bytes into 64K) or 1024 256-colour tiles (64 bytes into 64K), but that would leave you no room for the maps, and it would be impractical from the perspective that text BGs can only reference half that many tiles. (And rotation BGs can only reference 256).
The GBA's screen fits 30 tiles by 20 tiles, for a total of 600 tiles.
Quote: |
Also, why does the tile data need to be an image with power of 2 dimensions? |
All tiles are 8x8 pixels (32 or 64 bytes depending on if you are using 16 or 256 colours). You can have as many or few tiles as you want; there's no power-of-two restriction.
Dan.
#27295 - mr_square - Fri Oct 08, 2004 5:00 pm
Thanks :) V.helpful
poslundc wrote: |
All tiles are 8x8 pixels (32 or 64 bytes depending on if you are using 16 or 256 colours). You can have as many or few tiles as you want; there's no power-of-two restriction.
Dan. |
I thought so, but I'm trying to use MapEd and it refuses to accept tilesets that aren't a power of two - I guess thats just an issue with MapEd rather than the GBA hardware
*edit* Thinking about it, would it be possible to make a background using sprites? Or would that really take it out of the processor?
#27299 - sajiimori - Fri Oct 08, 2004 6:42 pm
I was just thinking yesterday how nice it would be if the GBA sprite engine were powerful enough to build all the backgrounds out of sprites. It would make things a lot simpler. Anyway, there's only 32K of sprite VRAM and not enough sprite rendering horsepower per scanline to do anything more than a HUD or something sparse like that.
Also, the CPU isn't affected by how much work the sprite rendering engine is doing.
#27302 - Quirky - Fri Oct 08, 2004 9:55 pm
sajiimori wrote: |
I was just thinking yesterday how nice it would be if the GBA sprite engine were powerful enough to build all the backgrounds out of sprites. |
It is if you don't rotate/scale with the wide flag on all the sprites you can fill the whole screen with sprites to spare. Not much vram to spare though.
width is 240, so thats 4 square 64 sprites (256)
heights 160, so that's 3 square 64 sprites (196)
total of 12 sprites, using 75% of the sprite vram. This approach might not be that practical for games, but could allow 2 seperately semi-scalable backrounds at the same time (the other being a proper BG). Setting the wide flag on the sprites would result in large black bands as the sprite hardware bails out.
#27304 - col - Fri Oct 08, 2004 11:06 pm
mr_square wrote: |
Thanks :) V.helpful
poslundc wrote: |
All tiles are 8x8 pixels (32 or 64 bytes depending on if you are using 16 or 256 colours). You can have as many or few tiles as you want; there's no power-of-two restriction.
Dan. |
I thought so, but I'm trying to use MapEd and it refuses to accept tilesets that aren't a power of two - I guess thats just an issue with MapEd rather than the GBA hardware
*edit* Thinking about it, would it be possible to make a background using sprites? Or would that really take it out of the processor? |
In mapEd, you can use multiple tile sets - small ones large ones, with loads of tiles.
When you export your map, only the tiles you use will be exported, duplicates will be culled (the optimisatoin process including flipping).
The power of 2 'restriction' is no problem, it doesn't have any effect on the final output. You just have to pad out your tileset bmps to the nearest power of 2 sizes before importing them.
cheers
Col
#27306 - sajiimori - Fri Oct 08, 2004 11:17 pm
I said all the backgrounds -- not just one. ;)
#27323 - Quirky - Sat Oct 09, 2004 5:37 pm
sajiimori wrote: |
I said all the backgrounds -- not just one. ;) |
That'll teach me for not reading properly! I read "all the background" for some reason assuming all the screen... not all the bg layers as you meant.