Currently, sound emitters are played for all users (or specifically their camera) within its emission range, whether that being limited by a radius or infinite. It would be nice to have an option to have the sound emitter be played to a specific player, both based on their proximity to the emitter, or infinite, but no other clients should hear the sound be played.
A system of implementing this could be similar to how Camera I/O works, with a Camera volume that sets the player’s camera to the connected Camera I/O entity through a Persistent Event.
This system can be useful for playing sound effects to completion for specific players, or all players inside the Sound Volume, and not all players in the session or in proximity.
EG: Currently in a BallRace map I have made, I trigger a sound effect on the Finish Volume being entered. This works well enough, but if more than one player triggers the Finish Volume very close to each other, we get multiple playbacks of the sound effect (or rather the first playback terminates early, and it starts playing back again).
Additionally if a player triggers the finish volume and another player('s camera) is just waiting inside the Sound Emitter’s radius, they still hear the sound despite not meeting the criteria for causing it. Having sound emitters be bound to players can mean the sound being played does not stop early if another player triggers playback, and is only played to players who meet criteria or cause triggers.
From a programming perspective:
We can have a copy of the Camera Volume, named “Sound Volume” or similar, and it has at least 1 connected sound emitter entity.
When a player enters this sound volume, a referential instance of the Sound Emitter is created (all properties) and binds to the player’s entity ID (exact same way as Camera I/O and Camera Volume). The Sound Volume will have similar events to a Trigger Volume, for instance “onEnter” and “onLeave”, which can be used to manipulate the instance of the Sound Emitter bound to the player that triggered the Volume event.
When a player exits the Sound Volume, their instance of the Sound Emitter (identified by the Player Entity ID) is destroyed. There could be a property in the Sound Volume for “Stop Sound on Exit [T/F]”, which when true, stops the sound then destroys the instance, and if false lets the sound play to completion, then destroys the instance.
This can be useful for scenarios where a player triggers a goal volume, and a sound effect plays to completion for that player, rather than a second player triggering the volume and interrupting the sound effect.
Entering the volume should not start sound emitter playback unless a specific toggle is set to do it. EG: “Play on Enter: [T/F]”
If entering the Sound Volume does not trigger playback, then the creator can control when playback happens for all users inside the Sound Volume from an external event. They can call the Play method for the parent Sound Emitter, and that will in turn loop through all instances of this parent calling Play. The same should apply to other Sound Emitter properties, like volume, pitch, etcetera.
I believe this can add a lot of options for creators of custom game maps. It could be used for playing a “GOAL!” sound effect when the player finishes the level, or a sound effect if they go out of bounds, playing just for that player that went out of bounds, or finished the level.