+1 vote

Hello, I'm making a top-down 2D like Zelda (recently binding of isaac).

However, there was one problem. After creating a room in each scene, random room generation in the level scene, addchild to the new room and removechild the current room (using call_deferred) via the area signal when the player exits the door.

However, if the object and enemy are loaded at the same time, an isinsidetree error occurs.

After that, when the game starts, I add_child to all the rooms at once and then run it, but it is also loaded all at once, so the speed is very slow and my laptop is cut off slightly even in the game.

After that I thought about multi-threading. I'm not sure if this multithreading will solve my problem, can I get some advice?

Thanks, and I'm really sorry for my short English

Godot version 3.3.3
in Engine by (75 points)

1 Answer

+1 vote
Best answer

MultiThreading will only further complicate your problem.
But you are correct that it will help with that freezing you get from using add_child but that really depends on how your game is structured and you may not need it at all.

For example if your player is being removed and added to other scenes it may be best to always keep it in the sceneTree and position it as needed

Additional info

Have A look at episode 8

by (4,560 points)
selected by

Forgive me for being late.

Yes. In your opinion, by placing the player in the same location as the Room scene, the player stays still, but by add child / remove child only to the Room, frame drops are reduced and more comfortable than when the entire room is instanced.

Thank you!

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.