NetworkManager: serverTickInterval for convenience (prepares for remote statistics)

This commit is contained in:
vis2k 2022-09-24 22:08:20 +07:00
parent 80abe21047
commit 6ba926bcb1

View File

@ -39,6 +39,15 @@ public class NetworkManager : MonoBehaviour
[Tooltip("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.")]
public int serverTickRate = 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 float serverTickInterval =>
serverTickRate < int.MaxValue ? 1f / serverTickRate : 0; // for 30 Hz, that's 33ms
/// <summary>Automatically switch to this scene upon going offline (on start / on disconnect / on shutdown).</summary>
[Header("Scene Management")]
[Scene]