I've spent some time now messing around and just trying to learn dead reckoning and client side prediction for the fun of it. Most of what I do doesn't need it, so i've never had a need to go down the path.
I get how to predict the client and i've got a completely deterministic setup with a lockstep of 60fps for the physics on client and server. Both client and server use the same movement code, and i'm using constant velocity to reduce complexity. I also understand how to interpolate for corrections. I also have the server and client ticking at nearly the same time (as close as one can really get it).
The problem i'm having, that doesn't seem clear to me in anything I've read (i'll put links at the end to a few things), is what does the client message sync against on the server? So, for example, the client is at 0, 0, 0, with a heading of 0, 0, 1 at tick 0. At tick 5 the client presses the button to start moving forward at 40u/s and sends the message to the server. We'll say that the trip to the server takes 50ms and 50ms back. So the server gets the message at tick 8 (roughly), and here is where I am slightly lost.
The client sent the tick they pressed the button along with the position and new velocity. Does the server do:
- A. Look back at tick 5 and say "you're good b/c you were where you should be at that tick"
- B. Check against tick 8 and say "well you where at 0, 0, 0 at tick 8, so you didn't start moving until then".
It would seem with B, which is what i'm currently doing, that the server is always sending back a correction. B also has a bad side affect that when I stop, I'm almost never where the server is and the interpolation of this feels impossible to get right.
While with A, it would seem I have to redo all collisions for that object from tick 5 thru 8 on the server, but this sends less corrections and would give a smoother feel. I understand that A is used for lag compensation when firing a weapon or taking some action that would affect other entities, but is that also used for motion?
Thanks in advance for any help.