I think I’m confused on networking workflow for spawning audio. I’m making a multiplayer game with a listen server.
Here’s my setup:
-
My custom GameState BP will spawn a SoundManager actor that is NOT replicated for each client, and keep a reference to it. So now each player has its own SoundManager that is client-sided.
-
In my Pawn’s EventGraph, here’s the test flow. I press a key to spawn a sound. I call a Run On Server -> Multicast, which will get the game state, cast to custom gamestate, then get the SoundManager and call a function to spawn a Sound.
-
Here is the SoundManager’s “Play Sound” function
-
And here is the PROBLEM!
As you can see, the listen server will correctly spawn 1 single Sound instance. But the clients will spawn 1 for each other client in the game. So there are 2 clients here (server makes 3 total players), so each client spawns 2 sounds.
If there were 4 players, making it 3 clients, the clients spawn 3 Sounds stacked ontop of each other, while the server experiences no issues and correctly spawns 1 Sound.
I obviously am missing something here, or my workflow is wrong altogether. If anyone with experience with networked audio could explain how I would go about it, it would be appreciated.
|************ SOLUTION ****************
I’ve been using PIE windows, so setting it to open 4 windows for 4 players for example. Then the console debugger to display the active SoundCues. What I didn’t realize was PIE windows count as 1 process, so it was displaying SoundCues of ALL clients.
SO I WAS TOTALLY READING IT ALL WRONG AND MY BLUEPRINTS WERE FINE AND I WAS OVERCOMPLICATING THINGS FOR NOTHING.
Please use prints to check for duplicates, if you see it go “Client 1 blah” more than once, then it’s doing something more than once.