NextGenMUD is a modern Multi-User Dungeon (MUD) engine built with Django and WebSockets, combining classic text-based adventure gameplay with modern web technologies.
NextGenMUD provides a flexible foundation for creating and running text-based multiplayer worlds. Featuring a rich YAML-based world definition system, dynamic trigger system, and comprehensive game state management, it allows for the creation of complex, interactive environments.
Key features include:
- Real-time player interactions via WebSockets
- Comprehensive command system with extensive built-in commands
- Event-driven trigger system for rich, dynamic environments
- YAML-based world definitions for easy world building
- Flexible character, object, and room models
- Combat system with support for NPCs and player battles
- Inventory and equipment systems
NextGenMUD is built on the following architecture:
- Django Framework: Provides the web foundation, user management, and admin interface
- WebSockets: Handles real-time communication between players and the game server
- Comprehensive Game State: Central manager for all game elements and interactions
- Command Handler: Processes player inputs and manages command execution
- World Definition: YAML-based system for defining game worlds, characters, and objects
- Trigger System: Event-driven system for creating interactive environments
- Structured Logging: Advanced logging system with context tracking and multiple debug levels
- Python 3.8+
- Django 5.0+
- Channels 4.0+ (for WebSockets)
- Structlog 23.2.0+ (for structured logging)
- Clone the repository:
git clone https://github.com/yourusername/NextGenMUD.git
cd NextGenMUD- Set up a virtual environment:
python -m venv venv
source venv/bin/activate # On Windows, use venv\Scripts\activate- Install dependencies:
pip install -r requirements.txt- Run migrations:
python manage.py migrate- Start the server:
./run.shOr manually:
uvicorn NextGenMUD.asgi:application --host 0.0.0.0 --port 8000NextGenMUD uses YAML files for world definitions. Example world files are provided in the world_data directory.
A basic world file structure:
name: Example Zone
description: A sample zone for demonstration purposes.
rooms:
starting_room:
name: Starting Point
description: The beginning of your adventure.
exits:
north:
destination: second_room
triggers:
- type: timer_tick
criteria:
- subject: "%time_elapsed%"
operator: "numgte"
predicate: 10
script: |
echo A gentle breeze passes through the room.NextGenMUD provides a wide range of built-in commands for players to interact with the world:
north,south,east,west- Navigate between rooms
say [text]- Speak to everyone in the roomsayto [character] [text]- Speak to a specific charactertell [character] [text]- Send a private messageemote [text]- Perform an action
look- View your surroundingslook [target]- Examine something or someoneinventoryorinv- View your carried itemsget [item]- Pick up an itemdrop [item]- Drop an itemequip [item]- Equip an itemunequip [item]- Unequip an item
attack [character]orkill [character]- Initiate combat
spawn char/obj [id]- Create a character or objectgoto char/room [target]- Teleport to a character or roomat char/room [target] [command]- Execute a command as if at another locationecho [text]- Display a message to the roomshow zones/zone/characters/objects- Display game information
Contributions are welcome! Please feel free to submit a Pull Request.
This project is licensed under the MIT License - see the LICENSE file for details.
NextGenMUD includes a powerful structured logging system based on the structlog library. This system provides:
- Structured data - Include key-value pairs in log messages for better filtering and analysis
- Multiple debug levels - Use debug(), debug2(), and debug3() for fine-grained control
- Source context - Automatic inclusion of source file, function name, and line number
- Progress indicators - Visual indicators for long-running operations
- Message capturing - Ability to capture and replay log messages
- Prefix filtering - Filter log messages based on prefixes
- Exception handling - Detailed exceptions with source information
For more information, see the logger_readme.md file.
- Inspired by classic MUDs like DikuMUD, LPMud, and CircleMUD
- Built with Django and modern Python best practices
- Made with love for the text-based adventure community