I'm writing an engine with a fixed timestep, which means I can use frame number instead of time in my networking. The client frame number is slightly ahead of the server, ideally 1-2 frames for smooth input buffering (or more in the case of packet loss).
In order for the client to determine what frame number they should be on, the server updates the client with the difference between the last input frame number received from the client and the current frame on the server. Using this difference, the client knows how many frames “off” it is from where it should to be.
My current system dilates time on the client to reach the target frame, usually within 5% of real time unless there is a large gap between the current and target frame. It calculates the number of frames needed to pass at a certain speed for the target to be reached, runs those frames, then waits for the server to report the frame difference before being allowed to adjust time again. When I use tools to change my ping, the frame difference grows and then this brings the frame number back to where it should be.
I've only heard a method like this mentioned somewhere, but never seen any implementation. In my case, where it's very important that the server already has the client's input for a given frame at the time it's ready to simulate, are there better methods to deal with ping fluctuations? Is there an existing open source game I can look at to see a good implementation of this so I can fix stability issues with my own?