Class ObserverStreamingEntry
One registered character in ObserverStreamingRegistry: the per-observer send intervals the scheduler assigned it, the range it is currently visible from, and the cached relevance inputs (combat, party, guild) used to rank it for each viewer.
public sealed class ObserverStreamingEntry : IObserverSendFilter
- Inheritance
-
ObserverStreamingEntry
- Implements
-
IObserverSendFilter
- Inherited Members
Remarks
Doubles as the object's FishNet.Observing.IObserverSendFilter. ShouldSend(NetworkObject, NetworkConnection, Channel) runs once per observer per unreliable RPC, so it is a dictionary lookup and a modulo — nothing that allocates or walks a collection.
Two things can slow an observer down: the viewer's full-rate cap (this entry's own intervals, assigned by ObserverStreamingRegistry) and the observer's distance from the object (NetworkTransformDistanceLod on the same GameObject). They are combined by taking the larger interval, never by gating one behind the other: two independent modulo gates only coincide once in N×M ticks and would starve the observer.
Constructors
ObserverStreamingEntry(NetworkObject, ICharacter)
public ObserverStreamingEntry(NetworkObject networkObject, ICharacter character)
Parameters
networkObjectNetworkObjectcharacterICharacter
Properties
AppliedRange
The range most recently applied to the distance condition.
public float AppliedRange { get; }
Property Value
BaseRange
The configured range from the prefab's distance condition, before density scaling.
public float BaseRange { get; }
Property Value
Character
The character.
public ICharacter Character { get; }
Property Value
CurrentTargetObjectId
Object id of the character this one currently targets, or 0. Pinned into its visibility budget so a fight cannot despawn its own target.
public long CurrentTargetObjectId { get; }
Property Value
GuildID
Guild id cached for the current scheduling pass; 0 when none.
public long GuildID { get; }
Property Value
HasDistanceCondition
True when this character's visibility range can be changed at runtime.
public bool HasDistanceCondition { get; }
Property Value
HasDistanceLod
True when a NetworkTransformDistanceLod also shapes this object's sends.
public bool HasDistanceLod { get; }
Property Value
InCombat
Combat state cached for the current scheduling pass.
public bool InCombat { get; }
Property Value
IsPlayer
True for player characters, which are the only viewers the cap is computed for.
public bool IsPlayer { get; }
Property Value
LimitedObserverCount
Number of viewers this entry is currently rate limited for.
public int LimitedObserverCount { get; }
Property Value
LongestAbilityRange
Longest range among this character's known abilities, cached for the pass. Drives how far
out its own view must be tick-exact; see ObserverStreamingPolicy.ResolveEngagementRange.
public float LongestAbilityRange { get; }
Property Value
NetworkObject
The character's network object.
public NetworkObject NetworkObject { get; }
Property Value
- NetworkObject
PartyID
Party id cached for the current scheduling pass; 0 when none.
public long PartyID { get; }
Property Value
Position
World position cached for the current scheduling pass.
public Vector3 Position { get; }
Property Value
- Vector3
Methods
ApplyRange(float)
Applies a density-scaled range to the distance condition when it differs from the applied one by at least RangeChangeThreshold. The timed observer rebuild picks the new distance up on its next cycle.
public bool ApplyRange(float range)
Parameters
rangefloat
Returns
- bool
True when the range was changed.
ClearIntervals()
Forgets every per-observer interval; every observer is back at full rate.
public void ClearIntervals()
GetEffectiveInterval(NetworkConnection)
Send interval an observer actually receives: the larger of the cap interval and the distance LOD interval, so the two policies compose instead of multiplying.
public byte GetEffectiveInterval(NetworkConnection connection)
Parameters
connectionNetworkConnection
Returns
GetInterval(NetworkConnection)
Send interval assigned to an observer by the viewer cap; 1 when unlimited.
public byte GetInterval(NetworkConnection connection)
Parameters
connectionNetworkConnection
Returns
IsFoughtBy(long)
True when otherCharacterID has contributed to this character's current
combat — that is, when the two are actually fighting each other.
public bool IsFoughtBy(long otherCharacterID)
Parameters
otherCharacterIDlongThe other character's id.
Returns
Remarks
Read live rather than cached with the rest of the pass state: it is a question about a PAIR, so there is nothing to cache on one entry, and the underlying lookup is a dictionary probe on a set holding a handful of attackers.
RefreshForPass()
Refreshes the cached relevance inputs. Called once per entry per scheduling pass so the O(viewers × entries) ranking below reads fields, not behaviours.
public void RefreshForPass()
SetInterval(NetworkConnection, byte)
Sets the send interval for one observer. An interval of 1 removes the limit.
public void SetInterval(NetworkConnection connection, byte interval)
Parameters
connectionNetworkConnectionintervalbyte
ShouldSend(NetworkObject, NetworkConnection, Channel)
Returns true to send this RPC to connection, false to skip it.
public bool ShouldSend(NetworkObject networkObject, NetworkConnection connection, Channel channel)
Parameters
networkObjectNetworkObjectObject sending the RPC.
connectionNetworkConnectionObserver the RPC would be sent to.
channelChannelChannel the RPC is being sent on. Only Unreliable is ever filtered.