Adding scene global loading

I was thinking about the scene stacking in GDevelop, Wich is in quite honesty an awesome feature, but was thinking about a problem with it. Sometimes, when you pause and return too much, you can mess it up and load the wrong scene. Plus it is a bit complicated to completely master. My suggestion would be to add a “global scene cache”, where users can use an action to cache a scene as a specific name, and later return to that Scene. Use would be: user would use cache and switch scene action instead of a switch scene action, and the scene stack would cache the instance in a Hashtable<SceneName, Scene>, and on loading a scene if there is the key SceneName in this Hashtable, it would push the cached scene and remove it from the list of cached scenes.

Why? Let’s say you have an RPG with a gigantic open world map. You make for example a Dungeon in another scene, but on exiting the dungeon there is a gigantic loading time to reload the open world map. Plus it needs to save the data of the open map and reload it each time. For this example, pausing scenes is enough. But let’s say you have many nested Scenes that will load and you still want the open world map to be loaded to an extent, you need to keep trace of your pausing to restore the previous scene exactly the amount of times needed. Here it would be much more easy.

For devs: As it requires a modification of the scene stack and adding only one action, I think it belongs in the engine and not as an extension. What do you think?

2 Likes

Originally I was suggesting to 4ian something similar to what RPG Maker has, to be able to create sub-scenes so the map could be a scene, towns could be sub-scenes of map and house interiors, dungeons could be sub-scenes of towns…etc and save the state of each scene as the player switch between them so if I go to a room and switch the lights on, when I go back the next time the light is still on, if I left a door open, it is still open when I go back…etc. But at the time 4ian had concerns how to know what the user want to save exactly and what if a user want to restart a scene from the beginning then you have to store the scene twice and he decided to instead allow to pause and unpause the previous scene in memory and able to go back any time and pause only 1 scene because he is worry about that people may pause and store too many scenes in memory and then wondering why their game is crashing and using lot of RAM and people would think GDevelop is not optimised.

After I decided to master the storage events and actually it is pretty simple to come up with your own scene cache using the storage events and because you have to save the game at some point when the player exit the game it is just something you have to do anyway.

But I agree it would be nice to be able to have a way to save/load scenes and stack them similar to RPG Maker, it seems many people find it complicated to use the storage events not to mention JSON :wink:

1 Like

Using storage is not equal to caching the scene. When using storage you only save the scene’s data. But sometimes you may want to keep the scene itself because it permits to A. Not have to load the entire scene again B. keep the renderers non destroyed. That permits to save big loading times on scenes loaded very often that have many objects

1 Like