Table of Contents

Struct TargetRank

Namespace
FishMMO.Shared
Assembly
FishMMO.Shared.dll

One candidate's sort keys, detached from the GameObject it came from.

public readonly struct TargetRank
Inherited Members

Remarks

The selectors keep their candidates in a parallel list and sort these instead, so every ranking rule in the target system is a pure function of numbers and can be exercised without a NetworkManager, a physics scene, or a live character.

Constructors

TargetRank(int, int, int, int, float)

public TargetRank(int index, int objectId, int nameKey, int secondaryKey, float distance)

Parameters

index int
objectId int
nameKey int
secondaryKey int
distance float

Fields

Distance

Distance from the query origin, measured in the same world the query ran in.

public readonly float Distance

Field Value

float

Index

Index of the candidate in the caller's parallel list.

public readonly int Index

Field Value

int

NameKey

Stable hash of the candidate's name, separating un-networked scene objects from one another in a way both peers compute identically.

public readonly int NameKey

Field Value

int

ObjectId

The candidate's FishNet.Object.NetworkObject.ObjectId, or MaxValue when it has none.

public readonly int ObjectId

Field Value

int

Remarks

The server assigns this and every peer receives the same value, which is the only reason it works as a cross-peer sort key. Un-networked scene objects sort last as a group and are separated by NameKey.

SecondaryKey

Tiebreak for un-networked candidates that share a name: a stable hash of the candidate's authored world position, which both peers load from the same scene. (This used to be the Unity instance id, which is a per-process number and put two same-named scene objects in a different order on each peer.)

public readonly int SecondaryKey

Field Value

int