+2 votes

Does anyone have experience building point and click adventure games with many different scenes? If so, how do you manage scene switching?

Say you have 500 full scenes, (actual playable game scenes with different backgrounds, puzzles, etc.), how do you manage them all?

If I click on the left or right side of the screen, I want to be redirected to a completely different scene.

Should the currently active scene load a new scene by name using something like "(gettree().changescene("res://path/to/scene.tscn"), or should all scene switching be managed in a singleton script, like "SceneManager.goto_scene(("res://path/to/scene.tscn")"?

I know it can be done either way, I'm looking for an experienced developer who can explain which method would be the best approach, and why.

Thanks!

in Engine by (67 points)
reshown by

2 Answers

+1 vote

Create array that contains all scenes paths, then have variable and assign number based on scene index and if you want to go to next scene then increase that value, get scene path from array using that variable as index and load it. You can create SceneManager as a helper, create function like load_next_scene or load_previous_scene.

If you don't care about scene names then name every scene like Scene_X where X is the number, so it's going to be Scene_1 to Scene_500. With that in mind, you don't need array and use "res://path/to/Scene_" + str(sceneIndex) + ".tscn".

Using singletons is a good idea if you are going to use scene loading with several scripts. If only one script is going to load scenes then there is no need to use separated script.

by (378 points)
edited by
0 votes

For now I’ll try using x,y to plot current scene’s location on a grid. Navigation from scene to scene might be done by incrementing or decrementing a row or column. This should allow for up, down, left, right scene switching.

by (67 points)
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.