Development Setup
Development Setup
Section titled “Development Setup”This guide covers setting up TalesMUD for active development, including hot reload for the backend and Vite dev servers for the frontend.
Prerequisites
Section titled “Prerequisites”| Tool | Version | Install |
|---|---|---|
| Go | 1.24+ | go.dev/dl |
| Node.js | 20+ | nodejs.org |
| Make | Any | apt install make / brew install make |
| Git | Any | git-scm.com |
-
Fork and clone
Terminal window git clone https://github.com/YOUR_USERNAME/talesmud.gitcd talesmud -
Install dependencies
Terminal window # Go dependenciesgo mod download# Frontend dependenciescd public/app && npm install && cd ../..cd public/mud-client && npm install && cd ../.. -
Configure environment
Terminal window cp .env.example .env# Defaults are fine for local development -
Start development servers
Terminal window # Option A: All at once (4 parallel jobs)make run# Option B: Individually (in separate terminals)make run-server # Go backend on :8010make run-frontend # Admin UI Vite dev servermake run-mud-client # Game client Vite dev server
Project Structure
Section titled “Project Structure”talesmud/├── cmd/tales/ # Main entry point├── pkg/│ ├── entities/ # Go data model structs│ │ ├── characters/ # Character, Race, Class│ │ ├── rooms/ # Room│ │ ├── items/ # Item (types, quality, slots)│ │ ├── npcs/ # NPC, spawners│ │ ├── quests/ # Quest, QuestProgress│ │ ├── dialogs/ # Dialog trees│ │ ├── skills/ # Skills (includes seed data)│ │ └── combat/ # Combat instance│ ├── mudserver/ # WebSocket game server│ │ └── game/│ │ ├── commands/ # Command handlers (40+ files)│ │ ├── combat/ # Combat logic│ │ └── leveling/ # XP curves│ ├── server/ # HTTP API (Gin routes + handlers)│ ├── service/ # Business logic facade│ ├── repository/ # SQLite data access layer│ └── scripts/ # Lua scripting engine├── public/│ ├── app/ # Admin frontend (Svelte + Vite)│ └── mud-client/ # Game client (Svelte + xterm.js)├── zones/ # World content (Markdown source)├── data/ # World YAML export (generated)└── docs/ # Design documentationAdding a New Command
Section titled “Adding a New Command”-
Create
pkg/mudserver/game/commands/yourcommand.go -
Implement the
Commandinterface:type YourCommand struct{}func (c *YourCommand) Keys() []string {return []string{"yourcommand", "yc"}}func (c *YourCommand) Execute(ctx *GameContext, msg string) {// Command logic herectx.SendToOrigin("Command output!")} -
Register the command in
commandprocessor.go
Running Tests
Section titled “Running Tests”# Run all testsgo test ./...
# Run specific package testsgo test ./pkg/mudserver/game/...
# Run the combat simulatormake run-combat-simulatorCode Style
Section titled “Code Style”- Follow standard Go style (
gofmt) - Use
logrusfor logging (already imported everywhere aslog) - Prefer explicit error handling over panics
- Service layer methods should not import
mudserverpackages (maintain layering)
Next Steps
Section titled “Next Steps”- Code Structure — Architectural guidance
- Pull Request Guidelines — How to submit PRs