Efficient Tile Map

Blitz3D Forums/Blitz3D Programming/Efficient Tile Map

Yes, having 900(30x30) separate objects would be slow, but also having one big object would mean it would try and draw all the tiles, all the time.

As these are tiles and the textures aren't repeated inside each tile you can put all the individual textures into one big super texture and use the UV coordinates in the vertices that make up the tiles to map into 'parts' this big texture. This way you only have to use one texture (this reduces texture swaps and will speed things up) and you can setup the surfaces however you like. You have to be a little careful doing this though, when the textures are mip-mapped they can bleed into each on the super texture, so its best to either move the UV coordinates inwards slightly, or put a border around the 'sub-textures'. (Ok - it's not the best explaination in the world, it's quite a common technique - but I can't find a link that explains it! )

Then, split up the tiles into patches - for instance make objects that have 10x10 tiles in it, so you'd have 9(3x3) objects. This way, blitz can clip out the patches that aren't seen.