Rust voxel sandbox (wgpu + wasm + axum multiplayer)
Find a file
Maximus Gorog e4cf5a9bed Refactor: extract functional core into sim/ and net/
Reshape the engine into a functional-core / imperative-shell split.
The 2500-line state.rs blob is now 1700 lines of mostly GPU plumbing
plus a thin tick() shell that composes pure transformations from the
new sim/ and net/ modules.

src/sim/ (no GPU, no winit, no thread-locals — all pure):
  body.rs       PlayerBody value type + take_damage / respawned_at
  collision.rs  AABB primitives, sweep_axis returning (Vec3, bool)
                instead of mutating &mut Vec3
  edit.rs       block_from_u8, apply_edit, chunks_for_edit
  event.rs      SimEvent enum (Landed, VoidDeath, BlockEdited)
  input.rs      TouchBridge data type + merge_held
  physics.rs    step_movement(world, body, MoveInput) -> MoveOutcome
                — the central morphism: one tick of player movement
                + collision + landing detection + void check, returns
                a new body value and a list of events
  spawn.rs      find_safe_spawn, fall_damage

src/net/:
  parse_inbox(Vec<String>) -> Vec<NetEvent>
  Malformed lines drop silently; the shell folds typed events into
  the world / remote-player map.

src/state.rs:
  - App now holds a single PlayerBody value instead of scattered
    velocity / on_ground / hp / alive / max_y_since_ground fields.
  - tick() is a pipeline: collect input → merge_held → step_movement
    → fold sim events → block interaction → render_frame.
  - drain_net_inbox() parses to events first, then applies.
  - render_frame() extracted so the paused and active branches share
    the upload + cull + draw path.

Tests: 45 passing (up from 33). New coverage for the physics step
itself: airborne gravity, jump-only-when-grounded, long-fall-emits-
Landed, void floor, dead-body-does-not-move. Net parsing tests for
malformed lines and round-trips. Body tests for damage / respawn.

Build: cargo test (45/45), cargo build --target wasm32-unknown-unknown
--lib --release, and the axum server all green.
2026-05-23 18:55:05 -06:00
server pre-alpha 0.0.1 — initial multiplayer voxel sandbox 2026-05-22 23:33:47 -06:00
src Refactor: extract functional core into sim/ and net/ 2026-05-23 18:55:05 -06:00
web Render + UI polish since pre-alpha-0.0.1 2026-05-23 18:44:56 -06:00
.dockerignore Add Docker + Caddy deploy for voxel.mxvs.art 2026-05-23 18:45:05 -06:00
.gitignore pre-alpha 0.0.1 — initial multiplayer voxel sandbox 2026-05-22 23:33:47 -06:00
build-web.sh pre-alpha 0.0.1 — initial multiplayer voxel sandbox 2026-05-22 23:33:47 -06:00
Caddyfile Add Docker + Caddy deploy for voxel.mxvs.art 2026-05-23 18:45:05 -06:00
Cargo.lock pre-alpha 0.0.1 — initial multiplayer voxel sandbox 2026-05-22 23:33:47 -06:00
Cargo.toml pre-alpha 0.0.1 — initial multiplayer voxel sandbox 2026-05-22 23:33:47 -06:00
DEPLOY.md Add Docker + Caddy deploy for voxel.mxvs.art 2026-05-23 18:45:05 -06:00
docker-compose.prod.yml Add Docker + Caddy deploy for voxel.mxvs.art 2026-05-23 18:45:05 -06:00
docker-compose.yml Add Docker + Caddy deploy for voxel.mxvs.art 2026-05-23 18:45:05 -06:00
Dockerfile Add Docker + Caddy deploy for voxel.mxvs.art 2026-05-23 18:45:05 -06:00
run.sh pre-alpha 0.0.1 — initial multiplayer voxel sandbox 2026-05-22 23:33:47 -06:00