Seanba / Tiled2Unity

Export Tiled Map Editor (TMX) files into Unity
Other
495 stars 120 forks source link

Batching #139

Open Alkanov opened 6 years ago

Alkanov commented 6 years ago

Hi @Seanba I am posting this here because I dont really know where to star. I dont know if this is an issue with Tiled2Unity or my Tiled configuration or even a Tiled bug...

I have a super big map 15000x15000 with 24 layers on my mobile game and of course I have performance issues.. after some research and profiling I spotted this: https://imgur.com/a/t1uAD

I have tested this by moving around the map, and found out some places where my FPS go below 20 (above 70 draw calls) and some others where it stays above 50 (around 20 draw calls)- I think this proofs that my performance issue is due to the size of the map and the way it is being batched/drawn..

So my questions are: Is there a way of batching all of these on one draw call? (am I asking something logical here?) Should I split my map on different tmx files?

Again, if this is not the best place to ask, please let me know.

Thanks.

Seanba commented 6 years ago

Hi Rand. By my back-of-the envelope calculation your 24 layers of 15K tiles wide and high will be using 5.4 billion tiles. I'm surprised that Tiled, Tiled2Unity, and even Unity itself is able to handle assets of that magnitude!

I always recommend splitting up TMX files (or really any assets) into the smallest functional and discrete chunks you can. It's just a good practice to be in to help you manage your assets and collaborate with others.

Also, have you tried the new 'Infinite maps' option in Tiled? I've recently updated Tiled2Unity to work with infinite maps and a nice side-effect of that work is that larger maps are automatically split up into smaller chunks for you. That will help with frustrum culling, for instance, which should improve performance.

As far as batching goes, as long as your tiles are using the same texture then you should get batching for free. I wonder if you have UI or other elements of your game that is increasing your draw call count?

Hope that helps.