← All Workshops

MudEngine Part 11: Peer-to-Peer (Hybrid)

Step 3 / 12

Add iroh dependencies

Replace the fullstack dependencies with iroh. The dioxus-native dependency stays for the Blitz renderer, serde stays for message serialization, toml stays for the game world file.

The key change: dioxus/fullstack and dioxus-fullstack are gone. They are replaced by iroh with the gossip feature for P2P networking.

The dioxus/router feature is also no longer needed — there is only one screen (the game view). Connection is handled by the P2P layer, not by URL-based routing.

mud-engine/Cargo.toml
[package]
name = "mud-engine"
version = "0.1.0"
edition = "2024"

[dependencies]
dioxus-native = "0.7"
dioxus = "0.7"
serde = { version = "1", features = ["derive"] }
toml = "0.8"
iroh = { version = "1", features = ["gossip"] }
iroh-mdns-address-lookup = "0.4"
tokio = { version = "1", features = ["sync"] }

[features]
default = ["desktop"]
desktop = []
relay = []
🔍 What changed
RemovedAdded
dioxus/fullstackiroh with gossip
dioxus-fullstackiroh-mdns-address-lookup
dioxus/router
uuid

The relay feature is optional — it compiles the WebSocket relay into the binary. When you run the host app without --features relay, the relay is not started.

💡 tokio is still needed

iroh runs on tokio. The DioxusNativePreset already includes a tokio runtime, so iroh will piggyback on it. We keep tokio with the sync feature for channels and broadcast (the game logic still uses them internally before publishing to iroh-gossip).

Step 3 / 12