Skip to content

spurnout/legacy-mmo

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

124 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

Legacy Code: The Retail Singularity.

A browser-based MMO where your convenience store is a front for reality-stabilizing rituals

๐ŸŽฎ Status: MVP Complete (56/56 tasks, 5 sprints) | ๐Ÿš€ Deployment: Docker-ready | ๐Ÿ“Š Test Coverage: 60%+ (92 tests) | ๐Ÿ”’ Security: Audit complete, roadmap available


๐ŸŽฏ Quick Start

Prerequisites

  • Docker & Docker Compose
  • (Or: Node 20+, PostgreSQL 16, Redis 7)

Run with Docker (Recommended)

# Start all services
docker-compose up -d

# View logs
docker-compose logs -f

# Stop services
docker-compose down

Access Points:

Run Locally (Development)

# Install dependencies
npm install

# Set up database
cd apps/server
npm run prisma:migrate
npm run prisma:generate

# Start server
npm run dev

# Start web (in another terminal)
cd apps/web
npm run dev

๐ŸŽฎ How to Play

  1. Create Account at http://localhost:3000/login
  2. Move around with WASD or Arrow keys
  3. Click NPCs (customers) to start serving them
  4. Scan items in the register UI
  5. Check IDs for restricted items (21+ only)
  6. Earn currency & XP by completing transactions
  7. Chat with other players (Enter to focus)
  8. Press F1 for full keybinds list

Game Mechanics

NPC Types:

  • ๐ŸŸฆ Normal - Patient, average pay
  • ๐ŸŸง Impatient - Low patience, bonus XP if served quickly
  • ๐ŸŸช Underage - Tries to buy restricted items, deny for XP
  • ๐ŸŸฅ Karen - Very impatient, complains, high pay
  • ๐Ÿ”ท Glitch - Weird requests, pays 2x

Progression:

  • Level up by earning XP
  • Unlock abilities and skills
  • Earn currency to buy items
  • Join franchises (guilds)
  • Capture territory nodes

๐Ÿ—๏ธ Architecture

Tech Stack

Frontend:

  • Next.js 14 (App Router)
  • Phaser 3 (2D game engine)
  • React + TailwindCSS
  • Zustand (state)
  • Socket.io Client

Backend:

  • Node.js 20 + TypeScript
  • Express (REST API)
  • Socket.io (WebSockets)
  • PostgreSQL 16 (Prisma ORM)
  • Redis 7 (cache)

Infrastructure:

  • Docker Compose
  • Multi-stage builds
  • Hot-reload in dev
  • Health checks

Project Structure

legacy-code-mmo/
โ”œโ”€โ”€ apps/
โ”‚   โ”œโ”€โ”€ web/          # Next.js frontend
โ”‚   โ”œโ”€โ”€ server/       # Node.js backend
โ”‚   โ””โ”€โ”€ admin/        # Admin portal (in progress)
โ”œโ”€โ”€ packages/
โ”‚   โ”œโ”€โ”€ types/        # Shared TypeScript types
โ”‚   โ””โ”€โ”€ constants/    # Game balance & config
โ”œโ”€โ”€ docs/             # Design documents
โ””โ”€โ”€ docker-compose.yml

Game Loop

  • 20 TPS server tick rate (50ms intervals)
  • Server-authoritative - prevents cheating
  • Client-side prediction - smooth movement
  • Event-driven systems - NPCs, Combat, Skills

๐Ÿ“‹ Features

โœ… Completed (Playable Now!)

Phase A: Foundation

  • โœ… Player movement & multiplayer
  • โœ… WebSocket real-time sync
  • โœ… Auth & JWT tokens
  • โœ… Docker deployment

Phase B: Core Loop

  • โœ… NPC spawning (5 types)
  • โœ… Scanning/register UI
  • โœ… Currency & XP system
  • โœ… Player HUD (level, XP, currency)
  • โœ… Text chat

Server-Side Complete (UI in progress):

  • โœ… Combat system (4 roles, 12+ abilities)
  • โœ… Skill system (10 skills)
  • โœ… Inventory & equipment
  • โœ… Crafting (Mixology + Synthesis)
  • โœ… Player market
  • โœ… Franchise/guild system
  • โœ… Housing system
  • โœ… Territory control
  • โœ… Daily quests

๐Ÿšง In Progress

  • ๐Ÿ”จ Combat UI (abilities, cooldowns)
  • ๐Ÿ”จ Inventory UI
  • ๐Ÿ”จ Crafting UI
  • ๐Ÿ”จ Skills progression UI
  • ๐Ÿ”จ Market UI
  • ๐Ÿ”จ Housing decoration UI
  • ๐Ÿ”จ Franchise management UI
  • ๐Ÿ”จ Daily quests tracker

๐Ÿ“ Planned

  • ๐Ÿ“‹ Tutorial system
  • ๐Ÿ“‹ First dungeon "The Back Room"
  • ๐Ÿ“‹ Additional dungeons & raids
  • ๐Ÿ“‹ Load testing & optimization
  • ๐Ÿ“‹ Comprehensive test suite

๐Ÿงช Testing

# Run all tests
npm test

# Run tests in watch mode
npm run test:watch

# Run specific test suite
npm test -- NPCSystem

# Coverage report
npm run test:coverage

Current Coverage: 60%+ (92 tests passing)


๐Ÿ”ง Development

Available Scripts

# Root
npm install              # Install all dependencies
npm run dev              # Start all dev servers
npm run build            # Build all apps
npm test                 # Run all tests

# Server (apps/server/)
npm run dev              # Start dev server with hot-reload
npm run build            # Build production
npm run prisma:migrate   # Run migrations
npm run prisma:studio    # Open Prisma Studio

# Web (apps/web/)
npm run dev              # Start Next.js dev server
npm run build            # Build production
npm run lint             # Run ESLint

Environment Variables

Create .env files in each app:

apps/server/.env:

DATABASE_URL=postgresql://postgres:postgres@localhost:5432/legacy_code_mmo
REDIS_URL=redis://localhost:6379
JWT_SECRET=your-secret-key-change-in-production
PORT=3001
NODE_ENV=development
CLIENT_URL=http://localhost:3000

apps/web/.env.local:

NEXT_PUBLIC_SERVER_URL=http://localhost:3001
NEXT_PUBLIC_ADMIN_PASSWORD=admin123
NEXT_TELEMETRY_DISABLED=1

๐Ÿ“š Documentation

Core Documentation:

Pre-Launch Roadmaps:

Game Design & Features:

Operations:


๐ŸŽจ Game Design

Genre: Incremental MMO + Corporate Horror Theme: Mundane retail โ†’ Eldritch cosmic horror Target: 2-100 concurrent players Sessions: 5-15 minute bursts (office-friendly)

Core Loop:

  1. Serve NPC customers at register
  2. Earn currency & XP
  3. Level up & unlock abilities
  4. Explore dungeons with other players
  5. Craft items & trade
  6. Join franchise & capture territory

๐Ÿ› Known Issues & Roadmaps

Security Audit Results (2026-02-14):

  • 1 CRITICAL issue identified (race condition). (Note: missing admin auth has been resolved)
  • 5 MEDIUM issues identified (rate limiting, JWT expiry, logging, etc.)
  • See SECURITY_ROADMAP.md for details & fixes

Test Coverage Gaps:

Code Quality Improvements:

  • Rate limiting scattered across files (need consolidation)
  • Time units inconsistent (ms vs seconds)
  • See CODE_QUALITY_ROADMAP.md for refactoring plan

๐Ÿค Contributing

This is a learning/demonstration project. Contributions welcome!

Key Areas:

  • Additional NPC types
  • More abilities & skills
  • Dungeon content
  • UI/UX improvements
  • Performance optimization
  • Test coverage

๐Ÿ“œ License

MIT License - See LICENSE file for details


๐ŸŽ‰ Credits

Built with Claude Code during an overnight development session. A demonstration of rapid game development with AI assistance.

Technologies:

  • Next.js, React, TypeScript
  • Phaser 3, Socket.io
  • PostgreSQL, Redis, Prisma
  • Docker, TailwindCSS

๐Ÿš€ Deployment

Docker Production

# Build production images
docker-compose -f docker-compose.prod.yml build

# Start production stack
docker-compose -f docker-compose.prod.yml up -d

# View logs
docker-compose -f docker-compose.prod.yml logs -f

# Stop
docker-compose -f docker-compose.prod.yml down

Manual Deployment

  1. Build apps: npm run build
  2. Set up PostgreSQL database
  3. Run migrations: npm run prisma:migrate
  4. Start server: npm start in apps/server
  5. Serve web: Use your preferred static host (Vercel, Netlify, etc.)

๐Ÿ“ž Support

  • Issues: File on GitHub
  • Questions: Check docs/ folder
  • Admin Access: Default password admin123 (CHANGE IN PRODUCTION!)

Happy coding! May your customers be patient and your transactions profitable. ๐Ÿ’ฐ๐ŸŽฎ

About

Silly mmo to be used just with me and coworkers

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors