Namespace Coherence.Core
Classes
- NetworkTime
NetworkTime encapsulates state and functionality for client-server synchronization. Step(double) should be called during Update and FixedUpdate to increment the ClientSimulationFrame. NetworkTime can operate in two different modes: normal mode and multi-client mode. In normal mode, the NetworkTimeScale should be applied to Time.timeScale each frame. This will affect the rate at which Unity triggers FixedUpdate on all game objects, adjusting the speed of the simulation to smoothly catch up with the server clock. This works well for most applications, however, since Time.timeScale is a global property, it cannot be used to synchronize multiple clients within the same application. For these scenarios, you can use the MultiClientMode which makes NetworkTime operate differently. With MultiClientMode enabled, Step(double) will apply NetworkTimeScale internally when incrementing simulation frames and when invoking the OnFixedNetworkUpdate. In order to adapt the simulation speed in multi-client mode, all MonoBehaviour simulation code should be moved from FixedUpdate into OnFixedNetworkUpdate event handlers. When working with multiple networked scenes with multi-client mode, it is also important to trigger PhysicsScene.Simulate for each scene from their respective OnFixedNetworkUpdate.