Multiplayer value didn't replicated but it works fine why?

The ‘IsProne’ variable is not replicated but it works fine, what’s the difference?

ABP’s ‘IsProne’ also not replicated.

It operates through RPC, so I don’t understand why variables need to be replicated as well.

You’re syncing it manually with a multicast.

No, of course you don’t need to do both.

The reason you might replicate it instead is so you don’t need to sync it manually. Clients can just see the value change (repnotify) and respond accordingly (play montage in this case).

the reason we RepNotify over MC is

  1. MCs can be missed and value wont work on client
  2. replication gives server authority so client cant cheat
  3. its more efficient on the network

By calling RPC, the variables are synchronized,

When using Repnotify variables without using RPC, the logic I wrote is executed.

Did I understand this correctly?

Oh, and the replicated variable needs to be run on the server.

And there are two ways to propagate to clients: Multicast and RepNotify, right?

correct, set the variable on server with notify, this will automatically create an OnRep function. inside that function call any logic you may need.

not to confuse things further but you have an interesting case
the Montage could be Multicast since its a non-essential event but that IsProne state needs to be replicated.

the difference is, if a player joins late or becomes relevant late, do you want the actor to player the montage or just already be in the prone state.

1 Like

Not sure I understand your new questions properly sorry, but this is my best effort based on what I think you mean:

If you replicate the variable you would need to adjust things, Prone_Server should obviously not call Prone_Multi, and should instead just set the variable. Then instead of Prone_Multi, you would do the Is Prone check and montage playing in the repnotify function, but with montages swapped around (because you are reading the just updated Is Prone now). Of course, drop the delay and sets.

The variable needs to change on the server to be replicated, yes. So the Server RPC is essential, replication is a one way street (Server → Clients), getting the server to do something a client wants always needs an RPC.

The point Auran just raised is the ‘killer application’ here I think, by doing this with a multicast anyone who comes along later will see you prone character standing, because they never got the multicast; using replication the engine will take care of all (in this case, replicating the changed values to the newcomer immediately).

1 Like

Thank you both! :+1::+1:

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.