This file provides guidance to WARP (warp.dev) when working with code in this repository.
- Build:
cargo build(Use--releasefor performance testing/running, as validation layers in debug can be slow) - Run (Flatscreen):
cargo run -- -f(Forces flatscreen mode for debugging without headset) - Run (VR/AR):
cargo run - Test:
cargo test - Lint:
cargo clippy - Run Single Test:
cargo test -- <test_name>
Stardust XR Server is a display server for XR, built using Rust and the Bevy game engine.
- Core Loop: The application runs a Bevy app loop (
src/main.rs). It integratestokiofor async networking alongside Bevy's ECS. - Client/Server:
- Clients connect via Unix domain sockets.
src/core/client.rsmanages client connections, message dispatching, and lifecycle.- The server communicates with clients using a custom protocol defined in
stardust-xrand generated via thecodegencrate.
- Scenegraph:
- The world is composed of Nodes (
src/nodes/mod.rs). - Nodes have Aspects which define their capabilities (e.g.,
Spatial,Drawable,Input). src/nodes/contains implementations for different node types.
- The world is composed of Nodes (
- XR Integration:
- Uses
bevy_mod_openxrfor OpenXR support. src/objects/handles XR-specific objects like HMDs, controllers, and playspaces.
- Uses
- Wayland Integration:
- The
waylandfeature (src/wayland/) implements a Wayland compositor to allow running standard 2D Linux applications within the XR space.
- The
src/core: Core infrastructure (clients, tasks, entity handles).src/nodes: Scenegraph node implementations (Spatial, Model, Text, Audio, etc.).src/objects: System objects (HMD, Input, PlaySpace).src/wayland: Wayland compositor implementation (requireswaylandfeature).codegen: Procedural macros for generating protocol-related code.
- Async/Sync Bridge: The codebase bridges
tokioasync tasks with Bevy's synchronous ECS. Watch out for deadlocks or blocking the main thread. - Protocol Generation: Changes to the client/server protocol often involve the
codegencrate. - Flatscreen Mode: Use
cargo run -- -fto develop and test without needing an active VR headset.