NetworkServer: sendRate comments improved

This commit is contained in:
vis2k 2022-10-22 10:37:20 +02:00
parent b31eeb5a4f
commit 464bd365fe

View File

@ -24,9 +24,10 @@ public static partial class NetworkServer
// 1 / int.max would not be exactly 0, so handel that manually. // 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 public static float tickInterval => tickRate < int.MaxValue ? 1f / tickRate : 0; // for 30 Hz, that's 33ms
// broadcast() runs every tick. // time & value snapshot interpolation are separate.
// -> components are only synced when dirty though // -> time is interpolated globally on NetworkClient / NetworkConnection
// -> Timesnapshots are sent every sendRate // -> value is interpolated per-component, i.e. NetworkTransform.
// however, both need to be on the same send interval.
public static int sendRate => tickRate; public static int sendRate => tickRate;
public static float sendInterval => sendRate < int.MaxValue ? 1f / sendRate : 0; // for 30 Hz, that's 33ms public static float sendInterval => sendRate < int.MaxValue ? 1f / sendRate : 0; // for 30 Hz, that's 33ms
static double lastSendTime; static double lastSendTime;