Add more control over resources loading #2356
Replies: 5 comments 1 reply
-
In short: yes! :) That's definitely something I want to have at some point: be able to disable the initial loading of some/almost all resources, then do the loading whenever it's needed (and potentially also have a way to unload, or at least specify that something can be unloaded).
This may create some weird behavior in the sense that for example, if you set a sprite image to be not loaded at the beginning, then it should be loaded whenever an instance of an object that use it is created in the runtime scene.
If you want to investigate a bit, it would be interesting to see what Pixi.js offers for this. Could be a good idea to have a way to monitor the usage in terms of memory/GPU memory too. That's something we could maybe expose using some Electron apis (at least just for developers) (I was also thinking of having a dialog in the editor that would also show the usage in terms of memory, to see how well the editor handles big games) |
Beta Was this translation helpful? Give feedback.
-
I am also thinking about some methods to make loading easier:
Both of those methods would have a callback variable with the amount of things to load, the amount of things loaded and if it finished loading.
Imo we should do both. For that, we can either use a project property or an action "block until all resources are loaded" or a condition "all resources loaded". The default should be not blocking though, as it is up to the user to implement a loading screen to hide the loading process I think.
We could pregenerate a transparent image of the size of the image to load to put there in the meantime maybe? |
Beta Was this translation helpful? Give feedback.
-
Speaking of this, there is already a notion of resource groups/resource folders in the codebase, which is not exposed in the editor. Though it requires a lot of painful manual work to organize your resources. Might be better to focus on loading resources for a scene - or autogenerate groups for a scene :)
We might not need "callback" variables, just an expression giving the percentage of the progress of the currently loaded resources, and a condition checking if the resources have just finished loading.
I would avoid this because of confusion that this can make ("why is my object not showing", "actually it is showing", "but the animation is messed up because it started not at the right time because it was loading"). Maybe to get things rolling on this, we could start with an experiment:
I think overall the biggest challenge is to do the work of identifying which resources are used in the scenes. Fortunately, it should be doable with Then, we it should be fairly easy when loading a new scene/unloading a scene/changing to a new scene to compute the difference (the set of new resources minus the set of old resources), and load the new resources/unload the ones that are now useless :) If you want to experiment but don't feel like doing the |
Beta Was this translation helpful? Give feedback.
-
Anything happening around this feature request lately? |
Beta Was this translation helpful? Give feedback.
-
I have to say that this is a very important feature, for open large maps yes, I have always wanted to do Ori and the Blind Forest like the game, I learned the documentation, ready the material, only to find that the engine can not support dynamic loading, I am really disappointed, after a long time to prepare it is like this,I really like this engine and hope to make this feature soon |
Beta Was this translation helpful? Give feedback.
-
Description
When GDevelop loads up, it takes much time preloading everything. Sometimes though, you may want to have a game that loads fast initially and then have some loading screens to load the missing stuff.
Solution suggested
Instead of forcing preloading resources to the user, we could take a similar approach to what was done in #2006 :
That way, the game never breaks, but it gives a way for users to control what is loaded or not to have a better memory management, and to make their own "loading screens" by initially loading only the loading screen assets so that the gdevelop splash screen can be hidden as it is too fast to see anyways, and using a GDevelop scene using the actions to load what they need and display the on screen feedback they want in the meantime.
Beta Was this translation helpful? Give feedback.
All reactions