Table of Contents

Class ClientNameplateDisplay

Namespace
FishMMO.Client
Assembly
FishMMO.Client.dll

Decides which overhead nameplates are up without being targeted: every NPC and every other player inside their own chosen ranges, and the player's own. Driven from Client.Update.

public sealed class ClientNameplateDisplay
Inheritance
ClientNameplateDisplay
Inherited Members

Remarks

Why this is not part of the nameplate layer. UITKNameplateLayer answers rendering questions — how far, how many, is it behind a wall. Whether a character deserves a nameplate at all is a gameplay question about who the viewer is and who they are looking at, and it has to be asked of every character in view, including the ones whose plates are currently hidden. That is this class, walking BaseCharacter.ClientCharacters.

Ownership of a plate's visibility is split three ways, and the split is what keeps the three from fighting:

  • UITKTarget turns the current target's plate on, and asks ShouldStayVisible(ICharacter) before turning it off again on clear. Without that ask, untargeting an NPC standing next to the player blinked its nameplate off for one sweep interval before this class put it back.
  • UITKPetControl turns the player's own pet's plate on; the rule here agrees (an owned character that is not the player is always kept), so a sweep never undoes it.
  • This class owns everything else: NPCs and other players by their two ranges, the local player by the own-name toggle. Any further "keep this name up" rule — party members, guild mates — belongs in Decide(bool, bool, bool, bool, float, float, float, bool) rather than in a second writer that would have to be reconciled with it.

Cost. One dictionary walk every SweepIntervalSeconds, a squared distance per NPC, a standing colour per visible plate, and a visibility flip only on a transition. The walk is deliberately not per frame: a nameplate appearing a fifth of a second after the player crosses the range is invisible, and the walk touches every character in view. Distances use a small hysteresis (ExitRangeMultiplier) so a character idling exactly on the boundary does not toggle every sweep.

Fields

ExitRangeMultiplier

A nameplate that is already up stays up until the character is this many times the range away. Five percent: a metre and a half at the default range, enough to absorb the jitter of two characters standing on the line and small enough to be unnoticed.

public const float ExitRangeMultiplier = 1.05

Field Value

float

SweepIntervalSeconds

Seconds between sweeps of the client character registry.

public const float SweepIntervalSeconds = 0.2

Field Value

float

Methods

Decide(bool, bool, bool, bool, float, float, float, bool)

The visibility rule, as arithmetic on facts about one character.

public static bool Decide(bool isPlayer, bool isOwner, bool isTargeted, bool wasVisible, float sqrDistance, float npcRange, float playerRange, bool showOwnName)

Parameters

isPlayer bool

Whether the character is a player character.

isOwner bool

Whether this client owns the character: the local player, or their pet.

isTargeted bool

Whether the character is the local player's current target — hovered, or pinned to the target frame.

wasVisible bool

Whether the plate is currently up, which selects the exit distance.

sqrDistance float

Squared distance from the local player, in metres squared.

npcRange float

The NPC nameplate range, in metres; zero or less means target only.

playerRange float

The other-player nameplate range, in metres; zero or less means target only.

showOwnName bool

Whether the player's own nameplate stays up.

Returns

bool

True when the nameplate should be up.

Remarks

Static and free of Unity types so the truth table can be pinned by a plain unit test.

Initialize()

Subscribes to world entry and settings changes. Call during client startup.

public void Initialize()

ShouldStayVisible(ICharacter)

Whether a character's nameplate should stay up when the target frame stops framing it.

public static bool ShouldStayVisible(ICharacter character)

Parameters

character ICharacter

The character being untargeted.

Returns

bool

True to leave the plate up; false to let the target frame take it down.

Remarks

Answered from the same rule the sweep applies, so the target frame and the sweep can never disagree about a character that is both untargeted and in range. Without a live display the answer falls back to the pre-range behaviour: the player's own plate stays, everything else goes.

Shutdown()

Unsubscribes. Call during client teardown.

public void Shutdown()

Tick()

Runs one sweep when the interval has elapsed. Call once per frame.

public void Tick()