Documentation » Server & Development
For: developer
Architecture
A source-oriented map of the server entrypoint and its principal packages.
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.
Startup path
cmd/server/main.go is the composition root. In broad order it:
- Parses flags and deterministic clock/RNG settings.
- Loads the world through
pkg/parser. - Constructs
pkg/game.World. - Opens the SQLite store (creating the file and schema on a first boot).
- Creates the session manager (
pkg/session.Manager) and wires its combat and scripting callbacks. - Registers HTTP, WebSocket, metrics, admin, and telnet surfaces.
- Starts reset/tick workers and waits for shutdown.
Core packages
| 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. |
Behavioral authority
The Go implementation is not 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.