How to place tile faster than this

Godot Version



i’ve recently made a noise generated map, i saved 4 array that generated from them which are seaArray, beachArray, grassArray, and forestArray
i placed them all with this code

print(Time.get_time_string_from_system(), "Start Placing Tile")
print(Time.get_time_string_from_system(), "Navigation Tile Done")
print(Time.get_time_string_from_system(), "Sea Tile Done")
print(Time.get_time_string_from_system(), "Beach Tile Done")
print(Time.get_time_string_from_system(), "Grass Tile Done")
print(Time.get_time_string_from_system(), "Forest Tile Done")

this is the result
07:05:54Start Placing Tile
07:05:55Navigation Tile Done
07:05:58Sea Tile Done
07:06:00Beach Tile Done
07:06:01Grass Tile Done
07:06:01Forest Tile Done

is there any way to make this faster ?

I don’t think there’s an easy way to speed that up. You’ll probably want to look into creating the tilemap in a background Thread if possible, before it becomes visible (avoiding a loading screen unless it isn’t loaded in time). Also since each of your terrains are on a separate layer you might be able to use multiple threads so multiple layers can be setup in parallel.

Another thing is, if your autotiling rules are simple enough using the terrain system may be overkill, it probably is since each terrain is on it’s own layer. In that case you can pre-determine the atlas coords of all the border cells which might be faster if there’s a lot of interior tiles that the terrain system is checking but you can safely ignore. You do need to loop through the list of tiles in order to set them into the tilemap though, there’s some possibility or creating tile patterns ahead of time to speed this up too

1 Like

Great, it come from 8 seconds to just 3-4 secs
thanks a lot man

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.