Can you dynamically load resources?

Is there any way to load resources dynamically? I’ve been using GDevelop 5 for a few months and i’ve been loving it so far, but i’d like to add some modding support to the game i’m making and i want to know if there is any way to dynamically load resources.
I want to load images and sounds, save them as variable or any way and run them.

Also, is there any way to run a sound through a string? I can do that with images and assigning each animation of an object to a custom name, but apparently there’s no way to do that with sound?

Hi,
Perhaps you’re looking for “create an object from its name”. It allows you to use variables, strings, concatenation, etc.
“save an image as a variable” doesn’t make sense to me.
I don’t understand the “run a sound through a string” either.

Can you explain differently or write examples of the events you’d like?

Hello Gruk! Sorry about the confusion, i suck at explaining things and i noticed i wrote a few things wrong.

I meant save an sprite into a variable, but one that isn’t within the game already, for example:

Player decides to make a mod, he writes a .JSON file containing the sprites name, variables and sound names that should be loaded into the game, he creates a folder with those sprites and sounds. I can create a interpreter to load these variables, however i didn’t find a way for GDevelop 5 to dynamically load the sprite or sound.

What i meant with “run a sound through a string” is:

We have the “Change Animation (by name)” in Gdevelop, which we can give name to our animation within objects and call them through a string.

This way my game is able to collect the animation name from a .JSON file, store it into a scene variable and the game will change a object animation to that string. Which allow me to directly name the animation into the JSON and call it with a single code:

“Set animation of EventImage to VariableString(image)”

However i can’t name each sound i have and i can’t call them into a event by a string, the way i’m doing right now is like this:

"The text of scene variable audio.sound is = “sound1"” > “Play the sound sound1.wav on the channel 0, vol.: 100, loop: yes”

Which is quite inefficient because there’s many sounds and i will be adding more.

So you would like the player to be allowed to upload a zip file containing a folder with resources to run the game? Nah, I doubt you can do that, for many reasons.

Regarding sound, no, you can’t use expressions / variables on the filenames yet. You can vote for it here: Trello

1 Like

It would be nice to use local images for example feom the phone camera or gallery

Thanks for the answer Gruk!

It don’t have to be a zip file, but yes. The main idea was to add mod support to the game.

Oh that’s a shame, i could do it in Gamemaker but since i’ve migrated to ubuntu and i don’t have the money to upgrade to gamemaker 2, i can’t use it anymore.

I will work around it, if any day it become a real necessity to add it i will take a look in learning javascript and doing a plugin for gdevelop.

i think you can load resources from internet and you can use JavaScript

1 Like

I don’t know if this what you was referring to but here is the answer for me with my problem the solution i found:

gdevelop github I found out how via code but I aim to take full advantage of how the developers attended for gdevelopers to be used (no code) and how I will push it to do more with how i attend to use it (with code) and i love the aim the developers are taking with the “THIS A NO CODE GA ME ENGINE” cause it’s even showing even more how powerful the underline language that is built of is.

Hello!

I’m glad you found an answer to your own question. However please don’t bump multi-year old threads, especially since you have your own thread that you also posted your question and answer too. Thank you!