garage44.eu/jeroen/cartopolis

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

.. /docs/adr/007-simulation-vs-client-process-model.md

raw

ADR-007: Simulation vs Client Process Model


Metadata:


Context

Problem: A virtual world server needs an authoritative loop (time step, world mutations) separate from presentation (rendering). A single Bevy process with local input and SQLite can't host multiple clients.

Requirements:

Decision

Split into simulation (headless, authoritative state, DB writer) and client (Bevy render + input + network consumer) as separate binaries sharing a cartopolis_core library.

Both binaries use tracing for structured logs (ADR-014).

Rationale

Primary Reasoning:

  1. Authority boundary: Standard "sim vs viewer" split.
  2. Deployment: VPS can run cartopolis_simulator only (ADR-014).
  3. Testing: Sim binary can run integration tests without a window.

Alternatives Considered:

AlternativeProsConsRejected Because
One binary + --server flagFewer cratesTangles featuresBecomes unmaintainable as net code grows
MicroservicesScale storyOps complexityOut of scope for gradual build
Client-authoritativeEasiest multiplayer hackCheating, divergenceVirtual world expectation is server authority

Consequences

Positive:

Negative:

Related