How slayhorizon/godot-tiny-mmo works
Project Type and Purpose
• This is a full-stack, experimental tiny-MMO game built with Godot 4.4.
• It lives in a single repo containing both client and server code.
• It uses a three-tier server architecture (Gateway, Master, World) plus a Godot client.
File Structure
• Top-level directories:
• addons/ – Godot plugins (inspector, property editor)
• source/ – the heart of the code:
– client/ (game UI, network client, autoloaded singletons, map objects, local player)
– common/ (shared entities, items, maps, network base classes, utilities)
– gateway_server/ (authentication & routing)
– master_server/ (account management, world/gateway registry, QAD DB)
– world_server/ (instances of maps, chat commands, game logic)
• test_config/ – example .cfg files for launching multiple instances with tags.
• project.godot & README.md – entrypoints and project summary.
README for Additional Insights
• It spells out the “Mimic real MMO-style architecture” with Gateway, Master, World servers.
• It highlights custom netcode (WebSocketMultiplayerPeer), shared codebase, separate export presets for client vs. servers.
Main Components
a. Client (Browser/Desktop)
– UI Layer: scenes and controls under source/client/ui & gateway/ui
– Local Player & Input (mouse_component, local_player.gd)
– Network Client: WebSocketMultiplayerPeer connecting to Gateway
– Common Entities & Resources for rendering
b. Gateway Server
– Accepts client WebSocket connections
– Performs Authentication & Account Creation (gateway_manager_client)
– Routes clients to Master server
c. Master Server
– Manages persistent account data (master_database, QAD database)
– Maintains world registry (world_manager_server)
– Coordinates between Gateway and World servers
d. World Server(s)
– Hosts one or more map instances (overworld, dungeon entrance, dungeon)
– Runs game logic (entities, health, attacks, chat commands)
– Instance management (instance_manager, instance_server)
– Writes/reads world-specific persistent data (world_database)
e. Shared Database
– QAD (lightweight file or in-memory database) backing Master and World servers
f. Shared Code Library
– source/common – Entities, network base classes, utilities, map templates
Relationships and Data Flows
• Client → Gateway: WebSocket handshake, authentication, version check
• Gateway → Master: RPCs for login, account creation, server list
• Master → Gateway: list of world servers with connection details
• Client → World Server: WebSocket connection to assigned world instance
• World Server ↔ World Database: persistent player and map state
• (Optional) World Server ↔ Master: heartbeats, registration
Architectural Patterns & Design Principles
• Tiered microservice-style separation: Gateway (auth & routing), Master (coordination), World (game logic)
• Shared code library under source/common for DRY across client & servers
• Autoload singletons for global state (source/client/autoload/events.gd)
• Configuration via tags and .cfg files for flexible multi-instance launches
Technologies, Frameworks, and Libraries
• Godot Engine 4.4 (GDScript, scenes, nodes)
• WebSocketMultiplayerPeer for custom netcode
• QAD or simple file-based persistence for server data
• .cfg files and command-line flags for run instances