Elevator dispatch algorithm playground
elevator-core is a deterministic, engine-agnostic Rust simulation library for elevators. This in-browser playground lets you compare dispatch strategies side-by-side on identical rider traffic, tweak car count, max speed, capacity, and door cycle, and share a permalink that reproduces the exact run. The same crate runs natively in Bevy, in Unity and GameMaker through a C ABI, in Godot via a gdext extension, and in the browser via wasm-bindgen.
Why elevator-core
- Engine-agnostic core. The simulation library has zero engine dependencies. Every host (Bevy, Unity, Godot, GameMaker, web) wraps the same crate.
- Deterministic, snapshot-replayable. Same config + seed produces bit-identical state tick-for-tick across hosts. Enforced in CI by a cross-process harness.
-
Pluggable dispatch. Six built-in strategies plus a
DispatchStrategytrait for custom controllers, settable per elevator group. - Game-agnostic riders. A rider is anything that rides; consumers attach game semantics through extension storage.
- Stops at arbitrary distances. Floors aren't uniformly spaced — the same primitives model a five-floor convention center and a kilometre-tall space elevator.
Dispatch strategies
- SCAN — sweeps end-to-end like a disk head. Simple, predictable, ignores who's waiting longest.
- LOOK — like SCAN but reverses early when nothing is queued further. A practical baseline.
- NEAREST — grabs whichever call is closest right now. Fast under light load, thrashes under rush.
- ETD — estimated time of dispatch. Assigns each call to whichever car can finish fastest.
- DCS — destination-control system. Riders pick their floor at the lobby; the group optimises assignments.
- RSR — relative system response. A wait-aware variant of ETD that penalises long queues.
Idle-parking strategies
- Adaptive — switches based on traffic; returns to lobby during up-peak, predicts hot floors otherwise. Default.
- Predictive — parks idle cars near whichever floor has seen the most recent arrivals.
- Lobby — sends every idle car back to the ground floor to prime the morning rush.
- Spread — keeps idle cars fanned out so any floor has a nearby option.
- Stay — leaves idle cars wherever they finished their last delivery.
Scenarios
- Skyscraper — 40 named floors plus three sub-basements and a sky lobby. Models morning rush, midday meetings, lunch crowd, evening commute, and late-night traffic across low/high banks, an executive line, and a service line.
- Space elevator — kilometres-long tether climbers between Earth station and orbital platforms. Stress-tests dispatch and parking when stops are far apart.
- Airport loop — two counter-rotating loops connect a terminal to six concourses. Fixed-headway dispatch on a one-way loop, with demand shifting from outbound (morning) to inbound (evening).
- Convention center — five named stops (Lobby, Exhibit Hall, Mezzanine, Ballroom, Keynote Hall). Tests burst traffic when a keynote lets out.
Frequently asked questions
- What is elevator-core?
- An engine-agnostic Rust simulation library for elevators. Models cars, stops, lines, riders, doors, and dispatch in a tick-based loop with a struct-of-arrays world. Same crate powers Bevy, Unity / .NET / GameMaker (via C ABI), Godot (via gdext), and the browser (via wasm-bindgen).
- Which engines does it support?
-
Bevy 0.18 natively, plus Unity, .NET, and GameMaker through
elevator-ffi, Godot through a gdext extension, and the browser throughelevator-wasm. The core crate has zero engine dependencies. - Which dispatch strategies are built in?
-
Six: SCAN, LOOK, NEAREST, ETD, DCS, and RSR. All implement the
DispatchStrategytrait so you can plug in your own. - Is the simulation deterministic?
-
Yes. Same config + seed produces bit-identical snapshots across every host.
elevator-contractenforces this in CI. - Can I share a specific simulator setup?
- Yes. The Share button copies a permalink encoding scenario, dispatch and parking strategies for both panes, the seed, intensity, traffic mode, and any tweaked physics parameters.
- What is Quest mode?
- A 15-stage curriculum that teaches the elevator-core API one primitive at a time. You write a controller in TypeScript inside an embedded Monaco editor and watch your code drive the cars.
Resources
- Source on GitHub — Cargo workspace with ten crates.
- elevator-core on crates.io — the simulation library crate.
- API documentation on docs.rs — generated from rustdoc.
- elevator-core guide — mdBook chapters covering the simulation loop, custom dispatch, snapshots and determinism, host bindings, and integration galleries for Bevy, Unity, Godot, and GameMaker.
- Dispatch strategies guide — deeper write-up of each built-in algorithm.
-
Writing a custom dispatch strategy — how to
implement the
DispatchStrategytrait.
If you can read this, JavaScript or WebAssembly is disabled in your browser; the interactive playground requires both. The links above let you read the same material as static documentation.