You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi ! Maybe this is actually not an issue, but I have not been able to figure a solution yet.
So I'm trying to build a very (very) big map for the player to play in. To avoid gulping too much memory (and also to avoid in-editor freezes when opening Godot ^^"), I'm dividing the map in more manageable chunks of 300×300 tiles. In tiled I can then use the world feature to stitch those chunks together.
In Godot I built a Node which is able to read info from the world file, and load neighboring chunks when needed, using YATI runtime importer. It works, but with a minor issue : the import operation takes quite some time and freezes the main thread for about 2 seconds when loading a new chunk, which is very annoying from the player perspective.
To solve this issue, I tried using Threads thusly :
var t = Thread.new()
var c = load_map.bind(m)
t.start(c)
Unfortunately this approach does not work, and the entire game freezes with error such as :
E 0:00:22:0692 TilemapCreator.gd:273 @ handle_layer(): This function in this node (TileMap) can only be accessed from either the main thread or a thread group. Use call_deferred() instead.
E 0:00:22:0707 TilemapCreator.gd:598 @ create_map_from_data(): This function in this node (level) can only be accessed from either the main thread or a thread group. Use call_deferred() instead.
E 0:00:22:0707 TilemapCreator.gd:486 @ create_polygons_on_alternative_tiles(): This function in this node (level) can only be accessed from either the main thread or a thread group. Use call_deferred() instead.
(of course I tried using call_deferred() as suggested, to no avail).
Now my understanding is that these errors mean the runtime import is not Thread safe, and so I should not use it with Threads. But now I'm all out of ideas on how to tackle my problem, which is why I'm coming here. :]
Is there a way to make the runtime import Thread-safe?
Is there another preferred solution I'm not seeing for this kind of issue?
The text was updated successfully, but these errors were encountered:
Hi ! Maybe this is actually not an issue, but I have not been able to figure a solution yet.
So I'm trying to build a very (very) big map for the player to play in. To avoid gulping too much memory (and also to avoid in-editor freezes when opening Godot ^^"), I'm dividing the map in more manageable chunks of 300×300 tiles. In tiled I can then use the world feature to stitch those chunks together.
In Godot I built a Node which is able to read info from the world file, and load neighboring chunks when needed, using YATI runtime importer. It works, but with a minor issue : the
import
operation takes quite some time and freezes the main thread for about 2 seconds when loading a new chunk, which is very annoying from the player perspective.To solve this issue, I tried using Threads thusly :
with
load_map
being :Unfortunately this approach does not work, and the entire game freezes with error such as :
(of course I tried using
call_deferred()
as suggested, to no avail).Now my understanding is that these errors mean the runtime import is not Thread safe, and so I should not use it with Threads. But now I'm all out of ideas on how to tackle my problem, which is why I'm coming here. :]
The text was updated successfully, but these errors were encountered: