I have a fast paced multiplayer FPS game with the client running the player movement code and sending its position to the server. Obviously this is open to cheating so I want to have the player movement run on the server with the client sending only input to the server.
I have read all about client side prediction but there's still a few problems I'm not able to solve.
When I sample input and send that packet to the server, by the time the server receives it, the player simulation will have potentially moved the player to a different position than where the clients player was during that input.
One way to solve this is to send the frame time in the input packet to progress the simulation by that amount using that input. The problem with this is that it's also open to cheating, someone could speed up their client so the server simulates the player faster. I'm sure there's ways to detect that but there's still the problem of the player on the server freezing in mid-air when input isn't being received.
So to me it doesn't look like there's a perfect solution to this problem, I want the server to always simulate the player but due to packet latency, it's going to receive input at a different time than the client predicted it, resulting in constant error correction for the player.
An example of this is, imagine the client is predicting the player moving forward and then jumps, the server will be moving the player forward but the input with the jump keypress hasn't been received yet so the player on the server keeps running forward. When the input with the jump key press finally comes in, the player on the server has already ran into a hole but the client predicted that the player jumped over the hole.
Edited by laylay, 17 April 2014 - 05:19 PM.