Could FMOD Sync Random In a Multiplayer Game

Hi,
I started to learn FMOD yesterday, so I’m totally a Newbie.
I want to use FMOD to improve my Unity game’s audio effect. FMOD seems to handle a lot of Logic and Effect work outside Unity which will save me a lot of coding work such as Random picking sound clips, Random LoopStartPoint and Random Pitch. But what I’m working on is a multiplayer game in which some audios should be synced among all game clients. For example, there is a radio in the game level which is playing Music Playlist Randomly. I want the radio’s current playing music same among all clients. And the NPC’s random Voice should also act like that cause it is important for my game logic.

I’m wondering is there a way to make the Random things be Synced among the Clients of a Multiplayer Game powered by FMOD?

I’m thinking of Generate a Random Seed Int by the Host Client and All Client use that Seed to make FMOD generate the same Random? Is there possible for the last version of FMOD now?

Hi Yang,

Glad you’re enjoying FMOD so far.

It is certainly possible to provide the same random seed to each player, however this would rely on each client running perfectly in lockstep. If there are any situations where clients come out of sync (which would depend on your networking model), you would likely end up with divergent playback behaviors.

Therefore I would recommend setting up a programmer sound and audio table for the music and using the host client to generate a random song string to pass onto all players. This will ensure that all players hear the same song from the radio. This method will also work for the random NPC voice.

https://www.fmod.org/documentation#content/generated/FMOD_STUDIO_PROGRAMMER_SOUND_PROPERTIES.html

There is a programmer sound example in our API docs, and you can also find examples for UE4 and Unity in our documentation.

https://www.fmod.org/documentation#content/generated/engine_ue4/programmer_sounds.html
https://www.fmod.org/documentation#content/generated/engine_new_unity/script_example_programmersounds.html

Thanks,
Richard

2 Likes