diff --git a/Assets/Mirror/Core/NetworkClient.cs b/Assets/Mirror/Core/NetworkClient.cs index fdfae321d..bdfdfff21 100644 --- a/Assets/Mirror/Core/NetworkClient.cs +++ b/Assets/Mirror/Core/NetworkClient.cs @@ -20,12 +20,16 @@ public enum ConnectState /// NetworkClient with connection to server. public static partial class NetworkClient { - // send time snapshot every sendInterval. - // client may run at very high update rate for rendering. - // we don't want to send a time snapshot 120 times per second though. - // -> components are only synced when dirty though - // -> Timesnapshots are sent every sendRate - public static int sendRate = 30; + // time & value snapshot interpolation are separate. + // -> time is interpolated globally on NetworkClient / NetworkConnection + // -> value is interpolated per-component, i.e. NetworkTransform. + // however, both need to be on the same send interval. + // + // additionally, server & client need to use the same send interval. + // otherwise it's too easy to accidentally cause interpolation issues if + // a component sends with client.interval but interpolates with + // server.interval, etc. + public static int sendRate => NetworkServer.sendRate; public static float sendInterval => sendRate < int.MaxValue ? 1f / sendRate : 0; // for 30 Hz, that's 33ms static double lastSendTime; diff --git a/Assets/Mirror/Core/NetworkManager.cs b/Assets/Mirror/Core/NetworkManager.cs index 797c03e93..a2b576f86 100644 --- a/Assets/Mirror/Core/NetworkManager.cs +++ b/Assets/Mirror/Core/NetworkManager.cs @@ -49,9 +49,10 @@ public class NetworkManager : MonoBehaviour [Obsolete("NetworkManager.serverTickInterval was moved to NetworkServer.tickInterval for consistency.")] public float serverTickInterval => NetworkServer.tickInterval; - /// Server Update frequency, per second. Use around 60Hz for fast paced games like Counter-Strike to minimize latency. Use around 30Hz for games like WoW to minimize computations. Use around 1-10Hz for slow paced games like EVE. - [Tooltip("Client broadcasts 'sendRate' times per second. Use around 60Hz for fast paced games like Counter-Strike to minimize latency. Use around 30Hz for games like WoW to minimize computations. Use around 1-10Hz for slow paced games like EVE.")] - public int clientSendRate = 30; // 33 ms + // client send rate follows server send rate to avoid errors for now + /// Client Update frequency, per second. Use around 60Hz for fast paced games like Counter-Strike to minimize latency. Use around 30Hz for games like WoW to minimize computations. Use around 1-10Hz for slow paced games like EVE. + // [Tooltip("Client broadcasts 'sendRate' times per second. Use around 60Hz for fast paced games like Counter-Strike to minimize latency. Use around 30Hz for games like WoW to minimize computations. Use around 1-10Hz for slow paced games like EVE.")] + // public int clientSendRate = 30; // 33 ms /// Automatically switch to this scene upon going offline (on start / on disconnect / on shutdown). [Header("Scene Management")] @@ -328,7 +329,7 @@ void SetupClient() authenticator.OnClientAuthenticated.AddListener(OnClientAuthenticated); } - NetworkClient.sendRate = clientSendRate; + // NetworkClient.sendRate = clientSendRate; } /// Starts the client, connects it to the server with networkAddress.