mirror of
https://github.com/MirrorNetworking/Mirror.git
synced 2024-11-17 18:40:33 +00:00
breaking: SnapshotInterpolation.Compute(): add 'out catchup' for debugging
This commit is contained in:
parent
6de039cf9d
commit
e04293f980
@ -398,7 +398,8 @@ void UpdateServer()
|
||||
bufferTime, serverBuffer,
|
||||
catchupThreshold, catchupMultiplier,
|
||||
Interpolate,
|
||||
out NTSnapshot computed))
|
||||
out NTSnapshot computed,
|
||||
out _))
|
||||
{
|
||||
NTSnapshot start = serverBuffer.Values[0];
|
||||
NTSnapshot goal = serverBuffer.Values[1];
|
||||
@ -487,7 +488,8 @@ void UpdateClient()
|
||||
bufferTime, clientBuffer,
|
||||
catchupThreshold, catchupMultiplier,
|
||||
Interpolate,
|
||||
out NTSnapshot computed))
|
||||
out NTSnapshot computed,
|
||||
out _))
|
||||
{
|
||||
NTSnapshot start = clientBuffer.Values[0];
|
||||
NTSnapshot goal = clientBuffer.Values[1];
|
||||
@ -645,7 +647,7 @@ protected virtual void OnValidate()
|
||||
// buffer limit should be at least multiplier to have enough in there
|
||||
bufferSizeLimit = Mathf.Max(bufferTimeMultiplier, bufferSizeLimit);
|
||||
}
|
||||
|
||||
|
||||
public override bool OnSerialize(NetworkWriter writer, bool initialState)
|
||||
{
|
||||
// sync target component's position on spawn.
|
||||
|
@ -151,6 +151,7 @@ public static void GetFirstSecondAndDelta<T>(SortedList<double, T> buffer, out T
|
||||
// => needs to be Func<T> instead of a function in the Snapshot
|
||||
// interface because that would require boxing.
|
||||
// => make sure to only allocate that function once.
|
||||
// out catchup: useful for debugging only.
|
||||
//
|
||||
// returns
|
||||
// 'true' if it spit out a snapshot to apply.
|
||||
@ -164,7 +165,8 @@ public static bool Compute<T>(
|
||||
int catchupThreshold,
|
||||
float catchupMultiplier,
|
||||
Func<T, T, double, T> Interpolate,
|
||||
out T computed)
|
||||
out T computed,
|
||||
out double catchup)
|
||||
where T : Snapshot
|
||||
{
|
||||
// we buffer snapshots for 'bufferTime'
|
||||
@ -183,7 +185,7 @@ public static bool Compute<T>(
|
||||
// with high latency
|
||||
// -> at any given time, we are interpolating from snapshot A to B
|
||||
// => seems like A.timestamp += deltaTime is a good way to do it
|
||||
|
||||
catchup = 0;
|
||||
computed = default;
|
||||
//Debug.Log($"{name} snapshotbuffer={buffer.Count}");
|
||||
|
||||
@ -201,7 +203,7 @@ public static bool Compute<T>(
|
||||
//
|
||||
// if '0' catchup then we multiply by '1', which changes nothing.
|
||||
// (faster branch prediction)
|
||||
double catchup = CalculateCatchup(buffer, catchupThreshold, catchupMultiplier);
|
||||
catchup = CalculateCatchup(buffer, catchupThreshold, catchupMultiplier);
|
||||
deltaTime *= (1 + catchup);
|
||||
|
||||
// interpolationTime starts at 0 and we add deltaTime to move
|
||||
|
@ -240,7 +240,7 @@ public void Compute_Step1_DefaultDoesNothing()
|
||||
float bufferTime = 0;
|
||||
int catchupThreshold = Int32.MaxValue;
|
||||
float catchupMultiplier = 0;
|
||||
bool result = SnapshotInterpolation.Compute(localTime, deltaTime, ref interpolationTime, bufferTime, buffer, catchupThreshold, catchupMultiplier, SimpleSnapshot.Interpolate, out SimpleSnapshot computed);
|
||||
bool result = SnapshotInterpolation.Compute(localTime, deltaTime, ref interpolationTime, bufferTime, buffer, catchupThreshold, catchupMultiplier, SimpleSnapshot.Interpolate, out SimpleSnapshot computed, out _);
|
||||
|
||||
// should not spit out any snapshot to apply
|
||||
Assert.That(result, Is.False);
|
||||
@ -273,7 +273,7 @@ public void Compute_Step3_WaitsUntilBufferTime()
|
||||
float bufferTime = 2;
|
||||
int catchupThreshold = Int32.MaxValue;
|
||||
float catchupMultiplier = 0;
|
||||
bool result = SnapshotInterpolation.Compute(localTime, deltaTime, ref interpolationTime, bufferTime, buffer, catchupThreshold, catchupMultiplier, SimpleSnapshot.Interpolate, out SimpleSnapshot computed);
|
||||
bool result = SnapshotInterpolation.Compute(localTime, deltaTime, ref interpolationTime, bufferTime, buffer, catchupThreshold, catchupMultiplier, SimpleSnapshot.Interpolate, out SimpleSnapshot computed, out _);
|
||||
|
||||
// should not spit out any snapshot to apply
|
||||
Assert.That(result, Is.False);
|
||||
@ -301,7 +301,7 @@ public void Compute_Step3_WaitsForSecondSnapshot()
|
||||
float bufferTime = 1;
|
||||
int catchupThreshold = Int32.MaxValue;
|
||||
float catchupMultiplier = 0;
|
||||
bool result = SnapshotInterpolation.Compute(localTime, deltaTime, ref interpolationTime, bufferTime, buffer, catchupThreshold, catchupMultiplier, SimpleSnapshot.Interpolate, out SimpleSnapshot computed);
|
||||
bool result = SnapshotInterpolation.Compute(localTime, deltaTime, ref interpolationTime, bufferTime, buffer, catchupThreshold, catchupMultiplier, SimpleSnapshot.Interpolate, out SimpleSnapshot computed, out _);
|
||||
|
||||
// should not spit out any snapshot to apply
|
||||
Assert.That(result, Is.False);
|
||||
@ -334,7 +334,7 @@ public void Compute_Step4_InterpolateWithTwoOldEnoughSnapshots()
|
||||
float bufferTime = 2;
|
||||
int catchupThreshold = Int32.MaxValue;
|
||||
float catchupMultiplier = 0;
|
||||
bool result = SnapshotInterpolation.Compute(localTime, deltaTime, ref interpolationTime, bufferTime, buffer, catchupThreshold, catchupMultiplier, SimpleSnapshot.Interpolate, out SimpleSnapshot computed);
|
||||
bool result = SnapshotInterpolation.Compute(localTime, deltaTime, ref interpolationTime, bufferTime, buffer, catchupThreshold, catchupMultiplier, SimpleSnapshot.Interpolate, out SimpleSnapshot computed, out _);
|
||||
|
||||
// should spit out the interpolated snapshot
|
||||
Assert.That(result, Is.True);
|
||||
@ -371,7 +371,7 @@ public void Compute_Step4_InterpolateWithThreeOldEnoughSnapshots()
|
||||
float bufferTime = 2;
|
||||
int catchupThreshold = Int32.MaxValue;
|
||||
float catchupMultiplier = 0;
|
||||
bool result = SnapshotInterpolation.Compute(localTime, deltaTime, ref interpolationTime, bufferTime, buffer, catchupThreshold, catchupMultiplier, SimpleSnapshot.Interpolate, out SimpleSnapshot computed);
|
||||
bool result = SnapshotInterpolation.Compute(localTime, deltaTime, ref interpolationTime, bufferTime, buffer, catchupThreshold, catchupMultiplier, SimpleSnapshot.Interpolate, out SimpleSnapshot computed, out _);
|
||||
|
||||
// should spit out the interpolated snapshot
|
||||
Assert.That(result, Is.True);
|
||||
@ -408,7 +408,7 @@ public void Compute_Step4_InterpolateAfterLongPause()
|
||||
float bufferTime = 2;
|
||||
int catchupThreshold = Int32.MaxValue;
|
||||
float catchupMultiplier = 0;
|
||||
bool result = SnapshotInterpolation.Compute(localTime, deltaTime, ref interpolationTime, bufferTime, buffer, catchupThreshold, catchupMultiplier, SimpleSnapshot.Interpolate, out SimpleSnapshot computed);
|
||||
bool result = SnapshotInterpolation.Compute(localTime, deltaTime, ref interpolationTime, bufferTime, buffer, catchupThreshold, catchupMultiplier, SimpleSnapshot.Interpolate, out SimpleSnapshot computed, out _);
|
||||
|
||||
// should spit out the interpolated snapshot
|
||||
Assert.That(result, Is.True);
|
||||
@ -458,7 +458,7 @@ public void Compute_Step4_InterpolateWithCatchup()
|
||||
double deltaTime = 0.5;
|
||||
double interpolationTime = 0;
|
||||
float bufferTime = 2;
|
||||
bool result = SnapshotInterpolation.Compute(localTime, deltaTime, ref interpolationTime, bufferTime, buffer, catchupThreshold, catchupMultiplier, SimpleSnapshot.Interpolate, out SimpleSnapshot computed);
|
||||
bool result = SnapshotInterpolation.Compute(localTime, deltaTime, ref interpolationTime, bufferTime, buffer, catchupThreshold, catchupMultiplier, SimpleSnapshot.Interpolate, out SimpleSnapshot computed, out _);
|
||||
|
||||
// should spit out the interpolated snapshot
|
||||
Assert.That(result, Is.True);
|
||||
@ -519,7 +519,7 @@ public void Compute_Step5_OvershootWithoutEnoughSnapshots()
|
||||
float bufferTime = 2;
|
||||
int catchupThreshold = Int32.MaxValue;
|
||||
float catchupMultiplier = 0;
|
||||
bool result = SnapshotInterpolation.Compute(localTime, deltaTime, ref interpolationTime, bufferTime, buffer, catchupThreshold, catchupMultiplier, SimpleSnapshot.Interpolate, out SimpleSnapshot computed);
|
||||
bool result = SnapshotInterpolation.Compute(localTime, deltaTime, ref interpolationTime, bufferTime, buffer, catchupThreshold, catchupMultiplier, SimpleSnapshot.Interpolate, out SimpleSnapshot computed, out _);
|
||||
|
||||
// should spit out the interpolated snapshot
|
||||
Assert.That(result, Is.True);
|
||||
@ -587,7 +587,7 @@ public void Compute_Step5_OvershootWithEnoughSnapshots_NextIsntOldEnough()
|
||||
float bufferTime = 2;
|
||||
int catchupThreshold = Int32.MaxValue;
|
||||
float catchupMultiplier = 0;
|
||||
bool result = SnapshotInterpolation.Compute(localTime, deltaTime, ref interpolationTime, bufferTime, buffer, catchupThreshold, catchupMultiplier, SimpleSnapshot.Interpolate, out SimpleSnapshot computed);
|
||||
bool result = SnapshotInterpolation.Compute(localTime, deltaTime, ref interpolationTime, bufferTime, buffer, catchupThreshold, catchupMultiplier, SimpleSnapshot.Interpolate, out SimpleSnapshot computed, out _);
|
||||
|
||||
// should still spit out a result between first & second.
|
||||
Assert.That(result, Is.True);
|
||||
@ -647,7 +647,7 @@ public void Compute_Step5_OvershootWithEnoughSnapshots_MovesToNextSnapshotIfOldE
|
||||
float bufferTime = 2;
|
||||
int catchupThreshold = Int32.MaxValue;
|
||||
float catchupMultiplier = 0;
|
||||
bool result = SnapshotInterpolation.Compute(localTime, deltaTime, ref interpolationTime, bufferTime, buffer, catchupThreshold, catchupMultiplier, SimpleSnapshot.Interpolate, out SimpleSnapshot computed);
|
||||
bool result = SnapshotInterpolation.Compute(localTime, deltaTime, ref interpolationTime, bufferTime, buffer, catchupThreshold, catchupMultiplier, SimpleSnapshot.Interpolate, out SimpleSnapshot computed, out _);
|
||||
|
||||
// should spit out the interpolated snapshot
|
||||
Assert.That(result, Is.True);
|
||||
@ -703,7 +703,7 @@ public void Compute_Step5_OvershootWithEnoughSnapshots_2x_MovesToSecondNextSnaps
|
||||
float bufferTime = 2;
|
||||
int catchupThreshold = Int32.MaxValue;
|
||||
float catchupMultiplier = 0;
|
||||
bool result = SnapshotInterpolation.Compute(localTime, deltaTime, ref interpolationTime, bufferTime, buffer, catchupThreshold, catchupMultiplier, SimpleSnapshot.Interpolate, out SimpleSnapshot computed);
|
||||
bool result = SnapshotInterpolation.Compute(localTime, deltaTime, ref interpolationTime, bufferTime, buffer, catchupThreshold, catchupMultiplier, SimpleSnapshot.Interpolate, out SimpleSnapshot computed, out _);
|
||||
|
||||
// should spit out the interpolated snapshot
|
||||
Assert.That(result, Is.True);
|
||||
|
@ -2,14 +2,14 @@
|
||||
"dependencies": {
|
||||
"com.unity.2d.sprite": "1.0.0",
|
||||
"com.unity.2d.tilemap": "1.0.0",
|
||||
"com.unity.ide.rider": "2.0.7",
|
||||
"com.unity.ide.visualstudio": "2.0.12",
|
||||
"com.unity.ide.vscode": "1.2.4",
|
||||
"com.unity.test-framework": "1.1.30",
|
||||
"com.unity.testtools.codecoverage": "1.0.0",
|
||||
"com.unity.ide.rider": "3.0.13",
|
||||
"com.unity.ide.visualstudio": "2.0.14",
|
||||
"com.unity.ide.vscode": "1.2.5",
|
||||
"com.unity.test-framework": "1.1.31",
|
||||
"com.unity.testtools.codecoverage": "1.0.1",
|
||||
"com.unity.textmeshpro": "3.0.6",
|
||||
"com.unity.ugui": "1.0.0",
|
||||
"com.unity.xr.legacyinputhelpers": "2.1.8",
|
||||
"com.unity.xr.legacyinputhelpers": "2.1.9",
|
||||
"com.unity.modules.ai": "1.0.0",
|
||||
"com.unity.modules.androidjni": "1.0.0",
|
||||
"com.unity.modules.animation": "1.0.0",
|
||||
|
@ -20,16 +20,16 @@
|
||||
"url": "https://packages.unity.com"
|
||||
},
|
||||
"com.unity.ide.rider": {
|
||||
"version": "2.0.7",
|
||||
"version": "3.0.13",
|
||||
"depth": 0,
|
||||
"source": "registry",
|
||||
"dependencies": {
|
||||
"com.unity.test-framework": "1.1.1"
|
||||
"com.unity.ext.nunit": "1.0.6"
|
||||
},
|
||||
"url": "https://packages.unity.com"
|
||||
},
|
||||
"com.unity.ide.visualstudio": {
|
||||
"version": "2.0.12",
|
||||
"version": "2.0.14",
|
||||
"depth": 0,
|
||||
"source": "registry",
|
||||
"dependencies": {
|
||||
@ -38,21 +38,21 @@
|
||||
"url": "https://packages.unity.com"
|
||||
},
|
||||
"com.unity.ide.vscode": {
|
||||
"version": "1.2.4",
|
||||
"version": "1.2.5",
|
||||
"depth": 0,
|
||||
"source": "registry",
|
||||
"dependencies": {},
|
||||
"url": "https://packages.unity.com"
|
||||
},
|
||||
"com.unity.settings-manager": {
|
||||
"version": "1.0.1",
|
||||
"version": "1.0.3",
|
||||
"depth": 1,
|
||||
"source": "registry",
|
||||
"dependencies": {},
|
||||
"url": "https://packages.unity.com"
|
||||
},
|
||||
"com.unity.test-framework": {
|
||||
"version": "1.1.30",
|
||||
"version": "1.1.31",
|
||||
"depth": 0,
|
||||
"source": "registry",
|
||||
"dependencies": {
|
||||
@ -63,7 +63,7 @@
|
||||
"url": "https://packages.unity.com"
|
||||
},
|
||||
"com.unity.testtools.codecoverage": {
|
||||
"version": "1.0.0",
|
||||
"version": "1.0.1",
|
||||
"depth": 0,
|
||||
"source": "registry",
|
||||
"dependencies": {
|
||||
@ -91,7 +91,7 @@
|
||||
}
|
||||
},
|
||||
"com.unity.xr.legacyinputhelpers": {
|
||||
"version": "2.1.8",
|
||||
"version": "2.1.9",
|
||||
"depth": 0,
|
||||
"source": "registry",
|
||||
"dependencies": {
|
||||
|
@ -1,2 +1,2 @@
|
||||
m_EditorVersion: 2020.3.26f1
|
||||
m_EditorVersionWithRevision: 2020.3.26f1 (7298b473bc1a)
|
||||
m_EditorVersion: 2021.3.1f1
|
||||
m_EditorVersionWithRevision: 2021.3.1f1 (3b70a0754835)
|
||||
|
@ -5,6 +5,9 @@ EditorUserSettings:
|
||||
m_ObjectHideFlags: 0
|
||||
serializedVersion: 4
|
||||
m_ConfigSettings:
|
||||
RecentlyUsedSceneGuid-0:
|
||||
value: 5500060752055c0b5a590f734677084912154f287d7e71312f78486abbe13160
|
||||
flags: 0
|
||||
RecentlyUsedScenePath-0:
|
||||
value: 2242470311464676041c1e2d026c7a08171a0826293b691228271e3befe12633add435ece93f2c730a01ea3201701431fb1e10
|
||||
flags: 0
|
||||
@ -16,9 +19,13 @@ EditorUserSettings:
|
||||
m_VCDebugCmd: 0
|
||||
m_VCDebugOut: 0
|
||||
m_SemanticMergeMode: 2
|
||||
m_DesiredImportWorkerCount: 2
|
||||
m_StandbyImportWorkerCount: 2
|
||||
m_IdleImportWorkerShutdownDelay: 60000
|
||||
m_VCShowFailedCheckout: 1
|
||||
m_VCOverwriteFailedCheckoutAssets: 1
|
||||
m_VCProjectOverlayIcons: 1
|
||||
m_VCHierarchyOverlayIcons: 1
|
||||
m_VCOtherOverlayIcons: 1
|
||||
m_VCAllowAsyncUpdate: 0
|
||||
m_ArtifactGarbageCollection: 1
|
||||
|
Loading…
Reference in New Issue
Block a user