Introduction
RE is an open-source game engine: the runtime and editor are written in Rust, services and tooling (servers, build farms, launchers) in Go. One codebase targets PC and web, with console backends that can be attached privately. Rendering runs on wgpu from a single WGSL shader source.
The signature feature
Everything in this engine is built around one demo: the camera drops from the top-down strategy overview into a unit's first-person view — mid-flight, with no loading screen and no cut — and hands over control on the way. The same stack then serves a shooter or an MMO, because the runtime carries no game rules.
That goal shapes the design: world data streams continuously (no scene rebuilds), quality tiers adapt per instance, and the control handoff is a numeric blend, not a level transition.
Three layers of documentation
| Layer | Audience | Where |
|---|---|---|
| This handbook | learning the engine end to end | here |
| rustdoc | exact API of every crate | /rustdoc/ on this site |
| API browser in the editor | browsing while working | ships with M4 |
The source of truth for both generated layers is the crate documentation itself — every public item carries rustdoc, and the handbook chapters link into it.
Where to go next
- New to the project? Getting Started builds and runs the streaming fly-over demo in a few minutes.
- Evaluating the design? Architecture Tour.
- Writing game or tool code? Using the Engine from Rust.
The living plan with every checklist item is docs/roadmap.md.
Getting Started
Prerequisites
A stable Rust toolchain (1.85 or newer) and Git. On Linux the windowed build needs the usual X11/Wayland development libraries; headless builds need nothing beyond the toolchain.
Build and test
git clone https://github.com/Isalla/rustengine
cd rustengine
cargo build --workspace
cargo test --workspace
On machines without a display (servers, CI, a Raspberry Pi) build the
backend headless — the window feature is what pulls in winit:
cargo build -p re-wgpu --no-default-features
The streaming fly-over
stream-demo is the end-to-end proof of the world pipeline: it bakes a
procedural terrain world into block files, streams it through async
file IO, a streaming budget, the GPU handoff and far-field HLOD — and
flies a camera over it, switching to first-person on the way.
cargo run -p re-wgpu --bin stream-demo -- \
240 flight.png 960 540 ./flight_cells
Arguments: frames, output PNG, width, height, cells directory. The run prints one summary line per subsystem:
Welt erzeugt: 2322 Blöcke (1156 B/Block) in ./flight_cells/ — Flugstrecke 800 m
Flug beendet: 240 Frames, geladen=458, fehlgeschlagen=0, verdrängt=104, …
HLOD: 195 Cluster registriert, 65 Übernahmen, 0 Rückgaben, …
IO-Telemetrie: 458 Lasten, 0 Fehler, Latenz Ø 16.7 ms, … Gesundheit 0.67
Ego-Handoff: Attach bei Frame 80, Blende 1.0 s, 102 Frames in Ego-Höhe …
The last frame is written to flight.png (plus a second image taken
mid-blend). On slow hardware each frame takes a moment — the software
renderer is honest, just patient.
The scene viewer
re-demo renders a Worldbuilder project (.wbproj) offscreen to PNG
or opens it in a real window with an orbit camera:
cargo run -p re-wgpu --bin re-demo -- scene.wbproj out.png
cargo run -p re-wgpu --bin re-demo -- scene.wbproj --live
What to read next
Architecture Tour explains what each summary line above actually measured.
Architecture Tour
Crates and their jobs
| Crate | Job |
|---|---|
re-core | Data model: scene graph, meshes, materials, animations, terrain, tilesets |
re-io | Scene file I/O: glTF 2.0/GLB, OBJ+MTL, binary FBX (≥ 7.4) and the USD ASCII subset; texture loading with mip chains, incl. native DDS (BC1–BC5, BC7), KTX2 containers (uncompressed + BC, ETC2/EAC, ASTC, Basis UASTC and ETC1S) and OpenEXR |
re-ecs | Entity-component-system: world, sparse-set storage, schedule |
re-world | World partition: grid, clipmap, tiers, streaming, HLOD, telemetry, ego handoff |
re-render | Backend-neutral render layer: GfxBackend trait, camera, draw batches |
re-wgpu | The wgpu backend (Vulkan/Metal/WebGPU), offscreen and windowed |
re-platform | Windows, input, event loop (App trait), time |
re-agent | Capability registry, AI providers, agent-facing world tools |
re-editor | Editor frontend: document state, undo stack, outliner, project/import capabilities |
Dependencies point one way: re-world knows nothing about rendering,
re-render knows nothing about windows, and re-core knows nothing
about any of it. The binaries in re-wgpu (re-demo, stream-demo)
are where the layers meet.
The data flow of one frame
re-platform (events, dt)
└─ re-world WorldPartition::update(camera, dt)
├─ clipmap follows the camera → cell demand
├─ streamer loads/evicts within budget (async IO threads)
├─ tiers re-grade instances (T0..T4)
└─ HLOD takes over at the clipmap rim
└─ re-world CellHandoff: triple-buffered upload, byte quota/frame
└─ re-render DrawBatch list → GfxBackend::render
└─ re-wgpu WGSL pipelines, present
Three doctrines
Headless, deterministic core. re-world contains no threads except
the swappable IO source, and no GPU types at all. Given the same dt
sequence and the same camera path, WorldPartition::update replays
identically — which is why the streaming core is testable on a
Raspberry Pi before any graphics exist.
Interfaces, not spaghetti. Every seam is a trait: CellSource
(where cells come from), GpuUpload (how they reach the GPU),
GfxBackend (what renders), App (who drives the loop). Backends and
console SDKs attach at these traits; nothing forks internally.
One capability layer. Editor tools and AI tools read the same
CapabilityRegistry — see Capabilities & AI.
Where to read the code
Start at crates/re-world/src/partition.rs — WorldPartition composes
every streaming subsystem and its module docs state the ordering
guarantees. Then follow stream.rs (budget) and handoff.rs (GPU
pipeline). The rustdoc for all of this is
here.
World Streaming
This chapter follows one cell from disk to screen. Everything lives in
re_world.
Grid and clipmap
The world is an infinite grid of equal-sized square cells
(CellKey { level, x, y }). Around the camera sit several clipmap
levels: level 0 uses the base cell size, each outer level doubles it.
A cell belongs to the finest level that still covers it, so coverage
costs memory once, not per level.
#![allow(unused)] fn main() { use re_world::{Clipmap, ClipmapConfig}; let mut clip = Clipmap::new(ClipmapConfig { base_cell: 64.0, radius: 2, levels: 3 }); clip.set_center(glam::Vec2::new(500.0, 0.0)); // → ClipDiff of entered cells }
The streamer and its budget
Streamer keeps cells resident within a byte budget. Demand comes in
as (CellKey, Priority); loads run through a CellSource — either
MockSource (deterministic, for tests) or AsyncSource (real file IO
on worker threads, decoding through a CellCodec closure). Evicted
cells linger in an LRU until the budget truly needs their bytes, so
turning around doesn't reload.
GPU handoff
CellHandoff is a triple-buffered pipeline between streamer and GPU:
each frame uploads at most a byte quota, freshly uploaded cells become
visible only after their upload retires, and released cells go back
after a grace period. The render loop never blocks on IO — that is what
makes "no loading screen" a property of the pipeline, not of luck.
Quality tiers and the ego handoff
Every instance carries a tier T0..T4 graded by distance to the camera
with hysteresis and a minimum dwell time, so a walking camera can't
make tiers flicker. The ego handoff (re_world::ego::EgoHandoff)
is the signature move: the camera glides along a smoothstep blend from
the strategy anchor to the unit, input ownership transfers when the
blend lands, and the world pipeline never notices — same cells, same
budget, no rebuild.
HLOD and IO telemetry
Beyond the clipmap's reach, HlodSet shows baked far-field summary
clusters instead of nothing; take-over zones use hysteresis and a
fade-out ring. Meanwhile IoTelemetry measures real load latency and
throughput — on a slow disk the tier rules degrade earlier
(PartitionConfig::tiers_adaptive).
Driving it
#![allow(unused)] fn main() { let mut partition = WorldPartition::new(cfg, source); let id = partition.spawn(unit_pos, Some(camera)); loop { let delta = partition.update(camera, dt); // loaded/evicted/tier changes // feed delta.loaded into CellHandoff, render, repeat } }
stream-demo is the runnable version of exactly this loop.
Using the Engine from Rust
The engine is a workspace of ordinary Rust crates — depend on the ones you need, no code generation, no plugin loader:
[dependencies]
re-core = { path = "engine/crates/re-core" }
re-world = { path = "engine/crates/re-world" }
re-render = { path = "engine/crates/re-render" }
re-wgpu = { path = "engine/crates/re-wgpu" }
re-platform = { path = "engine/crates/re-platform" }
glam = "0.30"
Math runs on glam types (Vec2, Vec3, Mat4) across all crate
boundaries. Errors are ordinary enums: GfxError, LoadError,
CapabilityError, each with thiserror messages.
The traits you may implement
| Trait | Crate | You implement it when… |
|---|---|---|
CellSource | re-world | cells come from somewhere unusual (network, database, procedural) |
GpuUpload | re-world | you feed a different GPU layer or record uploads for tests |
GfxBackend | re-render | you attach another rendering backend |
App | re-platform | you drive a window/event loop (game, editor, tool) |
A minimal App:
#![allow(unused)] fn main() { use re_platform::{App, AppResponse, PlatformEvent, run_app, WindowOptions}; struct MyGame; impl App for MyGame { fn on_event(&mut self, ev: PlatformEvent) -> AppResponse { match ev { PlatformEvent::Tick { dt, .. } => { /* simulate, render */ } PlatformEvent::Closing => return AppResponse::Exit, _ => {} } AppResponse::Continue } } run_app(&mut MyGame, WindowOptions::default()).unwrap(); }
Async without a runtime
The engine deliberately has no tokio. IO worker threads live inside
AsyncSource; the one-shot awaits (wgpu device setup) use a minimal
block_on exported by the platform layer. Game code stays synchronous
per frame — async is a storage detail, never a calling convention.
Determinism contract
Anything in re-world replays identically for identical inputs: fixed
event ordering, no wall-clock reads, no hidden global state. Keep it
that way in your systems if you want replays and headless tests.
Feature flags
re-wgpu/re-platform:window(default) pulls in winit; build--no-default-featuresfor headless CI and single-board machines.
Full signatures for every item above: rustdoc index.
Capabilities & AI
The engine's second signature idea: every function a human can operate in the editor is a named, JSON-schema'd capability that an AI agent can call — the same code path, the same permissions. The roadmap calls this the rule of double addressability.
The registry
re_agent::CapabilityRegistry holds ToolSpec (name, description,
parameter schema) plus a runner closure. One registry serves three
consumers: the editor UI, the in-process agent loop (run_agent with
an AiProvider — Ollama, llama.cpp, OpenAI-compatible, Anthropic), and
an MCP export for external clients.
World tools
re_agent::register_world_tools binds a live WorldPartition into the
registry behind an Arc<Mutex<…>> shared with the editor:
| Tool | What it does |
|---|---|
world.stats | time, camera, cell budget, IO telemetry, HLOD, instance count |
world.cells.resident / world.cell.state | what is streamed where |
world.hlod.list | far-field clusters |
world.instances.list / .spawn / .move / .remove | scene editing |
world.camera.set / world.tick | move the viewpoint, advance the simulation |
#![allow(unused)] fn main() { use re_agent::{register_world_tools, CapabilityRegistry, SharedWorld}; let mut reg = CapabilityRegistry::new(); register_world_tools(&mut reg, shared_world); let stats = reg.call("world.stats", serde_json::json!({})).unwrap(); }
Why it matters
Because editing and querying run through one door, an agent can do exactly what the editor does — no second scripting API to keep in sync, no "automation layer" that drifts from the UI. The M4 editor consumes the same registry for its own panels.
Rustdoc: re_agent.
The Editor
The editor is not a second application bolted beside the engine. It is one
more consumer of the same CapabilityRegistry the AI
agent uses — the rule of double addressability made concrete. Everything
the window will do with a button click is already callable by name today,
and vice versa.
The composition root
re_editor::EditorContext owns every shared handle the editor needs and
wires them into a single registry:
| Handle | Holds | Addressed by |
|---|---|---|
state | camera, selection, view mode, frame count | editor.* |
undo | the CommandStack<EditorState> | editor.undo / .redo / .history |
project | a ProjectDoc (project + path + dirty flag) | project.*, import.* |
world | the ECS World | ecs.* |
registry | which components are inspectable | ecs.entity.* |
#![allow(unused)] fn main() { use glam::Vec3; use re_editor::EditorContext; use serde_json::json; let ctx = EditorContext::new(Vec3::new(0.0, 80.0, 0.0)); // The camera, through the same door the GUI will use. ctx.call("editor.camera.set", json!({ "x": 12.0, "yaw": 0.4 })).unwrap(); // A project, saved and reloaded by path. ctx.call("project.new", json!({ "name": "MyScene" })).unwrap(); ctx.call("project.save", json!({ "path": "myscene.wbproj" })).unwrap(); }
Undo / redo as reversible systems
Every editor action is a Command: apply runs it, undo reverses it.
The CommandStack keeps a cursor over the history; a new action after an
undo drops the redo branch (standard semantics). Commands are generic over
their target, so the same stack drives the editor state, a scene, or a
world handle.
#![allow(unused)] fn main() { use re_editor::{CommandStack, EditorState, SetCameraCommand}; use glam::Vec3; let mut state = EditorState::new(Vec3::ZERO); let mut stack = CommandStack::new(128); let old = state.camera.clone(); stack .execute( Box::new(SetCameraCommand { old, new: re_editor::EditorCamera::new(Vec3::X) }), &mut state, ) .unwrap(); stack.undo(&mut state).unwrap(); // back to the origin }
The camera fly-through itself is deliberately not undoable — undo is for scene and document edits, not for moving your own viewpoint.
Outliner & inspector over the ECS
re_ecs::World stores components type-erased, so the inspector needs a
ComponentRegistry that knows how to serialize each type it should show.
Register a type once and it becomes readable and writable through the
capability channel:
#![allow(unused)] fn main() { use re_editor::ComponentRegistry; let mut reg = ComponentRegistry::new(); reg.register::<re_core::transform::Transform>("Transform"); }
| Tool | What it does |
|---|---|
ecs.entities | list every live entity |
ecs.entity.components | which component types an entity carries |
ecs.entity.get | read one component as JSON |
ecs.entity.set | write component fields from JSON |
Import and project files
re_editor::import wraps re_io's model readers (glTF/GLB, OBJ with
MTL materials — the extension picks the format) behind three tools:
import.preview reports mesh/material/node/animation counts without
touching the open document; import.gltf and import.obj load the
file as the current project and mark it dirty. re_editor::project
keeps the document (ProjectDoc) with its path and dirty flag, so save/load round-trips are
addressable too.
Where it stands
Today the editor ships the scene view — a free-fly camera into the
streaming world, with a headless smoke path for CI — and a full
on-screen frontend: a default preset with menu bar, toolbar, outliner,
inspector and console over the docking layout, resizable by grabbing
splitters and redockable by dragging tabs. Every panel is data-driven
(ADR-0001) and talks to the engine only through EditorContext::call,
so an agent can do exactly what the mouse can — including the
inspector's direct value editing: click a number field to type, or drag
the property name to scrub a value live (horizontal drag, UE5-style:
Shift speeds up ×10, Ctrl refines ×10; the cell keeps its old value and
the live number rides in a box under the row; every write still goes
through ecs.entity.set).
Rustdoc: re_editor.
Contributing
Ground rules
cargo test --workspacemust stay green; every feature ships with tests, andcargo docstays warning-free (CI enforces both).- Small commits. A feature commit flips its roadmap checklist box —
in both
docs/roadmap.mdanddocs/roadmap.de.md. - User-facing docs are bilingual: English is the plain name, German
gets the
.de.mdtwin. Code comments may be German. re-worldstays headless and deterministic; threads belong inio.rsonly.
Doc style
Public items carry rustdoc with a one-line summary and a # Panics /
safety note where relevant — the website's rustdoc layer and the
editor's future API browser are generated from exactly those comments,
so a missing doc comment is a missing feature.
Proposing changes
Open an issue before larger changes. The roadmap's milestone sections mark what is planned; anything else needs a conversation first.
License
MIT — Copyright (c) 2026 Waldemar Friesen. Contributions arrive under the same terms; the copyright and license text must be carried unchanged when redistributing.