How to improve the perfomance of a large rule tile based tilemap?
I have a big tilemap with 800x800 rule tiles. I could use normal tiles, but i want to use the rule tile feature for my map. Is there any way to improve the performance of my rule tile based tilemap?
Hi @TimeFalling - You have more than half a million tiles. I don't think Unity tilemap system is meant to be used for such large tile counts.
This question / answer in stackexchange might be useful:
https://gamedev.stackexchange.com/questions/151048/what-is-the-size-limit-to-the-unity-2017-2-tilemap
Contrary to eses, I think that 800x800 size should be still fine for Unity's Tilemap system. It should be multi-purpose after all.
Regarding your problem, it's hard to tell without knowing more details. What I noticed is that batching tile placement by using SetTiles and SetTilesBlock doesn't help much, at least with rule tiles.
Answer by wladyslaw · Sep 25, 2018 at 05:35 PM
A rule (nomen omen) of thumb would be to define the rules for tiles in an order reflecting the probability of their occurence, so that we skip as much cases to check as possible. For example, if you have large areas of grass, then it would make sense to define the rule for most common “inner tile” (with all neighbours being grass too) in the first place.
Actually I haven't applied this approach to my current project and this question encouraged me to test it. So I have a 800x800 grid with a few tilemaps, having 1,2 mln tiles in total with around 0,5 mln of them being rule tiles with 48 rules. The rules were ordered kind of randomly with the most common inner tile rule being on 6th place of the rule list. It took 66 seconds for my quite good laptop to generate this tilemap.
After switching the inner tile rule to first place, I saved 10 seconds. Ordering the other rules properly would maybe give me another 10. Not very impressing, but that's always something.
Your answer
Follow this Question
Related Questions
Tile pallet doesn't exist in Unity 2019.2.12f1 personal! How to re-enable it? 1 Answer
How to get a fluid color transition for every tile in a tilemap? 0 Answers
Tiles strech weirdly 0 Answers
Move Object around a platform of tiles 0 Answers
I have displaced tIles depending of the game resolution 1 Answer