How to make spatial sound.. kinda, its more dynamic

Hello! Im gonna share a bit more on how i do stuff in case it might help who ever looks this stuff up.

Spatial sound on GDevelop kinda sucks, i love this engine, but it cant be good at everything sadly… so the next best thing is dynamic sounds!

Meaning, when something is far away from you, it makes a quiet sound or no sound at all, but as it gets closer the sound gets louder!

Check this out for some tips on it:

The formula i use on the video is this one:
clamp(100-(Player.Distance(TheObject)*0.3), 0, 100)

Add this formula to the “Volume” of your sound and it will play at the volume relative to your distance from the object.

Change “Player” for your player character object.

Change “TheObject” for the object making the sound.

Adjust the “100” value to the max volume you want, for example if you only want a max volume of 60, the type clamp(60-(Player.Distance(TheObject)*0.3), 0, 60)

Adjust the “*0.3” value, to change how close to you they have to be for you to hear a sound, a bigger number means they need to be closer, a smaller number means further away. For example a smaller number would be clamp(100-(Player.Distance(TheObject)*0.12), 0, 100)

This works best on short and quick sounds, since they can be updated frequently, like stepping sounds, explosions, quick attacks, that kind of stuff.

To make this kind of dynamic sound for “enviorment loops”, like background sounds and such, long “loopin” clips, check the video for an explanation on how to do it, it makes more sense that way.

Hope you can find something of useful in all this <3

1 Like