ποΈ FireMUD System Architecture: Overview
This document provides a high-level view of FireMUDβs system architecture, showing how major services, protocols, and data flows interact across the platform.
π§© Core Architecture Principles
- Microservices-based domain-driven architecture with clearly separated responsibilities
- Spring Cloud Gateway serves as the unified HTTP/WebSocket entry point for all clients
- TCP Proxy Service accepts Telnet connections and upgrades them to WebSocket for the Gateway
- Consistent end-to-end WebSocket flow: Telnet (TCP) β TCP Proxy Service (WebSocket upgrade) β Spring Cloud Gateway β Game Session Service
- All client traffic is routed through the Spring Cloud Gateway, ensuring centralized traffic routing, monitoring, and observability. See Gateway Architecture for deployment details and stateless behavior.
π Gameplay login is handled by the Game Session Service β the Gateway may validate JWTs for admin endpoints, but gameplay clients connect without tokens. See Authentication & Authorization for the full login flow.
- Telnet clients maintain sticky TCP connections only to the TCP Proxy Service, which buffers active input, but discards it across reconnects
- Reconnection logic is handled in layers to preserve gameplay continuity
- All internal service-to-service communication from the Game Session Service onward uses gRPC, with strict schema enforcement and low latency
- Session state is stored in Redis to keep services stateless and support gameplay recovery
- Game definitions and rules are data-driven and editable via tooling without redeploying code
- Game Session Service orchestrates live game instances, including tick execution and runtime configuration
- Feature flags are defined at design-time in the Game Design Service and toggled at runtime by the Game Session Service
- π One session per character is allowed β logging in from another client forcibly transfers control to the new session and terminates the old one
πΌοΈ See also: System Architecture Diagram and System Context Diagram
π Reconnection Strategy
FireMUD supports seamless gameplay recovery through a layered reconnection model:
Layer | Responsibility |
---|---|
TCP Proxy Service | Buffers Telnet input; clears on disconnect |
Spring Cloud Gateway | Stateless; re-establishes backend connections on reconnect |
Game Session Service | Restores gameplay session using Redis |
π See Reconnection Strategy for full details on session resumption, reauthentication, and failure handling.
π Major Components and Their Roles
Component | Purpose |
---|---|
Web Clients | Modern browser clients using WebSocket or HTTP to access the platform |
MUD Clients | Traditional Telnet clients connecting via TCP, proxied into the system |
TCP Proxy Service | Accepts Telnet connections, buffers input, forwards over WebSocket |
Spring Cloud Gateway | Handles WebSocket termination, routing, auth, monitoring |
Game Session Service | Manages player sessions, tick orchestration, stores runtime flags, input validation |
Account Service | Manages player accounts, login, auth, subscriptions, and bans |
Entity Management Service | Handles all entity data: players, NPCs, items, stats, inventories |
World Management Service | Owns maps, rooms, and tick region structure |
Game Logic Service | Executes gameplay mechanics; resolves actions deterministically |
Automation & Scripting Service | Triggers AI and scripted behaviors |
Social & Groups Service | Manages chat, mail, guilds, and social features |
Logging & Admin Service | Provides admin tools, metrics dashboards, audit logs, toggles runtime flags |
Game Design Service | Authoring tool for designing and publishing game data; defines feature flags |
π Communication Flows
Flow | Protocol |
---|---|
Web Clients β Spring Cloud Gateway | WebSocket (wss) / HTTP (https) |
MUD Clients β TCP Proxy Service | Raw TCP (Telnet) |
TCP Proxy Service β Spring Cloud Gateway | WebSocket (wss) |
Spring Cloud Gateway β Game Session Service | WebSocket (wss) |
Game Session Service β Other Microservices | gRPC (internal) |
β All internal communication from the Game Session Service onward uses gRPC with strict schema enforcement.
π¦ Data and State Management
- Persistent data (accounts, entities, rooms) is stored in PostgreSQL by domain-aligned services
- Volatile state (sessions, command queues, timers) is stored in Redis and coordinated by the Game Session Service
- Redis is a non-authoritative coordination buffer β but critical for consistency, ticks, retries, and recovery
- Tick regions are shard-aligned in Redis to preserve atomicity
π See Redis Architecture for key structure and durability strategies.
β±οΈ Game Loop / Tick Model
FireMUD uses a Hybrid Tick Model to balance responsiveness and fairness:
- One action per entity per tick (pulled from command queues)
- Region-scoped ticks execute independently for parallelism
- Tick state (locks, queues, timers) is stored and coordinated via Redis
π Tick execution, staging/rollback, retry policies, and crash recovery are detailed in Tick System and Runtime Design
π Authentication and Authorization Flow
Clients authenticate using the LOGIN
command, processed by the Game Session Service.
On disconnect, clients must reauthenticate to resume gameplay.
Session state is stored in Redis and reused for recovery.
π See Authentication & Authorization for JWT format and session flow.
π Observability and Monitoring
See Logging & Monitoring for the full pipeline, including Fluent Bit, Prometheus, and related dashboards.
π Additional Redis metrics are noted in Redis Architecture.
ποΈ Deployment Layers
Layer | Technology |
---|---|
Client Layer | Browser, Telnet MUD Clients |
Proxy Layer | TCP Proxy Service (LoadBalancer Service) |
API Gateway Layer | Spring Cloud Gateway (LoadBalancer Service) |
Gameplay Session Layer | Game Session Service |
Service Layer | Microservices (Account, Entity, World, Logic, etc.) |
Infrastructure Layer | Kubernetes with IPVS, Docker Compose (for local development) |
Deployment health checks (readiness and liveness probes) for these layers are described in detail in Deployment Environments.
Environment-specific routing is configured through Spring profiles
(application-dev.yml
, application-prod.yml
). See
Deployment Environments
for how these profiles differ in Docker Compose versus Kubernetes.
π Notes on Responsibility Alignment
- Functional responsibilities are defined in the Service Responsibility Matrix
- Game Session Service orchestrates tick lifecycles, retries, and session management
- Game Logic Service resolves individual actions deterministically based on input state
- Redis acts as a passive, high-speed execution substrate β storing volatile state and enabling atomic coordination via Lua scripts
π§ Why Game Session Service vs Game Logic Service? Game Logic Service is stateless and deterministic. Game Session Service governs pacing, conflict handling, and orchestration across distributed tick regions.
π Related Documentation
Diagrams
Infrastructure & Deployment
- Infrastructure Overview
- Deployment Environments
- Gateway Architecture
- Protocol Bridging
- Multi-Tenancy Architecture
Runtime & Security
- Redis Architecture
- Tick System and Runtime Design
- Reconnection Strategy
- Authentication & Authorization
- Security Architecture
- Logging & Monitoring
- Database Migrations
- Testing Strategy