Server/client: what's the proper way to synchronize movement?

Hi,

My game is networked and i need to sync movement between server and clients.

When i replicate movement with SetReplicateMovement(true), the movement is all choppy on clients.

As i need a smooth motion on clients, i disabled movement replication -SetReplicateMovement(false)- and instead i replicate only the destination and let each client take care of the movement (displacement + animation) locally in its Tick function.

It works well, but i can’t stop wondering what the use of movement replication if it can’t be used for movement ? Or am i missing something ?

What would be the correct way to smoothly sync motion between server and client ?

Thanks !

Cedric

PS: i’m using Pawns, not Characters, so no Movement Component here.

There is no “correct” way to sync movement I guess that is why replicate movement only checks if an actor has moved on the server and replicates its new position to the client and leaves the interpolation, reconciliation, simulation and prediction to the programmer.

If you study the movement component you can see how much code is actually involved in making everything appear almost instant.

The local client is using direct input from the player so that the player don’t notice his input lag.
The server is predicting and verifying a new valid position for the client while
other clients get a simulated movement between ticks.

This is a very simple overview but it is not so simple to implement.
For example if hit detection is important the server needs to rewind what happened on both clients screens and use timings to figure out who shot first.

GarnerP57,

Thanks for your answer.

I don’t need fast sync, it’s not a reflexe based game, i don’t mind a few extra ms.

In case anyone bumps into this thread, in the mean time, i also came across this very well documented post:

As far as my needs are concerned, i don’t think i need the movement component (i already reproduce a very basic one -replicated destination managed in Tick function- with some extra specific features i need and are not present in the MC), so i’m gonna stick to what i do, knowing i’m not missing some huge hidden secret :slight_smile:

Thanks !

Cedric