Getting Started

Xodó compiles and tests on its own without any external game files. macOS and iOS run on Metal, and the browser runs on WebGPU through Emscripten. Windows and Linux are not supported.

Prerequisites

  • Rust — Edition 2024 toolchain (nightly with rust-src for browser WebGPU builds)
  • Bun — Installs Slang and runs the shader and tool build scripts in build/
  • Xcode & Metal toolchain — Required for macOS and iOS native builds (xcodebuild -downloadComponent MetalToolchain)
  • SDL3 — System library on macOS, or static libSDL3.a via ENGINE_SDL3_IOS_DIR on iOS
  • Emscripten — Optional, required for --web browser builds

Building

Run all commands from the Xodó repository root:

sh
# 1. Install Slang
bun build/slang.ts

# 2. Generate Rust shader modules (outputs to target/build/device-shaders/)
bun build/build.ts shaders

# 3. Build the Rust workspace
cargo build --locked --workspace

Native builds embed LZFSE-compressed Metal libraries compiled offline from Slang's MSL output with Xcode's Metal toolchain. See Build-time Metal libraries.

Web and iOS Targets

sh
# Generate WGSL shader inputs for Emscripten / WebGPU
bun build/build.ts shaders --web

# Generate iOS Metal libraries alongside macOS shaders
bun build/build.ts shaders --ios

# Build for the iOS simulator (requires ENGINE_SDL3_IOS_DIR and ENGINE_SHADER_DIR)
cargo build --locked --target aarch64-apple-ios-sim -p engine-ui

When run from a host project, shader outputs default to that project's build/device-shaders/. Hosts can override locations with ENGINE_BUILD_DIRECTORY (shader generation) and ENGINE_SHADER_DIR (crate compilation). See Workspace & Rust Rules and iOS for details.

Testing & Linting

sh
# Run the full workspace test suite
cargo test --locked --workspace

# Run Clippy across all crates and targets
cargo clippy --workspace --all-targets
  • Tests that use Metal require display access.
  • Tests marked #[ignore] document any additional fixture or GPU timing requirement they expect.

Examples & Samples

Stage examples (engine-stage-render)

sh
cargo run -p engine-stage-render --example sprites
cargo run -p engine-stage-render --example tilted
cargo run -p engine-stage-render --example lit
cargo run -p engine-stage-render --example hdr
cargo run -p engine-stage-render --example world

Stage + UI HUD (engine-ui)

Composes a stage scene under a toolkit HUD (-- --capture out.png saves one frame):

sh
cargo run -p engine-ui --example stage_hud

iOS simulator samples

sh
bun samples/ios-ui/run.ts --device "iPhone 17" --screenshot shot.png
bun samples/ios-stage/run.ts --device "iPhone 17" --screenshot shot.png

Integrating with a Host

A host (a game or desktop tool) keeps a checkout of Xodó beside its sources via a xodo symlink and depends on the crates it needs by path. The engine takes its inputs as plain values and hardcodes nothing about a specific game:

  • Host profile — Register a HostProfile (assets/src/host.rs) with register_host before loading: the names of its settings and object kinds, configuration key mappings (assets/src/settings.rs), shipped file replacements, and file decoders. Reads that require a registered name panic until a profile is registered.
  • Object kinds — The engine recognizes a fixed set of object kinds by name (assets/src/kinds.rs). A host's converter maps its content onto them and leaves host-specific kinds opaque.
  • Scene inputs — WorldScene walks the body and route (core/src/world.rs) supplied by the host to stream nearby regions and far terrain; the stage draws them (World capabilities).
  • Languages — Hosts register a language type, file suffix, and resource language with register_language (assets/src/language.rs).
  • Load profiling — Hosts and engine crates record startup and loading stages with load_profile! (core/src/load_profile.rs).
  • Packs — Hosts and asset viewers enumerate and read files from seekable .xpak archives through assets/src/pack.rs.