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: Added support for client anticipation in NetworkVariables and NetworkTransform and support for throttling functionality in NetworkVariables #2820
Added: Added AnticipatedNetworkVariable<T>, which adds support for client anticipation of NetworkVariable values, allowing for more responsive gameplay
Added: Added AnticipatedNetworkTransform, which adds support for client anticipation of NetworkTransforms
Added: 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: 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: Added virtual method NetworkVariableBase.OnInitialize() which can be used by NetworkVariable subclasses to add initialization code
Added: Added virtual method NetworkVariableBase.Update(), which is called once per frame to support behaviors such as interpolation between an anticipated value and an authoritative one.
Added: Added NetworkTime.TickWithPartial, which represents the current tick as a double that includes the fractional/partial tick value.
Added: 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.
Testing and Documentation
Includes integration tests.
Includes documentation for previously-undocumented public API entry points.
Includes edits to existing public API documentation.
Changelog
AnticipatedNetworkVariable<T>
, which adds support for client anticipation of NetworkVariable values, allowing for more responsive gameplayAnticipatedNetworkTransform
, which adds support for client anticipation of NetworkTransformsNetworkVariableBase.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 the NetworkVariable from sending updates more often than the specified time period (even if it exceeds the dirtiness threshold), whileMaxSecondsBetweenUpdates
will force a dirty NetworkVariable 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 by NetworkVariable subclasses to add initialization codeNetworkVariableBase.Update()
, which is called once per frame to support behaviors such as interpolation between an anticipated value and an authoritative one.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.Testing and Documentation