How do I reconcile discrepancies between client side prediction and my authoritative server?

My problem is with my client side prediction system. Right now I’m using photon to do my networking and I’m using the master client as the server.

When I start to move everything seems to work fine but over time the simulation on the server and the predicted movement on the client de-sync. I tried just using a lerp to move the client back to the last known good state but the de-sync happens so often that the jitter makes the game unplayable.

Both the client and server use the exact same commands for translation, physics have been disabled, and the server receives the players inputs via a buffered RPC call so I’m not sure why the simulation would be different even with packet loss. Any help with this is greatly appreciated as I’m pretty well stuck on this one.

The simulation is different because the commands reach each system at a different time.

Have a look at

http://developer.valvesoftware.com/wiki/Source_Multiplayer_Networking

and this series of articles:

for a deeper understanding of your problem and ideas how to fix the problem.