How does the character class handle replication?

Hi, I’m very curios about this subject, it affect cheating and the player perceptionand and I couldn’t find the answer anywhere, so the builtin Character class using its standard node for movement ‘AddMovementInput’:

- Does simulate the movement on the client, then send the update position to the server? (cheating problems)

- Or it simulates on the client, then send the input to the server to make a simulating too, then multicast it to all others clients?

- Or it send the input to the server and the server does the simulate and send back the update position to the player and to all other clients? (perception delay problems)

Thanks in advance.

Good news! UE4’s CharacterMovementComponent does the good/best thing: the client sends its inputs to the server, and the remote client(s) and the server simulate the movement separately. The client(s) predict the movement, and the server sends authoritative information back to the client(s), and the client(s) will adjust prediction to match what the authority says it should be. It’s not trivial to cheat movement in UE4 games that use CharacterMovementComponent, because the server is running the authoritative simulation of the movement (and authoritative logic happens on the server).

You can test out what happens with movement under really bad lag situations by running console commands that will simulate lag and packet loss. Check out this answer: What commands can I use to simulate network conditions? - Multiplayer & Networking - Epic Developer Community Forums

That’s right, the local client simulates the input immediately. There isn’t any local delay on movement. But if there is a lot of lag and packet loss, there may be some stuttering when the server causes the movement to be corrected, if the predictions don’t match up (usually only happens above like 300ms ping and with some amount of packet loss).

Thanks @cancel, this is good to know. just to be very clear, the local client also simulates the movement? so it won’t feel the delay between press W to walk forward and actually see its character move forward?