Is there a performance overhead when using large tilemaps?
I was wondering for my next project whether to put all the self-contained levels on a single tilemap to save the added complexity and loading times of loading/unloading levels.
Is there a performance overhead when using large tilemaps?
I was wondering for my next project whether to put all the self-contained levels on a single tilemap to save the added complexity and loading times of loading/unloading levels.
Yes there is an overhead, we don’t do any culling before rendering so all the geometry in that tile map will be sent off to the GPU for rendering. You need to test that though in order to know if it’s an actual problem perform-wise or not, it depends on level sizes etc.
Are loading times a problem for you currently?
I’m thinking that if you can put them into one tile map, you can also fit the graphics into a single tile source, correct? If so, you could experiment with keeping that texture in memory at all times to avoid loading/unloading it between levels (still that texture should be really fast to load, how big is it?). In Defold every resource is ref-counted and shared, so a texture only exists in memory once. If it is only referred to by collections which are loaded/unloaded through collection proxies without overlap, the texture will also be loaded/unloaded. If you add a reference to that texture in the “outer” collection which takes care of the loading, it will always remain in memory.
Thanks for the reply!
Loading times are currently 2-4 seconds so no problem at all and most of that time is taken up parsing the level in my own code.
My objective is to simplify things as much as possible and initially I thought keeping all the levels together would facilitate that. On further thought though, it would cause other issues so I’ll likely stick with the normal way of keeping levels separate in their own collections. I’m still getting used to the Defold way of doing things - quite different from anything I’ve done before but it does handle things very well indeed and has produced stable code.
Yeah, I can really recommend to split things up as much as possible. You will really benefit from it in the end. Having the different parts of your game split up into multiple collections will also allow you to quickly test the individual parts by setting a specific collection as main collection.