Netcode for GameObjects is a high-level netcode SDK that provides networking capabilities to GameObject/MonoBehaviour workflows within Unity and sits on top of underlying transport layer.
MIT License
2.1k
stars
430
forks
source link
feat: up-port of network variable traits, anticipation, serialized null references, and removal of animator component requirement #2957
Up-port of PR-2872 updates to remove Animator requirements for NetworkAnimator.
Up-port of PR-2874 allow null values for NetworkBehaviourReference and NetworkObjectReference.
Up-port of PR-2820 updates for anticipated NetworkVariable and NetworkTransform.
Changelog
Added: AnticipatedNetworkVariable<T>, which adds support for client anticipation of NetworkVariable values, allowing for more responsive gameplay.
Added: AnticipatedNetworkTransform, which adds support for client anticipation of NetworkTransforms.
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).
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.
Added: virtual method NetworkVariableBase.OnInitialize which can be used by NetworkVariable subclasses to add initialization code.
Added: NetworkTime.TickWithPartial, which represents the current tick as a double that includes the fractional/partial tick value.
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.
Changed: NetworkAnimator no longer requires the Animator component to exist on the same GameObject.
Changed: NetworkObjectReference and NetworkBehaviourReference to allow null references when constructing and serializing.
Testing and Documentation
Includes new and modified integration tests.
Includes documentation for previously-undocumented public API entry points.
This PR updates NGO v2.0.0 with:
Animator
requirements for NetworkAnimator.NetworkBehaviourReference
andNetworkObjectReference
.NetworkVariable
andNetworkTransform
.Changelog
AnticipatedNetworkVariable<T>
, which adds support for client anticipation ofNetworkVariable
values, allowing for more responsive gameplay.AnticipatedNetworkTransform
, which adds support for client anticipation of NetworkTransforms.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 inNetworkVariable<T>
with the callbackNetworkVariable<T>.CheckExceedsDirtinessThreshold
).NetworkVariableUpdateTraits
, which add additional throttling support:MinSecondsBetweenUpdates
will prevent theNetworkVariable
from sending updates more often than the specified time period (even if it exceeds the dirtiness threshold), whileMaxSecondsBetweenUpdates
will force a dirtyNetworkVariable
to send an update after the specified time period even if it has not yet exceeded the dirtiness threshold.NetworkVariableBase.OnInitialize
which can be used byNetworkVariable
subclasses to add initialization code.NetworkTime.TickWithPartial
, which represents the current tick as a double that includes the fractional/partial tick value.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.NetworkAnimator
no longer requires theAnimator
component to exist on the sameGameObject
.NetworkObjectReference
andNetworkBehaviourReference
to allow null references when constructing and serializing.Testing and Documentation