Skip to main content

Crate repame_sim

Crate repame_sim 

Source
Expand description

Headless sim: bevy_ecs world stepped without a renderer. Game owns Sim, feeds wall time via Sim::step, then reads a snapshot for the viewport.

Determinism stance: bevy_ecs query iteration follows entity allocation history, so a replay with an identical spawn history iterates identically. The sim does NOT sort systems’ iteration for you: any gameplay outcome that depends on iteration order (damage application, projectile-vs-multiple-enemies resolution) must sort explicitly in the affected system, or replays diverge the moment allocation history does. Cross-platform float equality (notably Perlin/sin/powf in fx) is additionally not guaranteed between native libm and wasm; same-binary replay is the supported claim. tape is the harness that turns the claim into a check inside one binary (record one intent per tick, hash the world after each tick in a canonical order, replay, diff), and carrying a tape plus its hashes to another target is what makes that target’s claim one comparison instead of an argument.

Re-exports§

pub use hash::Hash64;
pub use rng::Rng;
pub use rng::SimRng;
pub use rng::WorldSeed;
pub use state::NextState;
pub use state::State;
pub use state::States;
pub use state::in_state;
pub use tape::Divergence;
pub use tape::Intent;
pub use tape::Setup;
pub use tape::Tape;
pub use tape::VerifyError;
pub use tape::WorldHasher;
pub use task::Task;
pub use task::TaskPool;
pub use timer::StepTimer;
pub use timer::TimerMode;
pub use bevy_ecs;

Modules§

hash
The hash a determinism check folds: FNV-1a 64.
rng
Simulation randomness a replay can trust, with no dependency behind it.
state
Typed game states with enter/exit/transition schedules.
tape
The intent tape, the canonical world hash, and the replay that checks them.
task
A fixed-size job pool for off-thread work.
timer
Fixed-step countdown timer: the alarm pattern step-based games run on. Counts down in sim steps, fires exactly on the landing step, re-arms for repeats; a disarmed timer never fires.

Structs§

Sim
Fixed-step sim state. Game registers systems, feeds wall time with step, reads world for the snapshot.
SimTime
Sim time, advanced once per fixed step.