@@ -13,32 +13,20 @@ namespace Unity.Netcode.RuntimeTests
1313 /// clock that the state updates it is interpolating between are stamped on.
1414 /// </summary>
1515 /// <remarks>
16- /// A <see cref="NetworkTransform"/> state's SentTime is derived from its NetworkTick, which is a server
17- /// tick, so the render time has to be measured from ServerTime. Measuring it from LocalTime mixes two
18- /// clocks: LocalTime leads ServerTime, so subtracting the tick latency from LocalTime lands the render time
19- /// back at approximately ServerTime rather than a whole tick latency behind it. The interpolator is then
20- /// asked to render a point in time at (or ahead of) the newest state that can possibly exist, so it has
21- /// nothing left to interpolate towards.
22- ///
23- /// What this test measures is how far behind ServerTime the state currently being interpolated towards was
24- /// sent. Because the target is selected against the render time, this has to be at least the tick latency:
25- /// the render time is ServerTime minus the tick latency, and only states sent at or before the render time
26- /// are eligible. Deriving the render time from LocalTime instead eats into that margin by however far the
27- /// two clocks are apart, and can push the target past ServerTime entirely (a negative value below, meaning
28- /// the interpolator is chasing a state that the server clock says has not happened yet).
16+ /// Measures how far behind ServerTime the state being interpolated towards was sent. The render time is
17+ /// ServerTime minus the tick latency and only states sent at or before it are eligible, so that measurement
18+ /// can never be less than the tick latency. Deriving the render time from LocalTime eats into that margin by
19+ /// however far the two clocks are apart, and can push the target past ServerTime entirely.
2920 /// </remarks>
3021 [ TestFixture ( HostOrServer . Host , NetworkTransform . InterpolationTypes . Lerp ) ]
3122 [ TestFixture ( HostOrServer . Host , NetworkTransform . InterpolationTypes . SmoothDampening ) ]
3223 internal class NetworkTransformInterpolationRenderTimeTests : IntegrationTestWithApproximation
3324 {
3425 protected override int NumberOfClients => 1 ;
3526
36- // How far LocalTime is pushed ahead of ServerTime, in ticks. An in-process integration test has
37- // effectively no round trip time and the separation between the two clocks is
38- // (half RTT + LocalBufferSec + ServerBufferSec), so without widening the local buffer the two clocks
39- // sit close enough together that which one is used barely shows. This is deliberately large enough to
40- // exceed NetworkTimeSystem's hard reset threshold (0.2s) so the offset snaps rather than converging at
41- // the default adjustment ratio of 0.01s per second, which would take over ten seconds.
27+ // How far LocalTime is pushed ahead of ServerTime, in ticks. An in-process test has no round trip time
28+ // to separate the two clocks, and this is large enough to exceed NetworkTimeSystem's hard reset
29+ // threshold so the offset snaps instead of converging at its default adjustment ratio.
4230 private const int k_LocalBufferTicks = 12 ;
4331
4432 // The separation the clocks must actually reach before any measurement is taken.
@@ -47,11 +35,10 @@ internal class NetworkTransformInterpolationRenderTimeTests : IntegrationTestWit
4735 // Ticks of authority motion after the clocks have separated, so the interpolator reaches steady state.
4836 private const int k_WarmUpTicks = 20 ;
4937
50- // The number of rendered frames sampled once the warm up has completed.
5138 private const int k_SampledFrames = 90 ;
5239
53- // The distance the authority moves each tick. Large enough that every tick produces a state update
54- // rather than being filtered out by the position threshold.
40+ // Far enough each tick that every tick produces a state update rather than being filtered out by the
41+ // position threshold.
5542 private const float k_DistancePerTick = 1.37f ;
5643
5744 private readonly NetworkTransform . InterpolationTypes m_InterpolationType ;
@@ -223,9 +210,7 @@ public IEnumerator RenderTimeTrailsTheServerClock()
223210 var meanBuffered = totalBuffered [ instance ] / ( float ) samples [ instance ] ;
224211 var tickLatency = networkManager . NetworkTimeSystem . TickLatency ;
225212
226- // Only states sent at or before the render time are eligible to be interpolated towards, and the
227- // render time is the server clock minus the tick latency, so the target can never be newer than
228- // that. Anything less means the render time was taken from a clock that runs ahead of the one
213+ // Anything less than the tick latency means the render time came from a clock that leads the one
229214 // the states are stamped on.
230215 Assert . GreaterOrEqual ( meanTargetLagTicks , tickLatency ,
231216 $ "[{ m_InterpolationType } ] { instance . name } was interpolating towards a state sent " +
0 commit comments