terainia/build-web.sh
Maximus Gorog 3a4ae970b2 pre-alpha 0.0.1 — initial multiplayer voxel sandbox
Web/wasm Rust voxel game with:
- wgpu 23 client (WebGPU when available, WebGL2 fallback)
- Chunked terrain (17x17 chunks, deterministic value-noise generator)
- Greedy meshing with frustum + distance culling
- Sky shader, leaf wind shader, distance fog
- Player physics: substepped AABB collision, gravity, fall damage,
  natural-surface respawn
- Touch UI (MCPE-style joystick + jump/break/place/sprint),
  gamepad polling with axis calibration, mouse+keyboard
- HP / death-screen / respawn flow
- 10-slot hotbar with mouse-wheel + hotkey + tap cycling
- Settings menu (mouse sens, FOV, render distance, input mode toggle)
- Axum multiplayer server: WebSocket protocol, edit log,
  10Hz player broadcasts
- 31 unit tests covering spawn invariants, collision sweeps,
  raycast hit/miss, greedy mesh winding, fall damage, oriented
  box rotation, hotbar block roundtrip, and the input-merge
  regression that latched movement after touch release

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-22 23:33:47 -06:00

31 lines
902 B
Bash
Executable file

#!/usr/bin/env bash
# Build the wasm bundle and copy it into ./web so you can serve that directory.
#
# Requires: wasm-bindgen-cli installed (`cargo install wasm-bindgen-cli`)
# and the wasm32 target (`rustup target add wasm32-unknown-unknown`).
set -euo pipefail
cd "$(dirname "$0")"
MODE="${1:-release}"
case "$MODE" in
release)
cargo build --target wasm32-unknown-unknown --release --lib
WASM="target/wasm32-unknown-unknown/release/voxel_game.wasm"
;;
debug)
cargo build --target wasm32-unknown-unknown --lib
WASM="target/wasm32-unknown-unknown/debug/voxel_game.wasm"
;;
*)
echo "usage: $0 [release|debug]" >&2
exit 1
;;
esac
wasm-bindgen --target web --out-dir web --no-typescript "$WASM"
echo
echo "Build complete. Serve the web/ directory, e.g.:"
echo " python3 -m http.server --directory web 8080"
echo "Then open http://localhost:8080/"