Improbable Icon

Server Authorative movement design and ask



Long ask about server authorative and movement of charactere controller :

Attached ressources :

Until now, was simply transmit position and interpolation between two position tick.
was easy, but will be more complicate to have precise simulation of movement, specially with gravity
so (after reading a lot of stuff), still got some issue.
Now, i send a vector of direction and rotation of the charactere over the network
(for a charactereController on unity, with Move function).
if my tickrate is “infinite”, mean everyframe we send all the input, it work perfectly, even in bad network condition
the client sim fit always with the server sim(modifié)
but, if i add a “updaterate” systeme, like send and receive position only every 100ms.
(the RTT if i’m correct)
starting to be tricky, and don’t know exactly how to handle this
should i :
A) send a big package with all the input was push in ? (and looking like it will be hard to simulate the movement of the player with this solution)
B) send press and release button ? (but looking same issue above, adding the fact if there is a variable ping, it can lead to bad sim on server)
and if i send all the position, or button, this don’t gonna be too heavy ?

and for the end, my last idea and probably the simple :

Don’t go with CC, but with a simple kinematic rigidbody. Let input (of movement ofc) to the client who only send position at regulary intervals.
we receive position on the server, check the speed and interpolate, checking also walls
we never send back position to the authorative client, only if a movement is impossible (to high speed).
if there is a desync, or a sim mismatch, we handle the case with the check of the speed.
with this, we don’t need to store position (only the last), and should handle many case, it’s just a (bit more) permissive for cheating (even with a check of the path, in some case, people we be able to TP behind a wall.
What do you think about this last idea ? thanks.


Hi @Aherys!

If I understand correctly, you are planning to let the Client be authoritative over its position? I would advise against it, as this opens up various possibilities for cheating - the client could just filter out server’s complaints about an impossible position update and thus be able to teleport around. However, if you follow Gabriel’s advice and do real-time local position updates while leaving the Spatial client entity’s position authority up to the Server, you still get smooth movement but cheating becomes much more difficult.

Could you please go into more detail with your concerns when it comes to this approach? Are you worried that it will be difficult to simulate the precise movement of the player on server? If so, you could include more data in the update (say, an array of positions for every 20ms within the 100ms interval). However, it is important to remember that mostly you do not need to recreate the exact client movement but just have it precise enough to be able to register collisions, not allow impossible movement and not disallow possible movement.

You might also find this forum post with an explanation of interpolation and an example implementation useful.

I hope this helps and please let me know if I have completely misunderstood your questions!


Hi @ieva,

Yes my english is pretty poor, sorry for this :[

No, i won’t let client authorative over position. Actually i got Two component :
Entity Transform (Pos, Rot) x2 (One client worker to server worker, one server worker to client worker)
SpatialOS Position.

Client write into EntityTransform, server worker check, and if he allow the move, write into SpatialOS Position.
If the move is not allowed, the server worker have also an EntityTransform to the client (with write acl) and just send a position (who immediatly teleport the player).

About simulation : it’s not superhard to receive input and simulate them in realtime on the server. You just don’t care about “ping” issu and it’s okay. The main ask is more about how to realise the lag compensator with unity/spatialOS, cause if i understand good, you have no way to rewind physic, or make physic snapshot in unity, and spatialOS, so you can’t run a physic simulation with unity tool, and you should do your own simulation (and can be tricky). So the lowest ping player will always have a big advantage in fight (not a very bad thing, but it’s cool if we can avoid big ping advantage in a reasonable range, like under 100ms).

Thanks for the links !


I think there you nailed the reason why client-side reconciliation with physics-based movement is kind of hard in Unity. You could consider decoupling your movement from physics (almost) entirely, so that you can rewind and replay your own movement mechanics.