I'm trying to archive a big map on my game, 2400x900 of 64x64 tiles using TiledMap and LibGDX.

What is the difference in performance of using a 100x50 tiledmap vs a 2400x900 map? Say they both have the same tile set images, I mean the images used for the 100x50 will be the same as the 2400x900, so why shouldn't I do it? If there's a hit on performance, why? resources are the same, and the tiles are only rendered when on screen.

So knowing this the only thing that I can think that can hit performance is:

  • The information stored in memory for each tile, there will be 2400x900.

  • TiledMapRenderer Looping to find the correct tile to draw.

If the answer is (1) when I call tilemap.dispose() do I free all this memory instantly or wait until gc do his thing?

If the answer is (2) I dont know how TiledMapRenderer works but can it be optimized using some sort of quadtree implementation?

If the answer is both please answer both.

Loading Screens

So, I've read of having to use loading screens, and split the map.

I was thinking to write a small program to split this big tiledmap and generate a few json files map1.json map2.json etc.

Then in the game I use those json files to create a new TiledMap(). So I can load the correct sections of the map in a loading screen, when needed.

Problem is that I don't know if I should tilemap.dispose() the old tilemap since I will be needing the tileset images again, So I guess my question are:

  1. When calling dispose() do I dispose images only(tilesets) or both images and memory from tiles?
  2. If dispose() only dispose images, then I guess garbage collector takes care of the memory stored from tiles, positions, properties etc etc. And I wont need to call tilemap.dispose() right?
  • \$\begingroup\$ Have you already try "big map"? I have created map with your dimensions with two layers and it is approximately 15MB this is not a lot. Please try simple example, loading and rendering map. How render works? See source code, it is simple just trace code in class.... dispose? For maps usually one level one map (you can use sub-levels, ...). Also you can reconsider map size. Make tiles with higher resolution if needed. \$\endgroup\$ – MatejC Aug 30 at 19:51

Your Answer

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

Browse other questions tagged or ask your own question.