garage44.eu/jeroen/cartopolis

logclone: git clone https://garage44.eu/jeroen/cartopolis.git

.. /docs/adr/010-authoritative-avatar-state-v0.md

raw

ADR-010: Authoritative Avatar State (v0)


Metadata:


Tier (ADR-031). Avatars are a Simulation-tier feature: they exist only for a logged-in session. The anonymous Viewer tier has no avatar — it is a map/lookup viewer. Avatar traffic is served only after the ADR-016 auth handshake.

Context

Problem: In a multi-user world, avatar transform (position, orientation) must have a single source of truth or clients will disagree.

Requirements:

Decision

The simulation integrates movement intent each tick and broadcasts authoritative avatar state in the WorldSnapshot. Clients never set final pose for networked avatars without server confirmation.

As built (crates/cartopolis_core/src/protocol.rs, crates/cartopolis_simulator/src/state.rs):

Rationale

Primary Reasoning:

  1. Anti-cheat / consistency: server authority is standard for shared worlds.
  2. Matches ECS client: client-side Avatar still exists for rendering; network layer overwrites from server state (ADR-003).
  3. Incremental: intent starts as a coarse velocity before a full input map.

Alternatives Considered:

AlternativeProsConsRejected Because
Client-authoritative poseLow latencyTrivial exploitUnacceptable for shared world
Lockstep / input historyFair FPSComplexOverkill for v0
Full physics on serverRealisticCost + ADR scopeDeferred

Consequences

Positive:

Negative:

Related