+2 votes

Hey!

I want to background-load scenes on a grid in another thread (seamless world style). While loading the PackedResource is easy and fast, the instancing of it is not. In another thread it takes up to half a minute to instance (not even adding to the tree) which is unacceptable. Instancing it from the main scene does take around 10ms which causes a visible frame stutter at 16 fps.
Note that due to other restrictions a decrease in complexity of the scene is not an option.

Is there a possibility to background load a scene in a sane way?
If not - why does instancing a scene takes so long in another thread and what is the engine dev team gonna do about that, as this would de-facto prevent making open world type games in a sane way without resorting to parsing and reconstructing scenes from pre-instanced nodes and textfiles as those can be used just fine in another thread.

in Engine by (23 points)

I believe this half-a-minute delay happens because, even though it instances in a thread, the engine calls resources that are accessed too on the main thread and locks maaaany, waaaay too many times, or copying PoolArrays without noticing, that kind of things, which defeats the purpose of threads (but it depends which code you run in your thread). Maybe you can open an issue on Github? Because I'd be interested as well if we could have a fix for this. Did you try in 3.0?

Hey Zylann!
Yes I've tried it in 3.0. I guess making an issue on Github sounds like a good idea!

Here is the Github issue.

Please log in or register to answer this question.

Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to webmaster@godotengine.org with your username.