← All Workshops
MudEngine Part 11: Peer-to-Peer (Hybrid)
Step 12 / 12
Congratulations!
You just rebuilt the MudEngine as a peer-to-peer application — no central server, no fullstack deployment, no cloud dependency.
The architecture in three sentences
Desktop players connect directly via QUIC — no server, no relay. Browser players connect via WebSocket to a tiny relay that pipes their messages into the same gossip mesh. The host's desktop app owns the game world — the same
GameState,can_move(), and quest logic from Parts 7–9, running in-process alongside the Dioxus UI.
What you removed compared to Part 10
dioxus/fullstack— no Axum, no server functions, no SSRdioxus-fullstack— nouse_websocket, noWebSocketOptions#[cfg(feature = "server")]— no server/server splitdx serve— the desktop binary runs withcargo run- UUID dependency — iroh's
PublicKeyreplaces UUID for player identity
What's next?
This workshop series is complete. You have built a multiplayer MUD engine through eleven parts:
- Environment setup
- Terminal REPL
- File-based world loading
- Dioxus GUI (single-player)
- Component library polish
- Multiplayer with WebSockets
- Save & load persistence
- Inventory and chat
- Cooperative quest
- Desktop with Blitz renderer
- Peer-to-peer hybrid (this part)
The dungeon is yours. Extend the world, add new quests, build an editor, or port it to mobile — the engine is in your hands.
🎯 What we achieved
| Concept | How we used it |
|---|---|
| iroh Endpoint | Each player is a QUIC endpoint with a unique Ed25519 key |
| iroh-gossip | Replaced broadcast::Sender for real-time game state distribution |
| mDNS discovery | Players on the same LAN find each other automatically |
| Authoritative host | One desktop player owns GameState; everyone else connects to them |
| WebSocket relay | Bridges browser players into the gossip mesh without modifying game logic |
| Game engine extraction | GameEngine is a plain Rust struct, independent of any transport |
📚 What we learned
| Concept | How we used it |
|---|---|
| iroh Endpoint | QUIC-based P2P connection with Ed25519 identity |
| iroh-gossip | Publish-subscribe mesh for broadcasting game state |
| mDNS address lookup | Automatic LAN peer discovery |
| Authoritative host | One peer owns the game state; no CRDT needed |
| WebSocket relay | Bridges browser clients into the iroh mesh |
| GameEngine extraction | Game logic as a library, independent of transport |
| Hybrid architecture | Desktop players use QUIC, browser players use WebSocket |
Step 12 / 12