Documentation / Tile Tick Core RPG / Programmer

UI & Client Presentation

LocalPlayerContext, binding, events, client-only presentation, audio, and safe UI extension patterns.

Client presentation is intentionally downstream of authoritative state. UI sends requests through sanctioned owner seams and refreshes from events/replication; it should not directly edit network variables or server-owned models.

Local player binding

LocalPlayerPresentationBinder waits for the NGO-owned local player, wires camera and UI systems to its runtime components, then publishes LocalPlayerContext. This prevents scene UI from accidentally binding to a remote player or using global searches.

LocalPlayerContext

Use LocalPlayerContext.Current when a client-side input source needs the locally owned player. Minimap click-to-move uses this path and calls SubmitMoveToWorldPosition; the request still goes through server movement authority.

using GreenCloakGames.TileTickRPGCore.Multiplayer.NGO;
using UnityEngine;

public void RequestMove(Vector3 worldPosition)
{
    LocalPlayerContext.Current?.SubmitMoveToWorldPosition(worldPosition);
}

Prefer events over polling

SystemUseful events
SimpleInventoryOnItemAdded, OnItemRemoved, OnInventoryChanged
UnitEquipmentOnItemEquipped, OnItemUnequipped, OnEquipmentChanged, quantity/requirement events
UnitSkillsXP, level and generic skill-change events
UnitCombatAttack launched/resolved/blocked, status and projectile events
PrayerControllerPrayer activation/deactivation, overhead change, points depleted
RunEnergyControllerEnergy/max/run-enabled/depletion/regeneration events
BankServiceSession open/close, bank changed/restored, message events

Audio

AudioManager is the central presentation audio service. Request audio through IDs/database entries instead of hardcoding clips in gameplay systems. It exposes global volume/music change events for settings/UI synchronization.

Dedicated server rule

Camera, EventSystem, HUD, minimap, connect UI, chat/context menus, presentation overlays, audio and client input belong in the client-only composition. Do not place authoritative services such as tick/grid/path/network/spawn under DedicatedServerSceneComposition.

Never optimistic-write authoritative state. If a button changes inventory/equipment/bank state locally before the server confirms it, the UI will eventually snap back or desync. Send a command and render the replicated result.