Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Foldback

Foldback finds exactly where and why your lockstep/rollback simulation desynced — one hook per tick, a bisection engine that narrows a mismatch down to the field, and a UI that turns a wall of hash logs into a timeline you can point at.

Not yet published to crates.io — see How Foldback Works for the full pieces breakdown.

The gap

Every serious lockstep/rollback project ends up building a version of this itself: RimWorld Multiplayer has one, O3DE has one, GGRS ships a SyncTestSession that does a narrow slice of it. Each is locked to one project or engine. Foldback is the reusable version — a small Rust core with a stable C ABI, so the same hashing/bisection engine works from Bevy, Unity, Godot, or Unreal instead of every team reinventing it.

60-second quickstart

The entire integration cost for Level-1 (tick-only) divergence detection: one call per tick.

#![allow(unused)]
fn main() {
use foldback_core::session::Session;

let mut session = Session::builder()
    .tick_rate_hz(60)
    .peer_count(2)
    .build()?;

// each simulation tick:
let state_bytes = bincode::serialize(&world.deterministic_state())?;
session.hash_tick(tick, &state_bytes)?;

// exchange session.take_pending_hashes() with peers over your existing
// netcode channel — a handful of bytes per tick.
}

If a peer’s hash for a tick doesn’t match, session.check_divergence() returns Some(DivergenceTick(tick)) the moment enough peers have reported that tick. See the Cookbook for the full recipe set.

Pick your engine

EngineWhat you get
Rust / GGRS / BevyCore API, a GGRS bridge, explicit + reflective hashing, an in-editor bevy_egui dock
UnityExplicit + reflective hashing, an in-editor EditorWindow dock, IL2CPP AOT support
GodotExplicit + reflective hashing, an in-editor dock plugin
Unreal EngineExplicit binding, reflective hashing, and a Mass Entity integration

Further down

  • Architecture — how the core, CLI, UI, and bindings fit together.
  • Protocol & File Format Spec — the .foldback session file format and live-mode transport, both versioned from day one.
  • vs. hand-rolling your own sync-checksum system: Foldback gives you the bisection engine (tick → entity → field) and a UI for free, instead of a yes/no checksum match you have to build tooling around yourself.