This repository has been archived on 2025-04-22. You can view files and clone it. You cannot open issues or pull requests or push a commit.
Files
com.unity.netcode.gameobjects/Tests/Runtime/NetworkVariableAnticipationTests.cs
Unity Technologies c813386c5c com.unity.netcode.gameobjects@2.0.0-pre.2
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

Additional documentation and release notes are available at [Multiplayer Documentation](https://docs-multiplayer.unity3d.com).

## [2.0.0-pre.2] - 2024-06-17

### Added

- Added `AnticipatedNetworkVariable<T>`, which adds support for client anticipation of `NetworkVariable` values, allowing for more responsive gameplay. (#2957)
- Added `AnticipatedNetworkTransform`, which adds support for client anticipation of NetworkTransforms. (#2957)
- Added `NetworkVariableBase.ExceedsDirtinessThreshold` to allow network variables to throttle updates by only sending updates when the difference between the current and previous values exceeds a threshold. (This is exposed in `NetworkVariable<T>` with the callback `NetworkVariable<T>.CheckExceedsDirtinessThreshold`). (#2957)
- Added `NetworkVariableUpdateTraits`, which add additional throttling support: `MinSecondsBetweenUpdates` will prevent the `NetworkVariable` from sending updates more often than the specified time period (even if it exceeds the dirtiness threshold), while `MaxSecondsBetweenUpdates` will force a dirty `NetworkVariable` to send an update after the specified time period even if it has not yet exceeded the dirtiness threshold. (#2957)
- Added virtual method `NetworkVariableBase.OnInitialize` which can be used by `NetworkVariable` subclasses to add initialization code. (#2957)
- Added `NetworkTime.TickWithPartial`, which represents the current tick as a double that includes the fractional/partial tick value. (#2957)
- Added `NetworkTickSystem.AnticipationTick`, which can be helpful with implementation of client anticipation. This value represents the tick the current local client was at at the beginning of the most recent network round trip, which enables it to correlate server update ticks with the client tick that may have triggered them. (#2957)
- Added event `NetworkManager.OnSessionOwnerPromoted` that is invoked when a new session owner promotion occurs. (#2948)
- Added `NetworkRigidBodyBase.GetLinearVelocity` and `NetworkRigidBodyBase.SetLinearVelocity` convenience/helper methods. (#2948)
- Added `NetworkRigidBodyBase.GetAngularVelocity` and `NetworkRigidBodyBase.SetAngularVelocity` convenience/helper methods. (#2948)

### Fixed

- Fixed issue when `NetworkTransform` half float precision is enabled and ownership changes the current base position was not being synchronized. (#2948)
- Fixed issue where `OnClientConnected` not being invoked on the session owner when connecting to a new distributed authority session. (#2948)
- Fixed issue where Rigidbody micro-motion (i.e. relatively small velocities) would result in non-authority instances slightly stuttering as the body would come to a rest (i.e. no motion). Now, the threshold value can increase at higher velocities and can decrease slightly below the provided threshold to account for this. (#2948)

### Changed

- Changed `NetworkAnimator` no longer requires the `Animator` component to exist on the same `GameObject`. (#2957)
- Changed `NetworkObjectReference` and `NetworkBehaviourReference` to allow null references when constructing and serializing. (#2957)
- Changed the client's owned objects is now returned (`NetworkClient` and `NetworkSpawnManager`) as an array as opposed to a list for performance purposes. (#2948)
- Changed `NetworkTransfrom.TryCommitTransformToServer` to be internal as it will be removed by the final 2.0.0 release. (#2948)
- Changed `NetworkTransformEditor.OnEnable` to a virtual method to be able to customize a `NetworkTransform` derived class by creating a derived editor control from `NetworkTransformEditor`. (#2948)
2024-06-17 00:00:00 +00:00

421 lines
21 KiB
C#

using System.Collections.Generic;
using System.Linq;
using NUnit.Framework;
using Unity.Netcode.TestHelpers.Runtime;
using UnityEngine;
using Object = UnityEngine.Object;
namespace Unity.Netcode.RuntimeTests
{
internal class NetworkVariableAnticipationComponent : NetworkBehaviour
{
public AnticipatedNetworkVariable<int> SnapOnAnticipationFailVariable = new AnticipatedNetworkVariable<int>(0, StaleDataHandling.Ignore);
public AnticipatedNetworkVariable<float> SmoothOnAnticipationFailVariable = new AnticipatedNetworkVariable<float>(0, StaleDataHandling.Reanticipate);
public AnticipatedNetworkVariable<float> ReanticipateOnAnticipationFailVariable = new AnticipatedNetworkVariable<float>(0, StaleDataHandling.Reanticipate);
public override void OnReanticipate(double lastRoundTripTime)
{
if (SmoothOnAnticipationFailVariable.ShouldReanticipate)
{
if (Mathf.Abs(SmoothOnAnticipationFailVariable.AuthoritativeValue - SmoothOnAnticipationFailVariable.PreviousAnticipatedValue) > Mathf.Epsilon)
{
SmoothOnAnticipationFailVariable.Smooth(SmoothOnAnticipationFailVariable.PreviousAnticipatedValue, SmoothOnAnticipationFailVariable.AuthoritativeValue, 1, Mathf.Lerp);
}
}
if (ReanticipateOnAnticipationFailVariable.ShouldReanticipate)
{
// Would love to test some stuff about anticipation based on time, but that is difficult to test accurately.
// This reanticipating variable will just always anticipate a value 5 higher than the server value.
ReanticipateOnAnticipationFailVariable.Anticipate(ReanticipateOnAnticipationFailVariable.AuthoritativeValue + 5);
}
}
public bool SnapRpcResponseReceived = false;
[Rpc(SendTo.Server)]
public void SetSnapValueRpc(int i, RpcParams rpcParams = default)
{
SnapOnAnticipationFailVariable.AuthoritativeValue = i;
SetSnapValueResponseRpc(RpcTarget.Single(rpcParams.Receive.SenderClientId, RpcTargetUse.Temp));
}
[Rpc(SendTo.SpecifiedInParams)]
public void SetSnapValueResponseRpc(RpcParams rpcParams)
{
SnapRpcResponseReceived = true;
}
[Rpc(SendTo.Server)]
public void SetSmoothValueRpc(float f)
{
SmoothOnAnticipationFailVariable.AuthoritativeValue = f;
}
[Rpc(SendTo.Server)]
public void SetReanticipateValueRpc(float f)
{
ReanticipateOnAnticipationFailVariable.AuthoritativeValue = f;
}
}
internal class NetworkVariableAnticipationTests : NetcodeIntegrationTest
{
protected override int NumberOfClients => 2;
protected override bool m_EnableTimeTravel => true;
protected override bool m_SetupIsACoroutine => false;
protected override bool m_TearDownIsACoroutine => false;
protected override void OnPlayerPrefabGameObjectCreated()
{
m_PlayerPrefab.AddComponent<NetworkVariableAnticipationComponent>();
}
public NetworkVariableAnticipationComponent GetTestComponent()
{
return m_ClientNetworkManagers[0].LocalClient.PlayerObject.GetComponent<NetworkVariableAnticipationComponent>();
}
public NetworkVariableAnticipationComponent GetServerComponent()
{
foreach (var obj in Object.FindObjectsByType<NetworkVariableAnticipationComponent>(FindObjectsSortMode.None))
{
if (obj.NetworkManager == m_ServerNetworkManager && obj.OwnerClientId == m_ClientNetworkManagers[0].LocalClientId)
{
return obj;
}
}
return null;
}
public NetworkVariableAnticipationComponent GetOtherClientComponent()
{
foreach (var obj in Object.FindObjectsByType<NetworkVariableAnticipationComponent>(FindObjectsSortMode.None))
{
if (obj.NetworkManager == m_ClientNetworkManagers[1] && obj.OwnerClientId == m_ClientNetworkManagers[0].LocalClientId)
{
return obj;
}
}
return null;
}
[Test]
public void WhenAnticipating_ValueChangesImmediately()
{
var testComponent = GetTestComponent();
testComponent.SnapOnAnticipationFailVariable.Anticipate(10);
testComponent.SmoothOnAnticipationFailVariable.Anticipate(15);
testComponent.ReanticipateOnAnticipationFailVariable.Anticipate(20);
Assert.AreEqual(10, testComponent.SnapOnAnticipationFailVariable.Value);
Assert.AreEqual(15, testComponent.SmoothOnAnticipationFailVariable.Value);
Assert.AreEqual(20, testComponent.ReanticipateOnAnticipationFailVariable.Value);
}
[Test]
public void WhenAnticipating_AuthoritativeValueDoesNotChange()
{
var testComponent = GetTestComponent();
testComponent.SnapOnAnticipationFailVariable.Anticipate(10);
testComponent.SmoothOnAnticipationFailVariable.Anticipate(15);
testComponent.ReanticipateOnAnticipationFailVariable.Anticipate(20);
Assert.AreEqual(0, testComponent.SnapOnAnticipationFailVariable.AuthoritativeValue);
Assert.AreEqual(0, testComponent.SmoothOnAnticipationFailVariable.AuthoritativeValue);
Assert.AreEqual(0, testComponent.ReanticipateOnAnticipationFailVariable.AuthoritativeValue);
}
[Test]
public void WhenAnticipating_ServerDoesNotChange()
{
var testComponent = GetTestComponent();
testComponent.SnapOnAnticipationFailVariable.Anticipate(10);
testComponent.SmoothOnAnticipationFailVariable.Anticipate(15);
testComponent.ReanticipateOnAnticipationFailVariable.Anticipate(20);
var serverComponent = GetServerComponent();
Assert.AreEqual(0, serverComponent.SnapOnAnticipationFailVariable.AuthoritativeValue);
Assert.AreEqual(0, serverComponent.SmoothOnAnticipationFailVariable.AuthoritativeValue);
Assert.AreEqual(0, serverComponent.ReanticipateOnAnticipationFailVariable.AuthoritativeValue);
Assert.AreEqual(0, serverComponent.SnapOnAnticipationFailVariable.Value);
Assert.AreEqual(0, serverComponent.SmoothOnAnticipationFailVariable.Value);
Assert.AreEqual(0, serverComponent.ReanticipateOnAnticipationFailVariable.Value);
TimeTravel(2, 120);
Assert.AreEqual(0, serverComponent.SnapOnAnticipationFailVariable.AuthoritativeValue);
Assert.AreEqual(0, serverComponent.SmoothOnAnticipationFailVariable.AuthoritativeValue);
Assert.AreEqual(0, serverComponent.ReanticipateOnAnticipationFailVariable.AuthoritativeValue);
Assert.AreEqual(0, serverComponent.SnapOnAnticipationFailVariable.Value);
Assert.AreEqual(0, serverComponent.SmoothOnAnticipationFailVariable.Value);
Assert.AreEqual(0, serverComponent.ReanticipateOnAnticipationFailVariable.Value);
}
[Test]
public void WhenAnticipating_OtherClientDoesNotChange()
{
var testComponent = GetTestComponent();
testComponent.SnapOnAnticipationFailVariable.Anticipate(10);
testComponent.SmoothOnAnticipationFailVariable.Anticipate(15);
testComponent.ReanticipateOnAnticipationFailVariable.Anticipate(20);
var otherClientComponent = GetOtherClientComponent();
Assert.AreEqual(0, otherClientComponent.SnapOnAnticipationFailVariable.AuthoritativeValue);
Assert.AreEqual(0, otherClientComponent.SmoothOnAnticipationFailVariable.AuthoritativeValue);
Assert.AreEqual(0, otherClientComponent.ReanticipateOnAnticipationFailVariable.AuthoritativeValue);
Assert.AreEqual(0, otherClientComponent.SnapOnAnticipationFailVariable.Value);
Assert.AreEqual(0, otherClientComponent.SmoothOnAnticipationFailVariable.Value);
Assert.AreEqual(0, otherClientComponent.ReanticipateOnAnticipationFailVariable.Value);
TimeTravel(2, 120);
Assert.AreEqual(0, otherClientComponent.SnapOnAnticipationFailVariable.AuthoritativeValue);
Assert.AreEqual(0, otherClientComponent.SmoothOnAnticipationFailVariable.AuthoritativeValue);
Assert.AreEqual(0, otherClientComponent.ReanticipateOnAnticipationFailVariable.AuthoritativeValue);
Assert.AreEqual(0, otherClientComponent.SnapOnAnticipationFailVariable.Value);
Assert.AreEqual(0, otherClientComponent.SmoothOnAnticipationFailVariable.Value);
Assert.AreEqual(0, otherClientComponent.ReanticipateOnAnticipationFailVariable.Value);
}
[Test]
public void WhenServerChangesSnapValue_ValuesAreUpdated()
{
var testComponent = GetTestComponent();
testComponent.SnapOnAnticipationFailVariable.Anticipate(10);
Assert.AreEqual(10, testComponent.SnapOnAnticipationFailVariable.Value);
Assert.AreEqual(0, testComponent.SnapOnAnticipationFailVariable.AuthoritativeValue);
testComponent.SetSnapValueRpc(10);
WaitForMessageReceivedWithTimeTravel<RpcMessage>(
new List<NetworkManager> { m_ServerNetworkManager }
);
var serverComponent = GetServerComponent();
Assert.AreEqual(10, serverComponent.SnapOnAnticipationFailVariable.Value);
Assert.AreEqual(10, serverComponent.SnapOnAnticipationFailVariable.AuthoritativeValue);
var otherClientComponent = GetOtherClientComponent();
Assert.AreEqual(0, otherClientComponent.SnapOnAnticipationFailVariable.Value);
Assert.AreEqual(0, otherClientComponent.SnapOnAnticipationFailVariable.AuthoritativeValue);
WaitForMessageReceivedWithTimeTravel<NetworkVariableDeltaMessage>(m_ClientNetworkManagers.ToList());
Assert.AreEqual(10, testComponent.SnapOnAnticipationFailVariable.Value);
Assert.AreEqual(10, testComponent.SnapOnAnticipationFailVariable.AuthoritativeValue);
Assert.AreEqual(10, otherClientComponent.SnapOnAnticipationFailVariable.Value);
Assert.AreEqual(10, otherClientComponent.SnapOnAnticipationFailVariable.AuthoritativeValue);
}
[Test]
public void WhenServerChangesSmoothValue_ValuesAreLerped()
{
var testComponent = GetTestComponent();
testComponent.SmoothOnAnticipationFailVariable.Anticipate(15);
Assert.AreEqual(15, testComponent.SmoothOnAnticipationFailVariable.Value, Mathf.Epsilon);
Assert.AreEqual(0, testComponent.SmoothOnAnticipationFailVariable.AuthoritativeValue, Mathf.Epsilon);
// Set to a different value to simulate a anticipation failure - will lerp between the anticipated value
// and the actual one
testComponent.SetSmoothValueRpc(20);
WaitForMessageReceivedWithTimeTravel<RpcMessage>(
new List<NetworkManager> { m_ServerNetworkManager }
);
var serverComponent = GetServerComponent();
Assert.AreEqual(20, serverComponent.SmoothOnAnticipationFailVariable.Value, Mathf.Epsilon);
Assert.AreEqual(20, serverComponent.SmoothOnAnticipationFailVariable.AuthoritativeValue, Mathf.Epsilon);
var otherClientComponent = GetOtherClientComponent();
Assert.AreEqual(0, otherClientComponent.SmoothOnAnticipationFailVariable.Value, Mathf.Epsilon);
Assert.AreEqual(0, otherClientComponent.SmoothOnAnticipationFailVariable.AuthoritativeValue, Mathf.Epsilon);
WaitForMessageReceivedWithTimeTravel<NetworkVariableDeltaMessage>(m_ClientNetworkManagers.ToList());
Assert.AreEqual(15 + 1f / 60f * 5, testComponent.SmoothOnAnticipationFailVariable.Value, Mathf.Epsilon);
Assert.AreEqual(20, testComponent.SmoothOnAnticipationFailVariable.AuthoritativeValue, Mathf.Epsilon);
Assert.AreEqual(0 + 1f / 60f * 20, otherClientComponent.SmoothOnAnticipationFailVariable.Value, Mathf.Epsilon);
Assert.AreEqual(20, otherClientComponent.SmoothOnAnticipationFailVariable.AuthoritativeValue, Mathf.Epsilon);
for (var i = 1; i < 60; ++i)
{
TimeTravel(1f / 60f, 1);
Assert.AreEqual(15 + 1f / 60f * 5 * (i + 1), testComponent.SmoothOnAnticipationFailVariable.Value, 0.00001);
Assert.AreEqual(20, testComponent.SmoothOnAnticipationFailVariable.AuthoritativeValue, Mathf.Epsilon);
Assert.AreEqual(0 + 1f / 60f * 20 * (i + 1), otherClientComponent.SmoothOnAnticipationFailVariable.Value, 0.00001);
Assert.AreEqual(20, otherClientComponent.SmoothOnAnticipationFailVariable.AuthoritativeValue, Mathf.Epsilon);
}
TimeTravel(1f / 60f, 1);
Assert.AreEqual(20, testComponent.SmoothOnAnticipationFailVariable.Value, Mathf.Epsilon);
Assert.AreEqual(20, otherClientComponent.SmoothOnAnticipationFailVariable.Value, Mathf.Epsilon);
}
[Test]
public void WhenServerChangesReanticipateValue_ValuesAreReanticipated()
{
var testComponent = GetTestComponent();
testComponent.ReanticipateOnAnticipationFailVariable.Anticipate(15);
Assert.AreEqual(15, testComponent.ReanticipateOnAnticipationFailVariable.Value, Mathf.Epsilon);
Assert.AreEqual(0, testComponent.ReanticipateOnAnticipationFailVariable.AuthoritativeValue, Mathf.Epsilon);
// Set to a different value to simulate a anticipation failure - will lerp between the anticipated value
// and the actual one
testComponent.SetReanticipateValueRpc(20);
WaitForMessageReceivedWithTimeTravel<RpcMessage>(
new List<NetworkManager> { m_ServerNetworkManager }
);
var serverComponent = GetServerComponent();
Assert.AreEqual(20, serverComponent.ReanticipateOnAnticipationFailVariable.Value, Mathf.Epsilon);
Assert.AreEqual(20, serverComponent.ReanticipateOnAnticipationFailVariable.AuthoritativeValue, Mathf.Epsilon);
var otherClientComponent = GetOtherClientComponent();
Assert.AreEqual(0, otherClientComponent.ReanticipateOnAnticipationFailVariable.Value, Mathf.Epsilon);
Assert.AreEqual(0, otherClientComponent.ReanticipateOnAnticipationFailVariable.AuthoritativeValue, Mathf.Epsilon);
WaitForMessageReceivedWithTimeTravel<NetworkVariableDeltaMessage>(m_ClientNetworkManagers.ToList());
Assert.AreEqual(25, testComponent.ReanticipateOnAnticipationFailVariable.Value, Mathf.Epsilon);
Assert.AreEqual(20, testComponent.ReanticipateOnAnticipationFailVariable.AuthoritativeValue, Mathf.Epsilon);
Assert.AreEqual(25, otherClientComponent.ReanticipateOnAnticipationFailVariable.Value, Mathf.Epsilon);
Assert.AreEqual(20, otherClientComponent.ReanticipateOnAnticipationFailVariable.AuthoritativeValue, Mathf.Epsilon);
}
[Test]
public void WhenNonStaleDataArrivesToIgnoreVariable_ItIsNotIgnored([Values(10u, 30u, 60u)] uint tickRate, [Values(0u, 1u, 2u)] uint skipFrames)
{
m_ServerNetworkManager.NetworkConfig.TickRate = tickRate;
m_ServerNetworkManager.NetworkTickSystem.TickRate = tickRate;
for (var i = 0; i < skipFrames; ++i)
{
TimeTravel(1 / 60f, 1);
}
var testComponent = GetTestComponent();
testComponent.SnapOnAnticipationFailVariable.Anticipate(10);
Assert.AreEqual(10, testComponent.SnapOnAnticipationFailVariable.Value);
Assert.AreEqual(0, testComponent.SnapOnAnticipationFailVariable.AuthoritativeValue);
testComponent.SetSnapValueRpc(20);
WaitForMessageReceivedWithTimeTravel<RpcMessage>(new List<NetworkManager> { m_ServerNetworkManager });
var serverComponent = GetServerComponent();
Assert.AreEqual(20, serverComponent.SnapOnAnticipationFailVariable.Value);
Assert.AreEqual(20, serverComponent.SnapOnAnticipationFailVariable.AuthoritativeValue);
WaitForMessageReceivedWithTimeTravel<NetworkVariableDeltaMessage>(m_ClientNetworkManagers.ToList());
// Both values get updated
Assert.AreEqual(20, testComponent.SnapOnAnticipationFailVariable.Value);
Assert.AreEqual(20, testComponent.SnapOnAnticipationFailVariable.AuthoritativeValue);
// Other client got the server value and had made no anticipation, so it applies it to the anticipated value as well.
var otherClientComponent = GetOtherClientComponent();
Assert.AreEqual(20, otherClientComponent.SnapOnAnticipationFailVariable.Value);
Assert.AreEqual(20, otherClientComponent.SnapOnAnticipationFailVariable.AuthoritativeValue);
}
[Test]
public void WhenStaleDataArrivesToIgnoreVariable_ItIsIgnored([Values(10u, 30u, 60u)] uint tickRate, [Values(0u, 1u, 2u)] uint skipFrames)
{
m_ServerNetworkManager.NetworkConfig.TickRate = tickRate;
m_ServerNetworkManager.NetworkTickSystem.TickRate = tickRate;
for (var i = 0; i < skipFrames; ++i)
{
TimeTravel(1 / 60f, 1);
}
var testComponent = GetTestComponent();
testComponent.SnapOnAnticipationFailVariable.Anticipate(10);
Assert.AreEqual(10, testComponent.SnapOnAnticipationFailVariable.Value);
Assert.AreEqual(0, testComponent.SnapOnAnticipationFailVariable.AuthoritativeValue);
testComponent.SetSnapValueRpc(30);
var serverComponent = GetServerComponent();
serverComponent.SnapOnAnticipationFailVariable.AuthoritativeValue = 20;
Assert.AreEqual(20, serverComponent.SnapOnAnticipationFailVariable.Value);
Assert.AreEqual(20, serverComponent.SnapOnAnticipationFailVariable.AuthoritativeValue);
WaitForMessageReceivedWithTimeTravel<NetworkVariableDeltaMessage>(m_ClientNetworkManagers.ToList());
if (testComponent.SnapRpcResponseReceived)
{
// In this case the tick rate is slow enough that the RPC was received and processed, so we check that.
Assert.AreEqual(30, testComponent.SnapOnAnticipationFailVariable.Value);
Assert.AreEqual(30, testComponent.SnapOnAnticipationFailVariable.AuthoritativeValue);
var otherClientComponent = GetOtherClientComponent();
Assert.AreEqual(30, otherClientComponent.SnapOnAnticipationFailVariable.Value);
Assert.AreEqual(30, otherClientComponent.SnapOnAnticipationFailVariable.AuthoritativeValue);
}
else
{
// In this case, we got an update before the RPC was processed, so we should have ignored it.
// Anticipated client received this data for a tick earlier than its anticipation, and should have prioritized the anticipated value
Assert.AreEqual(10, testComponent.SnapOnAnticipationFailVariable.Value);
// However, the authoritative value still gets updated
Assert.AreEqual(20, testComponent.SnapOnAnticipationFailVariable.AuthoritativeValue);
// Other client got the server value and had made no anticipation, so it applies it to the anticipated value as well.
var otherClientComponent = GetOtherClientComponent();
Assert.AreEqual(20, otherClientComponent.SnapOnAnticipationFailVariable.Value);
Assert.AreEqual(20, otherClientComponent.SnapOnAnticipationFailVariable.AuthoritativeValue);
}
}
[Test]
public void WhenStaleDataArrivesToReanticipatedVariable_ItIsAppliedAndReanticipated()
{
var testComponent = GetTestComponent();
testComponent.ReanticipateOnAnticipationFailVariable.Anticipate(10);
Assert.AreEqual(10, testComponent.ReanticipateOnAnticipationFailVariable.Value);
Assert.AreEqual(0, testComponent.ReanticipateOnAnticipationFailVariable.AuthoritativeValue);
var serverComponent = GetServerComponent();
serverComponent.ReanticipateOnAnticipationFailVariable.AuthoritativeValue = 20;
Assert.AreEqual(20, serverComponent.ReanticipateOnAnticipationFailVariable.Value);
Assert.AreEqual(20, serverComponent.ReanticipateOnAnticipationFailVariable.AuthoritativeValue);
WaitForMessageReceivedWithTimeTravel<NetworkVariableDeltaMessage>(m_ClientNetworkManagers.ToList());
Assert.AreEqual(25, testComponent.ReanticipateOnAnticipationFailVariable.Value);
// However, the authoritative value still gets updated
Assert.AreEqual(20, testComponent.ReanticipateOnAnticipationFailVariable.AuthoritativeValue);
// Other client got the server value and had made no anticipation, so it applies it to the anticipated value as well.
var otherClientComponent = GetOtherClientComponent();
Assert.AreEqual(25, otherClientComponent.ReanticipateOnAnticipationFailVariable.Value);
Assert.AreEqual(20, otherClientComponent.ReanticipateOnAnticipationFailVariable.AuthoritativeValue);
}
}
}