Multiple scenes and optimization

Hi, I’m working on a visual novel.

I have a single scene and don’t need any more.

But this way all the backgrounds and characters are loaded together and I’m afraid of slowing down the game.

If I create more scenes with few objects, is the optimization better?

Thanks in Advance!

Hello, it depends. If the problem is the initial load before starting the game, it’s the same if you have it in one scene or many, because so far Gdevelop loads all the resources when starting except the sounds that can be on demand or by default, they will be loaded when there is some action that executes them. If you have high-quality images, you may want to compress them.
In the case of being the processing of the events, the more there are, the more time it will take to scan each event at each frame. If you do everything in a single scene, you should group the events that depend on the same condition and from there make sub-events so that you do not have to scan each one separately at each frame, in case it does not meet the initial condition in which you grouped them. , the system only scan one event.
If the amount of events is high and the events are disabled as the game progresses, maybe it is better to separate it into scenes.

1 Like

Hello and thanks for the precise answer.

I thought that GDEVELOP would load all the assets before the game, but then load all the assets of each scene again.

I give an example:
In a scene I have 100 elements and I use only 5 at the same time.

In another I have 20 elements and I only use 5 at the same time.

Is the first scene slower than the second or are they the same speed?

As far as I know, the amount of objects you have in the scene editor is not really going to change the speed. What can modify the speed are the events that are associated with those objects. At each frame all the events that you have in the scene are executed. The more events grouped according to the same conditions, the better, because in cases where the initial condition is not met, the rest of the subevents will not be executed to see if other conditions are met. So… having more objects loaded in the scene doesn’t decrease the speed, but it is assumed that if there are more objects it is because there are more events associated with those objects… which will decrease depending on the resources required to execute those events.
Another thing that can slow down the game is the rendering of the objects on the screen, but this is associated with how many objects you have at the same time during the execution of the scene and their graphic quality (not the ones you have loaded in the scene editor of Gdevelop). However, the events are usually what consumes the most resources in the processing of each frame, but in the case of a graphic novel I don’t know how complex events can be.

1 Like

Hello and thank you very much for the super detailed answer.

Your tips are really helpful to me :smiley:

Browsing the forum I found this advice from Arthuro555:
Separate in separate scenes whatever possible: having a small loading time is better than lagging game.”

I think he refers to the number of scene events, as you say, but to be sure I’ll ask him too, in order to solve this topic for future users too!

Thanks again!

1 Like