breaking: NetworkClient removed old snapshot interpolation settings which are now in snapshotSettings.*

This commit is contained in:
mischa 2024-10-08 16:08:36 +02:00
parent 6f4cc8ed24
commit f61e85e0e7

View File

@ -39,8 +39,6 @@ public static partial class NetworkClient
internal static double localTimescale = 1; internal static double localTimescale = 1;
// catchup ///////////////////////////////////////////////////////////// // catchup /////////////////////////////////////////////////////////////
// we use EMA to average the last second worth of snapshot time diffs. // we use EMA to average the last second worth of snapshot time diffs.
// manually averaging the last second worth of values with a for loop // manually averaging the last second worth of values with a for loop
// would be the same, but a moving average is faster because we only // would be the same, but a moving average is faster because we only
@ -48,31 +46,16 @@ public static partial class NetworkClient
static ExponentialMovingAverage driftEma; static ExponentialMovingAverage driftEma;
// dynamic buffer time adjustment ////////////////////////////////////// // dynamic buffer time adjustment //////////////////////////////////////
// dynamically adjusts bufferTimeMultiplier for smooth results. // DEPRECATED 2024-10-08
// to understand how this works, try this manually: [Obsolete("NeworkClient.dynamicAdjustment was moved to NetworkClient.snapshotSettings.dynamicAdjustment")]
// public static bool dynamicAdjustment => snapshotSettings.dynamicAdjustment;
// - disable dynamic adjustment // DEPRECATED 2024-10-08
// - set jitter = 0.2 (20% is a lot!) [Obsolete("NeworkClient.dynamicAdjustmentTolerance was moved to NetworkClient.snapshotSettings.dynamicAdjustmentTolerance")]
// - notice some stuttering public static float dynamicAdjustmentTolerance => snapshotSettings.dynamicAdjustmentTolerance;
// - disable interpolation to see just how much jitter this really is(!) // DEPRECATED 2024-10-08
// - enable interpolation again [Obsolete("NeworkClient.dynamicAdjustment was moved to NetworkClient.snapshotSettings.dynamicAdjustment")]
// - manually increase bufferTimeMultiplier to 3-4 public static int deliveryTimeEmaDuration => snapshotSettings.deliveryTimeEmaDuration;
// ... the cube slows down (blue) until it's smooth
// - with dynamic adjustment enabled, it will set 4 automatically
// ... the cube slows down (blue) until it's smooth as well
//
// note that 20% jitter is extreme.
// for this to be perfectly smooth, set the safety tolerance to '2'.
// but realistically this is not necessary, and '1' is enough.
[Header("Snapshot Interpolation: Dynamic Adjustment")]
[Tooltip("Automatically adjust bufferTimeMultiplier for smooth results.\nSets a low multiplier on stable connections, and a high multiplier on jittery connections.")]
public static bool dynamicAdjustment = true;
[Tooltip("Safety buffer that is always added to the dynamic bufferTimeMultiplier adjustment.")]
public static float dynamicAdjustmentTolerance = 1; // 1 is realistically just fine, 2 is very very safe even for 20% jitter. can be half a frame too. (see above comments)
[Tooltip("Dynamic adjustment is computed over n-second exponential moving average standard deviation.")]
public static int deliveryTimeEmaDuration = 2; // 1-2s recommended to capture average delivery time
static ExponentialMovingAverage deliveryTimeEma; // average delivery time (standard deviation gives average jitter) static ExponentialMovingAverage deliveryTimeEma; // average delivery time (standard deviation gives average jitter)
// OnValidate: see NetworkClient.cs // OnValidate: see NetworkClient.cs