Got an issue with implementing some lag compensation. The server is consistently behind where the player is by about 0.1s (not including lag, which can be adjusted for).
I want to send the player’s input data for that duration (basically ‘predicting’ where they will be in 0.1s time based on their inputs).
I’ll need some way to calculate where the player will be. If the player is grounded, I can do something basic like s = ut.
If the player is moving in the air I’ll need to use something like: s = ut * 1/2at^2
Issue is, I don’t know what a is.
We’re not really dealing with lag right now though.
Even in perfect conditions the server lags behind by about 0.1s (iirc I read something about a buffer to reduce jittering).
Whatever data the player sends will always be about 0.1s ahead of the server even with 0 ping.
THIS is what I want to ““predict””.
I don’t think it’s been officially documented anywhere. I think you’re best bet is to just measure the change in horizontal velocity while airborne and holding a movement key.