Add more control over resources loading #2356
Replies: 7 comments 3 replies
-
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.
-
Just my two cents here. In Unreal's World Partition feature the scene is split in cubes that all load or unload their contents depending on the player's position. 4ian proposed we can access our game's resources and command them each to load or unload at will. What if we placed invisible square sprites inside each scene that would resemble this feature and gave each resource a command to load or unload when the main player touches their invisible square? You could then resize the sprites manually based on your preference to give the engine enough room to load the parts of the scene you'd want without the player noticing the assets popping awkwardly in to existence. It's a crude solution I know but maybe it could work? Down the road this feature could be a resizable square grid (which GDevelop already kinda has inside the levels of the external layouts) where each square allows us to write the command: "When player is inside this particular square(insert square size,position to identify the square you want) ---> Load x,y,z resources" and "When player stops being inside ---> Unload x,y,z resources". I know it's a pain and it requires getting inside the guts of the engine but I believe it's worth a shot. Allowing users to create large and complicated levels is the key to success for a product like this (especially in 3D which is already overcrowded with high-end solutions) and I'm surprised this thread dates back to 2020 with no concrete update yet. |
Beta Was this translation helpful? Give feedback.
-
We need a feature that allows us to resize this grid and identifies the resources inside each square to help with the load/unload command. |
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