mirror of
https://github.com/MirrorNetworking/Mirror.git
synced 2024-11-18 02:50:32 +00:00
breaking: NetworkServer.tickRate and .tickInterval, set from exposed NetworkManager.serverTickInterval.
prepares for NetworkClient time interpolation
This commit is contained in:
parent
47bd10f237
commit
c940963779
@ -45,8 +45,8 @@ public class NetworkManager : MonoBehaviour
|
||||
// send interval is 1 / sendRate.
|
||||
// but for tests we need a way to set it to exactly 0.
|
||||
// 1 / int.max would not be exactly 0, so handel that manually.
|
||||
public float serverTickInterval =>
|
||||
serverTickRate < int.MaxValue ? 1f / serverTickRate : 0; // for 30 Hz, that's 33ms
|
||||
[Obsolete("NetworkManager.serverTickInterval was moved to NetworkServer.tickInterval for consistency.")]
|
||||
public float serverTickInterval => NetworkServer.tickInterval;
|
||||
|
||||
/// <summary>Automatically switch to this scene upon going offline (on start / on disconnect / on shutdown).</summary>
|
||||
[Header("Scene Management")]
|
||||
@ -244,6 +244,9 @@ void SetupServer()
|
||||
authenticator.OnServerAuthenticated.AddListener(OnServerAuthenticated);
|
||||
}
|
||||
|
||||
// copy exposed settings to static NetworkServer
|
||||
NetworkServer.tickRate = serverTickRate;
|
||||
|
||||
ConfigureHeadlessFrameRate();
|
||||
|
||||
// start listening to network connections
|
||||
|
@ -12,6 +12,19 @@ public static partial class NetworkServer
|
||||
static bool initialized;
|
||||
public static int maxConnections;
|
||||
|
||||
/// <summary>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.</summary>
|
||||
// overwritten by NetworkManager (if any)
|
||||
public static int tickRate = 30;
|
||||
|
||||
// tick rate is in Hz.
|
||||
// convert to interval in seconds for convenience where needed.
|
||||
//
|
||||
// send interval is 1 / sendRate.
|
||||
// but for tests we need a way to set it to exactly 0.
|
||||
// 1 / int.max would not be exactly 0, so handel that manually.
|
||||
public static float tickInterval =>
|
||||
tickRate < int.MaxValue ? 1f / tickRate : 0; // for 30 Hz, that's 33ms
|
||||
|
||||
/// <summary>Connection to host mode client (if any)</summary>
|
||||
public static NetworkConnectionToClient localConnection { get; private set; }
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user