A browser-based alchemical factory/survival sandbox built with Rust + WebAssembly and Bevy.
Play the current build here: https://dygitz.github.io/foundry/
This repo is structured to keep simulation/game state independent from rendering and browser APIs:
- Core world/simulation types live in
simulation_core - Persistence contracts live in
persistence - IndexedDB implementation lives in
web_storage_indexeddb - Bevy frontend lives in
bevy_frontend
- Chunked world streaming + caching + eviction
- Deterministic terrain generation
- Ores/resources and mining (collected into inventory)
- Player movement + camera follow + mouse-wheel zoom
- Crafting menu + placeable structures (Athanor, Reliquary, Brass Arm, Extractor, Alembic, Crucible)
- Athanor smelting (ore -> calx), Alembic distillation (reagents -> essences), Crucible transmutation (essences -> components), and Reliquary storage UI
- Directional Brass Arms with inspectable internal buffers that move items between Reliquaries, Athanors, Extractors, Alembics, and Crucibles
- Persistent world data + inventory (IndexedDB, autosave + recovery)
- Move: WASD / Arrow keys
- Mine / interact: Left click (resource tiles; open structure UI)
- Pick up placed structures: Hold right click on the structure
- Crafting/inventory: E to open/close; click recipe icons to craft
- Map: M to open/close; drag to pan; mouse wheel to zoom
- Hotbar: 1-0 to select crafted placeables; left click to place; Esc/right click clears selection
- Quick place: F selects Athanor, C selects Reliquary, I selects Brass Arm, D selects Extractor, L selects Alembic, X selects Crucible
- Rotate Brass Arm before placement: R
- Close UI panels: Esc or right click
- Zoom: Mouse wheel
Open browser DevTools → Application → IndexedDB → delete the game_worlds database
-
simulation_core/
Pure Rust game state + world/chunk data structures and deterministic generation.
No Bevy, no browser APIs. -
persistence/
Traits + types for world storage and codecs (stable contracts). -
web_storage_indexeddb/
WorldStorageimplementation using IndexedDB (WASM only). -
bevy_frontend/
Bevy app: rendering, input, UI, async pumps, chunk streaming orchestration.
- Rust (stable): https://rustup.rs
- WASM target:
rustup target add wasm32-unknown-unknown
- Trunk:
cargo binstall trunk
trunk serveThen go to http://127.0.0.1:8080