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.

Beginners > Max Number of Tiles Allowed?

#9158 - ChaosX2 - Tue Jul 29, 2003 4:41 pm

What is the Max Number of tiles allowed for any given map. Am I limited to 256?

#9162 - niltsair - Tue Jul 29, 2003 4:56 pm

No, there's 4 fixed formats :
-256x256
-256x512
-512x256
-512x512

When being of size superior to 256, it need to be stored in a different map, so for a 512x512 you woudl have :
Code:

     0        256       512
0    #####################
     # (Map 1) # (Map 2) #
256  #####################
     # (Map 3) # (Map 4) #
512  #####################

#9163 - tepples - Tue Jul 29, 2003 4:58 pm

ChaosX2 wrote:
What is the Max Number of tiles allowed for any given map. Am I limited to 256?

You're limited to 256 tiles for rot/scale backgrounds or 1024 for "text mode" backgrounds. If you're using text mode backgrounds, it's best to use 16-color tiles, like most commercial games do; this way, you can fit about 1800 tiles to split among your backgrounds.
_________________
-- Where is he?
-- Who?
-- You know, the human.
-- I think he moved to Tilwick.

#9164 - ChaosX2 - Tue Jul 29, 2003 5:04 pm

Thanks

#9171 - superx10 - Tue Jul 29, 2003 10:47 pm

you say 1800.. how come when i go over a certain number the compiler will like truncate it so my maps get messed up..? do i need to have more than one tileset or something?
_________________
"Two wolves are fighting. One wolf is all evil, hate, jealousy and discontent, and the other good, love, happiness and is content." "Sounds like a tough battle. Who wins?" said the old man. “The one I feed”

#9172 - abilyk - Tue Jul 29, 2003 11:05 pm

Quote:
how come when i go over a certain number the compiler will like truncate it so my maps get messed up..?


For text backgrounds, each tile entry is 16 bits. The lower 10 bits of that represents the tile number; hence, 1024 addressable tiles per background. A tile number greater than 1023 won't fit.

Quote:
do i need to have more than one tileset or something?


In a manner of speaking, yes. Since you can only use 1024 tiles per background, if you want to use more than 1024 total tiles, you'll have to specify a different Character Base Block for each background.

You may not have to rearrange the way you have the tiles placed in VRAM, but you'll have to change the tile numbers to represent the correct offset from the new Base Blocks you set.

If, by chance, you want to use more than 1024 tiles in a single background, your only option is to dynamically move tiles into VRAM as needed. Hopefully that's not the case, cause it sounds like a bit of a headache.

#9175 - tepples - Tue Jul 29, 2003 11:18 pm

Actually, it's possible to use more than 1024 tiles in a background. Set a vcount interrupt to change the character base block. Lots of games did this on the NES, which had only 256 tiles in a pattern table (eqv of GBA's character base block).
_________________
-- Where is he?
-- Who?
-- You know, the human.
-- I think he moved to Tilwick.

#9181 - superx10 - Wed Jul 30, 2003 1:09 am

i already know that about the bits and stuff, what i'm saying is that i think pcx2sprites (to to split the tiles into 8x8 ones, you know) doesn't make the values the right way for me to use more than 256 different tiles. i'm getting stuff like 0xff, but i think i should be getting something like 0x00ff
im still a |23147iv3 //00|3, so i'm not sure.
_________________
"Two wolves are fighting. One wolf is all evil, hate, jealousy and discontent, and the other good, love, happiness and is content." "Sounds like a tough battle. Who wins?" said the old man. “The one I feed”