In ludiloom, there are three main types of sounds: environment sounds, sounds without position and positional sounds. You can upload sound files to the ludiloom platform and then use them in your arenas. Learn more about the supported formats and some guidelines.
Contents |
Environment Sounds
This is the type of sounds used to add background music in the game or a general environment sound (e.g. bird chirping, in a forest). You can use the Environment Sound Editor to set up a playlist for the arena game. These sounds will play with a constant volume, disregarding the player position in the game environment.
As you can see in the next image, there are two types of environment sound sources: the ambient sound and the playlist. These sources are independent and you can use both at the same time.
Using this editor, you can set the ambient sound to start automatically when the arena is loaded through the checkbox On Load (3). The ludiloom API enables the control of this feature through scripting, with the lua functions found here. The api includes functions to set, get, play, stop, pause among others.
You can configure the playlist using the Environment Sound Editor, but to actually use the playlist in the game, you will have to use the ludiloom API, which provides total control over the playlist. You can see all the functions regarding the playlist here. This way, you can change the playlist sound according to in-game changes, for instance, change the music when the player enters a fighting scene. There are functions to add/remove songs, start/stop the playlist, set volume, etc..
Since these sounds play all over the Arena, the functions are part of the class Arena in the API:
Arena:pauseAmbientSound(); Arena:playPlaylist();
Sounds without position
Sounds without position are useful for sound effects out of spacial context, for instance, to provide audio feedback to the player when he interacts with the gui (overlays).
Next, we will show how to implement this feature. We are using a sound from the Media Library Back to the Yard, which you can subscribe freely.
Start by creating a [[Representation#Button|button]:
Then, create a sound right-clicking on the object >> new >> sound:
Then, in the Sound Editor, do the following:
- Set the name to click.
- Press select sound and choose a sound from the Media Library.
- Enable Multiple Sources.
- Enable Attached.
- Press New.
Like this:
Then, it's time to create an interaction. Right-click on the object >> new >> interaction:
Write the following scripting code:
System.print("Button clicked..."); this:getSounds("click"):play();
And name the interaction onClick:
Finally, we need a listener to connect the button clicked event to the interaction we just created. Right-click on the button (not on the object) >> new >> listener:
Configure the listener in the following way:
- Set the type to Action.
- Set the Action to Button Clicked.
- Choose the Interaction onClick.
And press new.
It's done! Switch to play mode (ALT+1) and test the button.
Positional Sounds
Sounds are Representations, and like most representations, they have a position in the 3D environment. A sound is positional if the option Multiple Sources is disabled. This means that the position of the sound will be relevant and will propagate according to the position of the camera, though ludiloom's full 3D sound system. You can move sounds by setting their position in the Sound Editor, using the Scene Editor or the Transformation Gizmos. In edit mode you can see a visual representation of the sounds as little boxes with a sphere that represents its range.
Sounds can be attached to models and obey the normal rules of attachment: they will maintain the relative position to the parent representation.
The ludiloom API allows you to control every feature of the sounds. Check it out here.
Other Positional Sounds
Models with Character physics have a special feature to play a sound in loop when the model is on a surface, making this the best way to configure the footstep sounds. Check out the page How To Set Characters Physics.
In models with Vehicle physics you can also configure a sound for the engine. This sound will increase/decrease the pitch according to the engine rotations. Check out the page How To Set Vehicles Physics.










