MudEngine Part 11: Peer-to-Peer (Hybrid)
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.
[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 = []
| Removed | Added |
|---|---|
dioxus/fullstack | iroh with gossip |
dioxus-fullstack | iroh-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.
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).