Networking Animation Client Side Prediction

I’ve been working on getting animations networked and I’ve been seeing instruction to do the following:

  • client presses jump button
  • clientSidePlayer triggers server side event
  • lag starts here
  • server receives jump button request then multicasts button press to all clients, setting the “isJumping” flag
  • client receives response from server
  • lag ends here
  • client jumps

This works well but i feel like i’m doing things wrong. Shouldn’t it be something like this:

  • client presses jump button
  • client triggers server side event ++ while initiating a jump on the client’s screen (assuming the server will agree that this is correct)
  • server receives jump button request then multicasts button press to all clients, setting the “isJumping” flag
  • client receives response from server ++ rewinding in time and replaying the events, lerping to the correct animation frame and position as needed

Almost everything i am seeing online is instructing me to introduce visible lag by having the client be more or less a dumb terminal sending key strokes to the server. Any advice on how to move forward correctly?

I’d appreciate any thoughts, thanks for reading!

You can introduce after each step (screen that you provide) ‘local’ set. Client send req. to the server and set it local to. Server send multicast but also set it at server to. Multicast is just ‘confirm’ of this. This cost you extra steps, but you get much better responses times.

Thank you for the response @Jaco001 I also found for anyone else that stumbles upon this that the Character Movement component more or less implements the motion of characters in a replayable manner and through modifying the source code it is possible (though a bit of an endeavor) to extend the functionality and replay various kinds of actions. Unreal is a powerful tool

Client-side prediction is quite literally executing inputs locally, RPC’ing the server to do them authoritatively, then comparing each sims results. Server being the auth, its results are correct. Thus when an prediction error occurs, the client updates to the servers result.

CMC already has client-side prediction implemented for its base actions/inputs.

1 Like

I’m going to familiarize myself with the Character Movement Component and become better at using the built in tools to do what I need them to do. Thank you @Rev0verDrive for the link and info

In your other thread on variable replication, the example I posted is in a way client-side prediction.