Download

Locomotion with root motion through client and sever

I’m trying to use locomotion with root motion in my network demo. First I built a realy simple demo to test if the movement replicates fine. I simply played a move-forward animation clip with root motion in my blueprint and made the ‘Root Motion Mode’ to ‘Root Motion from Everything’. I hope both server and client would play the animation with root motion and do the movement seperately. As ‘Root Motion from Everything’ won’t send the movenent from client to server, only server will replicates the movement back to client to adjust the movement of client.
However, when I played the demo with 1 client and a dedicated server, I found that the animation in client is played in twice of the normal rate. How could that happen? My UE4 version is 4.23

I print the delta time in ‘Blueprint Update Animation’ event and I found that:

  1. client tick 3 frames when server tick 1 frame.
  2. when client and server both set ‘Ignore Root Motion’, the delta time of animation blueprint matches well:
    000.png
  3. when client and server both set ‘Root Motion from Everything’, the delta time of animation blueprint does not match:
    1111.png
    It seems that the delta time of animtion is accumulated thus lead to ‘double play rate’.
    But why?

Well, I find the reason. The movement of client is delayed to send to server and will be combined with previous unsent (pending) movement. When combining, delta time is accumulated with the delta time of pending movement. Client will execute the ‘PerformMovement’ with the accumulated delta time.