A fully decentralized, peer-to-peer text-based multiplayer game with procedural world generation.
┌─────────────────┐
│ Game Client │
│ (CLI/Web) │
└────────┬────────┘
│
┌────────▼────────┐
│ CryptoManager │── Player keys & signatures
└────────┬────────┘
│
┌────────▼────────┐ ┌───────────────┐
│ CRDTManager │◄────┤ WorldGenerator│
│ (Automerge) │ │ (Procedural) │
└────────┬────────┘ └───────────────┘
│
┌────────▼────────┐
│ NetworkManager │── P2P networking (libp2p)
│ (Gossipsub) │
└─────────────────┘
npm install
npm start
Movement:
north / n - Move northsouth / s - Move southeast / e - Move eastwest / w - Move westgo <direction> - Move in specified directionActions:
look / l - Look aroundstatus / s - Show player statusinventory / i - Show inventoryItems:
take - Pick up itemdrop <item> - Drop itemuse <item> - Use itemCombat:
attack - Attack monsterSystem:
help - Show helppeers - Show connected peersquit - Exit gameEach player generates an Ed25519 key pair on first run:
The world is generated deterministically:
Game state syncs via CRDT:
Libp2p handles networking:
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
npm test
Edit NetworkManager constructor to add bootstrap multiaddrs:
const network = new NetworkManager({
bootstrapNodes: [
'/ip4/127.0.0.1/tcp/8080/p2p/Qm...',
]
});
MIT
This is a demonstration of decentralized game architecture. Contributions welcome!