MUD

P2P MUD - Decentralized Multi-User Dungeon

A fully decentralized, peer-to-peer text-based multiplayer game with procedural world generation.

Features

Architecture

┌─────────────────┐
│  Game Client    │
│  (CLI/Web)      │
└────────┬────────┘
         │
┌────────▼────────┐
│  CryptoManager  │── Player keys & signatures
└────────┬────────┘
         │
┌────────▼────────┐     ┌───────────────┐
│  CRDTManager    │◄────┤ WorldGenerator│
│  (Automerge)    │     │ (Procedural)  │
└────────┬────────┘     └───────────────┘
         │
┌────────▼────────┐
│ NetworkManager  │── P2P networking (libp2p)
│  (Gossipsub)    │
└─────────────────┘

Installation

npm install

Usage

npm start

Commands

Movement:

Actions:

Items:

Combat:

System:

Technology Stack

How It Works

1. Player Identity

Each player generates an Ed25519 key pair on first run:

2. Procedural World

The world is generated deterministically:

3. State Synchronization

Game state syncs via CRDT:

4. P2P Networking

Libp2p handles networking:

Project Structure

src/
├── client/
│   └── index.js          # Main game client & CLI
├── crypto/
│   └── manager.js        # Cryptography & key management
├── world/
│   └── generator.js      # Procedural world generation
├── crdt/
│   └── manager.js        # CRDT state management
└── network/
    └── manager.js        # P2P networking

Development

Run Tests

npm test

Add Bootstrap Nodes

Edit NetworkManager constructor to add bootstrap multiaddrs:

const network = new NetworkManager({
  bootstrapNodes: [
    '/ip4/127.0.0.1/tcp/8080/p2p/Qm...',
  ]
});

Limitations & Future Work

License

MIT

Contributing

This is a demonstration of decentralized game architecture. Contributions welcome!