4.6
Instantiation is one of the biggest hitches when adding a scene. It could technically be threaded. Does godot have any way to do it?
4.6
Instantiation is one of the biggest hitches when adding a scene. It could technically be threaded. Does godot have any way to do it?
In what way do you mean? You can instantiate scenes on a separate thread, but I’m not sure how much sense it makes to instantiate individual nodes on threads as combining them would have to be done on the same thread
Yes and no. You can certainly instantiate objects on a separate threads, but add_child() will still cause hiccups just the same as it will in a single-threaded instantiation.
EDIT:
I have a game that does all of its instantiation on separate threads, and it works extremely well during the load phase, but sometimes hiccups at the add_child()phase. There seems to be no way around it as of now.
Hiccups which are caused by the threads having to join to do this:
Admittedly, I’m not a professional game developer, but as a programmer I dare predict that even in game development introducing your own multi threading is a premature optimization that is more trouble than it’s worth in most cases.
However. If you build really big scenes and have interesting content that loads fast for a player to enjoy then sure preloading those big scenes in a background process makes a lot of sense… But is it the first thing you worry about when working on a project?
Agree strongly
Or just use object pooling.
add_child.call_deferred(new_node)