I noticed that
PhotonNetwork.Time can stay unchanged for several
FixedUpdate() calls (sometimes up to 10-15 in a row). It seems to be odd because all the interpolation algorithms I've seen so far seem to rely on the fact that time has to be different in every
FixedUpdate() and they use
PhotonNetwork.Time to calculate interpolation time in every
FixedUpdate() call to move the object smoothly. It looks unreasonable to waste computer resources to calculate the same interpolation values when
PhotonNetwork.Time remains the same and it also makes smooth movement difficult to achieve.
I'm curious, what is the best practice to handle this situation, or IOW is there a way to calculate interpolations correctly (for smooth movement) in every update method call?
I tried to create a custom variable that is initialized by the initial
PhotonNetwork.Time and then in each
FixedUpdate() method call I increase it by
Time.fixedDeltaTime (usually, it's
0.02 sec). I expected that my custom time counter wouldn't diverge from the server very much (since the time should flow equally on both sides). But the test showed that the discrepancy after 15 mins time does exceed
0.8 (time goes faster on the server) so, I have doubts that this method would be correct.
I also tried to keep initial delta:
_deltaTime = PhotonNetwork.Time - Time.time; to calculate custom server time
Time.time + _deltaServerTime which worked more accurately but still insufficiently, so after 40 mins I had a discrepancy of
0.8 sec as well.