when a server update arrives, the client sets the local player position back to the snapshot and replays all inputs which aren't acknowleged by the server yet.
i have got client side prediction working with this approach, but i would like to set my velocity from input and calculate the position over time, so when i press "W" my client starts moving forward until i release "W", but this way my client always gets out of sync because it takes some time to get this message to the server, so for example if i press W for about 150ms, the server simulates 153ms and on the next snapshot it causes stuttering.
what's troubling me here is that in many tutorials i read "if the client/server use shared code for their entities, prediction errors will never really occure", but in my case they always occure slightly.
i tried timestamping the inputs "in the future" and appling them for the same duration which the client tells the server but this doesn't feel right since it should be an authoritative server/client model.
how can i overcome this?
Edited by coffeecup, 03 December 2012 - 09:58 AM.