Loading images on demand (per scene)?

Has anyone worked out a way to load the images and videos needed for a scene when the scene changes? I know we can do it with audio so I’m hoping there could be some way to do it with other assets as well.

We’re trying to make a game with many rooms, animations and characters but it will be difficult if all of the imagery and video has to load at the start. Really appreciate any insights you may have. Thanks.

1 Like

GDevelop doesn’t have “load image on demand” functionality.

If you have many rooms and a lot of images/videos to load, you may want to consider making each room a separate scene. That way there will be fewer resources to load at once at the start of the scene.

Loading of a new scene should take a split second, and if you combined with a fade out and fade in effect, it won’t be noticeable or unusual.

1 Like

Thanks for the response! Yeah, we’ve made each room it’s own scene. But it still appears that the images for all scenes load when we initially launch the game (instead of loading when we change scenes).

1 Like

As far as I know yes…but not quite how you think. Assets are verified/unpacked/etc when you start the game, but assets per scene aren’t kept in memory (unless you explicitly have “always keep in memory” checked in the Resources panel.).

Changing scenes is still going to save you processing/memory overhead.

2 Likes

They are actually, and that checkbox currently does nothing afaik

1 Like

welp

Good to know! Although I’d think it’s still not kept fully in memory due to culling anyway, correct?

1 Like

Culling prevents rendering textures that are not visible but all textures are all loaded at all times.

I think I had created a GitHub discussion or issue about refactoring that in a way similar to the sound refactor i did, where you would be able to check a box to preload the resource or not, and have actions to load and unload resources, and in the case you have not loaded one before using it it loads automatically. I had also talked there iirc about adding resources groups to be able to unload all resources at once and load all the resources used in a scene for example.

2 Likes