Audio that syncs itself when it's finally loaded in?

Recently, Flood Escape 2 has added this neat quirk.

This work has become beneficial to any users experiencing unstable connection or lag on their end. Basically, if the user is playing the map while the game audio is still loading for them, the audio for the map is silenced – and when it’s finally loaded, it automatically fades in and syncs the sound position to what the rest of the other players are listening to.

How is this achieved?

You’d want to play your music on the Client. So use a RemoteEvent to tell the Client to play a particular audio. You will then need to store “currently playing” audios in a table for new players who join. You can then tell the newly joined players to play a specific audio and pass the “TimePosition” property to keep them in sync with those who have already started playing it.

You can also have all sound Id’s in a table and use the ContentProviderService and PreloadAsync to download it before It’s actually needed to combat latency issues.

Any issues, further help or clarification or questions, do let me know! :smile:

1 Like