Skip to content

Architecture

mozrin edited this page Nov 3, 2026 · 1 revision

Architecture

The monorepo contains a Godot native client (client/), Go world server (server/), and separate Go analytics client (analytics/). Docker support lives under .docker/ with the root docker-compose.yaml. VERSION records the repository source version.

Runtime flow

Godot client -- wss://grimreach.mozrin.com/play --> Cloudflare Tunnel
                                                   |
                                                   v
                                            Go HTTP/WebSocket :8081
                                                   |
                                                   v
                                            authoritative world

Go analytics client -- TCP :7777 ------------------^

The native client sends a hello with role player, then movement input messages. The server assigns a player ID, validates input, advances movement at 100 ms ticks, applies collision, and sends snapshot messages. The separate analytics client uses the legacy TCP listener and role analytics to receive events and periodic metrics. HTTP GET /health on port 8081 reports tick and player count. Player and analytics messages are newline-delimited JSON. The WebSocket path is /play and carries text messages.

The server is authoritative for connected player positions and solid-object collision. The client builds the terrain and decoration around the player from deterministic coordinates and seed 76341; it smooths displayed avatars between server snapshots. Client-local journal state records discoveries, samples, and the Wayfinder trail. It is not a server account or shared character save.

Code map

Path Responsibility
client/main.gd Native client scene, connection, movement input, and interface
client/world/ Terrain streaming and procedural placement
client/exploration/ Local discovery journal and interactions
client/character/ Procedural explorer model and animation
server/ Network sessions, world tick, movement, and collision
analytics/ TCP metrics and event display
.docker/, docker-compose.yaml Server image and tunnel connector

See Development and Testing before changing a protocol or placement rule; both server and client may depend on the same world behavior.

Clone this wiki locally