Multiplayer assigning and changing dynamic material parameters

So I have a multiplayer game and I want want the material in a particle system to not glow when it is nighttime.

I have tried a few things and the result is that that the host correctly sets the glow off; however, the clients do not.

The last thing I tried is as shown below:

My results are shown below of which the Host is on the left; Client is on the right… …the white splashes are not desired on the right…

Thoughts, comments and/or suggestions???

Here’s the thing. BeginPlay fires on both server and client. That’s why you have SwitchHasAuthoirty which makes an execution path for the server (Authority pin), and one for client (Remote pin), though that statement is only valid if the actor is replicated. Also you shouldn’t need to use RPCs at all. You are already on server, why have ServerBeginPlay event as a server RPC? That will make it 100% drop on clients, as they don’t own WaterSplashes actor.

So here’s what you need to do:

  1. Make sure WaterSplashes actor is replicated.
  2. Make ServerBeginPlay event a regular non-replicated event.

YES!

It is working in Standalone Game mode.

Both points seem to be right on.

Didn’t have this replicated. Doh!

Changed the logic to the following:

Before GetGameMode and casting to yours (and after creating your dynamic material instance) do a SwitchHasAuthority with authority pin so you’re on server. As I said before BeginPlay fires on both server and client, and GameMode is server-only, thus at the current state you’ll get a null GameMode client-side and thus a failing cast. I strongly suggest checking this.

I downloaded that document. 115 slides! Thanks! I have some reading todo…

I believe you are recommending the below. Yes?

Correct.

The following is my solution…

image

1 Like