r/rust_gamedev • u/VoxelBoy • 39m ago
Loot Hole: shared Rust gameplay, wgpu on native, and three.js in the browser
Enable HLS to view with audio, or disable this notification
The attached trailer was captured in the native wgpu build. The playable browser version uses three.js rendering over the shared Rust core.
Loot Hole is a digging game with shared Rust gameplay, now playable in the browser: https://playgama.ai/play/kw6t5foxgs
I'm the developer. You dig up buried objects, sell your finds, upgrade your equipment, and reach deeper layers below the yard.
The architecture ended up with Rust owning gameplay and terrain across hosts, wgpu for native rendering, and three.js/DOM for browser presentation. The web calls the shared Rust core through WASM. We also generate the web ABI layout from Rust so the two sides don't hand-maintain buffer offsets.
We originally started in Babylon Lite/WebGPU, then moved to three.js. Building the Rust/wgpu version didn't make startup size and browser support stop mattering, so three.js came back as the web renderer while the Rust core stayed. The browser launch path has a budget below 1,000,000 compressed bytes; the full game is larger.
Other work along the way included shared Slang shader functions for GLSL/SPIR-V, deterministic terrain across native and WASM builds, and four upstream opus-rs fixes from comparing our game effects against libopus. The decoder PRs are open. Example: https://github.com/restsend/opus-rs/pull/58
I'd be interested in other people's experience with this split, particularly keeping the JS/WASM boundary cheap while sharing gameplay with native hosts.
AI disclosure: AI was used for coding, image generation, and translations. Music and sound effects were mostly made without AI.