I have been trying to understand how the replication system works in Unreal Engine for a week now and when I am convinced that I understand it I cannot implement it in the blueprints.
Can anyone tell me how I can deal with this blueprint? Thanks in advance!
I don’t see any replication in your code
Generally the replication flow of these things is always kinda the same :
-
Listen for input (only on the controlling client machine, obviously)
-
Simulate movement on controlling client machine
-
Send RPC (remote procedure call = replicated function) to server so the server can apply movement as well
-
Replicate info to other clients so they can apply movement on your character as well
So in your specific case, points 1 and 2 should be ok already. Now you need to tell server to start/stop sprinting, so the server can update desired speed too. And then you need to replicate that to the clients.
Something to that effect :
With ServerSprint replication enabled :
And DesiredSpeed replication enabled :
Yes, in fact, I explained myself incorrectly, what I meant is that I didn’t know where to start to replicate the system on the network, thanks a lot for the answer! As soon as I can I will try to implement it in the blueprint and I will try to take inspiration from it to do it for all the other mechanics, for example if I want to replicate on the network the head tilt used in the Animation Blueprint is it practically the same thing?
Input → Set Client Variable → Server Function → Set Server Variable
?
Thanks again!