Skip to content
DARK
PAWNS

A Multi-User DungeonEST. 1994

Server architecture

Trace startup from the server entrypoint through world loading, persistence, sessions, network listeners, and the shared game engine.

Dark Pawns is a Go server that loads the original Diku-format world, exposes telnet and WebSocket sessions, and runs the game through a shared world and combat engine.

cmd/server/main.go is the composition root. In broad order it:

  1. Parses flags and deterministic clock/RNG settings.
  2. Loads the world through pkg/parser.
  3. Constructs pkg/game.World.
  4. Opens the SQLite store (creating the file and schema on a first boot).
  5. Creates the session manager (pkg/session.Manager) and wires its combat and scripting callbacks.
  6. Registers HTTP, WebSocket, metrics, admin, and telnet surfaces.
  7. Starts reset/tick workers and waits for shutdown.
Package Responsibility
pkg/parser Reads rooms, mobs, objects, zones, and shops from the original files.
pkg/game Runtime world state, players, mob/object instances, resets, movement, shops, and skills.
pkg/session Login, character creation, connections, and command dispatch.
pkg/combat Shared tick-based combat calculations and combatant interfaces.
pkg/spells Spell metadata, saving throws, damage, affects, and spell execution.
pkg/scripting Sandboxed Lua triggers using a serialized VM.
pkg/db Player persistence in an embedded SQLite file.
pkg/telnet Raw telnet listener translated into the shared session protocol.

The Go implementation isn't the authority for game behavior. The reachable C path in src/ and the read-only oracle determine player-facing behavior. Architecture changes must preserve that boundary; see Port Fidelity Workflow.