State takes long time to sync?

I'm doing a test where I have two computers on my home LAN and in the simulation is a single network entity with a state which contains a timestamp property (which I write BoltNetwork.serverTime to whenever I update the state), as well as a number of other properties (two vectors, a quaternion and a boolean).

I have the server write to the state in every call to SimulateOwner(), and the client has a callback for when the state's timestamp changed and logs every time it does.

According to my client logging, I can see that the state is getting updated in proper regular intervals...but according to the log, the state's timestamp is regularly 300-500 milliseconds behind the current server time. That implies it took 300-500 milliseconds for the state update to get from the server to client even though the ping between them is 1 ms.

Anyone have ideas why that may be the case? My SimulationRate is 30 and Network Rate is 1. Everything else looks OK.

Comments

  • I reached out to the Photon devs and they were gracious enough to send me a test project to help me learn more about the issue. The test app worked as expected and it inspired me to tear down and rebuild my own test environment with these differences:

    Simulation Rate: 60
    Network Rate: 1
    Increased the client-side buffer which preserves previous state values from 15 to 200 states (for use in non-transform interpolations...it's a need specific to my game)
    No more logging to the Unity console...instead only logging to the Bolt console.

    I think either the last change or some other change I'm unaware of fixed the issue. Under my new test environment found myself with <1 ms of time being required to move the state from the server to the client according to the console logging (again the server and client are both on my home LAN). I then moved my state writes from SimulateOwner to MonoBehaviour.Update just to see what would happen, and the move time became 16 milliseconds. In either case the slowness appears to be resolved.

    Looks like all is well. Thanks Photon!
Sign In or Register to comment.