← All Workshops

MudEngine Part 10: Desktop with Blitz

Step 5 / 13

Run the native client

The server/client split works differently with the Blitz renderer. Since dioxus-native builds a native binary (not WASM), dx serve --desktop doesn't apply here — that command uses the wry-based desktop renderer.

Instead, we run the server and client as separate binaries. The dx serve command compiles and starts the Axum server. The native client is a separate process that connects to it.

Terminal 1: Start the server

Start the Axum server
dx serve
🔄 What dx serve does here

The dx serve command compiles the server binary (with --features server) and the web client WASM bundle (the default). It starts the Axum server on port 8080.

The native client doesn't need to be compiled by dx — it's a separate cargo run invocation.

Terminal 2: Start the native client

In a second terminal, run the native client directly with cargo:

Launch native MUD client
cargo run
🎯 What happens
  1. cargo run compiles the project without the server feature
  2. The native arm runs set_server_url("http://localhost:8080")
  3. dioxus_native::launch_cfg(App, vec![], vec![Box::new(cfg)]) opens a winit window with the Blitz renderer
  4. The renderer loads your CSS from assets/main.css (via document::Stylesheet) — but through Blitz's own CSS parser, not a browser's
  5. The WebSocket connects to the server at localhost:8080
  6. The MUD UI renders — name screen, grid, sidebar, D-pad — all drawn by WGPU/Vello

Open http://localhost:8080 in a browser alongside the native window to see both clients sharing the same game world.

🔌 How the desktop client connects to the server

To be clear: the desktop window never starts the server. It is a pure client — cargo run only opens the window; the game server must already be running in the other terminal (dx serve). This is why two terminals are mandatory, not optional.

Once the window is open, the wiring is identical to the browser client:

  1. set_server_url("http://localhost:8080") points every fullstack request (HTTP + WebSocket) at the Axum server. Without it the native client has no "origin" to talk to.
  2. The name screen renders locally — no network needed yet.
  3. Clicking Enter the World runs use_websocket's connect server function: an HTTP upgrade handshake against localhost:8080 opens the same WebSocket the WASM client uses.
  4. From there it's the normal protocol: ClientMessage::Join(name) up, ServerMessage broadcasts down.

So the browser tab and the desktop window are peers on one server — neither is the server. If dx serve isn't running, the name screen still shows, but joining hangs.

🪟 What the window looks like

The native window will have:

  • OS chrome — standard title bar, close/minimize/maximize buttons (provided by winit)
  • Dark background — the CSS gradient from assets/main.css rendered by Vello
  • No address bar — it's a native app, not a browser
  • GPU-accelerated rendering — the WGPU backend uses Vulkan (Linux/Windows), Metal (macOS), or DX12 (Windows)
⚠️ What might not work

Because Blitz is experimental, several CSS features used by the MUD may not render correctly:

  • linear-gradient backgrounds — may appear as a solid colour
  • box-shadow — may be missing or incorrect
  • transition / animation — not implemented yet
  • position: fixed — the floating player list may not stay pinned
  • filter: brightness() — may not work on hover
  • @keyframes — the quest pulse animation won't animate

The UI will still be functional — the grid, buttons, input, and chat will work. It may just look slightly different from the browser version.

This is the nature of an experimental renderer. Each week the Blitz team ships more CSS support.

Step 5 / 13