0
\$\begingroup\$

how many tiles are we allowed to add on a Tile map, using softwares like Tiled , to target mobile devices? Some devices cannot load a texture that exceeds 2048x2048, would you know how a tilemap works and if a limit of size exists?

Thanks

\$\endgroup\$
  • \$\begingroup\$ depends on how the tilemap is implemented in code, a general or technical limit depends entirely on the actual tilemap renderer \$\endgroup\$ – LearnCocos2D Jan 18 '14 at 19:11
  • \$\begingroup\$ @LearnCocos2D thanks, what if I am using an orthographic renderer? Until which point should I be careful with the number of tiles/or the size of the model texture I am using for my tiles? \$\endgroup\$ – Paul Jan 18 '14 at 19:16
  • \$\begingroup\$ It largely depends on what type of devices you're targeting (IOS, Android, Windows) and what generation (iphone 3, 2008+ android?). One of my Libgdx games was able to push around 3,000 tiles (along with the other stuff I was doing) just fine on a Galaxy S2, yet I had horrible performance on older iOS devices. Your specific rendering is also going to make a difference. So you won't really know until you profile it. \$\endgroup\$ – Thebluefish Jan 18 '14 at 19:24
  • \$\begingroup\$ no general recommendation can be made, that's like forecasting the weather 3 months from now. If sou only render visible tiles and implement tile streaming you could in theory even have endless maps. \$\endgroup\$ – LearnCocos2D Jan 18 '14 at 19:35
  • \$\begingroup\$ Nice ok, could you tell me how it works, to "unload" the rendered tiles? About my question, if I understand well, the texture has to be 2048x2048, and the class TiledMap (the one given by the library) handles the tiles for us, we don't check its limitation of size (it somehow uses multiple spritebatch?). \$\endgroup\$ – Paul Jan 18 '14 at 20:06
1
\$\begingroup\$

The limits are more likely to come from the details of how you render & process the tiles, rather than some universal cutoff number.

  • If you're "baking" your tilemap to a pre-assembled image, then you'll be limited by the size of that image. For example, if your tiles are 32x32 pixels across, and your device supports textures up to 4096x4096 (eg iPhone 5 or newer), then you're limited to 128x128 tiles in any one image. You can make larger maps by breaking them into 128x128 chunks to render separately, so here your limit is most likely to come from available memory and (if the baking is not done at runtime) download size.

  • If you're rendering each tile as a separate sprite/image/quad, then you might start to hit draw call limits or bandwidth bottlenecks as you try to draw thousands of them. Batching can help with this dramatically, and should let you draw tens to hundreds of thousands of tiles with good performance.

  • One of my favourite ways to render large tilemaps is to store a tileset texture and a tile index texture. Each pixel of the index texture points to a particular tile in the tileset, letting a custom shader look up the right tile using texture indirection. This lets us render a very large tilemap (4096 x 4096 tiles on modern phones, over 16 million) as a single quad, and we could again render multiple of these chunks to make a world even larger.

    (Though given limited display resolution, you probably won't need to display more tiles than this at a time - once you're zoomed out so far that each tile is just a few pixels on the screen, you'd want to transition to a reduced level of detail version anyway to avoid aliasing)

As always with performance questions, the only way to know for sure on a given device is to actually test it and profile the performance on real hardware. Overall though, I'd suspect that performance won't be the limiting factor in the size of your tiled maps, as long as you're willing to put in the work on a solid chunking and/or batching system of some kind. You'll hit the limit of how many tiles legibly fit on screen first.

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.