fortress-rollback

Crates.iofortress-rollback
lib.rsfortress-rollback
version0.2.2
created_at2025-12-19 03:21:16.078887+00
updated_at2026-01-23 00:34:12.386279+00
descriptionFortress Rollback (a fork of GGRS) is a fortified, verified P2P rollback networking library for Rust.
homepage
repositoryhttps://github.com/wallstop/fortress-rollback
max_upload_size
id1994115
size1,815,789
Eli Pinkerton (wallstop)

documentation

https://docs.rs/fortress-rollback

README

Fortress Rollback

crates.io Documentation Wiki

CI Publish Coverage Benchmark


🤖 AI-Assisted Development Notice

This project was developed with substantial AI assistance. The vast majority of the code, documentation, tests, and formal specifications were written with the help of Claude Opus 4.5 and Codex 5.1. Human oversight was provided for code review, architectural decisions, and final approval, but the implementation work was heavily AI-driven. This transparency is provided so users can make informed decisions about using this crate.



⚠️⚠️⚠️ WARNING ⚠️⚠️⚠️

This crate is currently in alpha state as I start integrating it with some in-development game projects. I will utilize semver to the best of my ability to help guard against breaking changes. The main goal of this is to provide a robust, easy-to-use, 100% reliable rollback engine for games. As such, there may be anywhere between "zero" API changes and "complete overhauls". This readme and the version will be updated appropriately as things stabilize.


P2P Rollback Networking in Rust

Fortress Rollback is a fortified, correctness-first port of the original, phenomenal ggrs crate and reimagination of the GGPO network SDK, written in 100% safe Rust 🦀. This crate was primarily developed with AI assistance. The callback-style API from the original library has been replaced with a simple, request-driven control flow: instead of registering callback functions, Fortress Rollback returns a list of requests for the user to fulfill.

crates.io publication is being prepared. Until the first release is live, depend on the git repository: fortress-rollback = { git = "https://github.com/wallstop/fortress-rollback", branch = "main" }.

If you are interested in integrating rollback networking into your game or just want to chat with other rollback developers (not limited to Rust), check out the GGPO Developers Discord!

Live Demonstrations

Fortress Rollback currently ships with the same demos you may know from GGRS. One is written with macroquad, the other with bevy. Both use matchbox. Try it out with a friend! Just click the link and match with another player! (You can also open the link in two separate windows to play against yourself)

Getting Started

To get started with Fortress Rollback, check out the following resources:

  • 📖 User Guide — Full documentation site with guides, architecture, and API reference
  • 📚 GitHub Wiki — Quick reference and community-editable docs
  • 💻 Examples — Working code examples for common use cases
  • 📋 API Documentation — Auto-generated Rust docs on docs.rs

System Dependencies for Examples

The interactive examples use macroquad, which requires system libraries:

Linux (Debian/Ubuntu):

sudo apt-get install libasound2-dev libx11-dev libxi-dev libgl1-mesa-dev

Linux (Fedora/RHEL):

sudo dnf install alsa-lib-devel libX11-devel libXi-devel mesa-libGL-devel

macOS/Windows: No additional dependencies required.

Development Status

Alpha / experimental only.

Key Improvements in Fortress Rollback

  • 100% Deterministic: All collections use BTreeMap/BTreeSet for guaranteed iteration order; new hash module provides FNV-1a deterministic hashing
  • Panic-Free API: All public APIs return Result types instead of panicking — no unexpected crashes
  • Correctness-First: Formally verified with TLA+ and Z3 proofs; 1100+ tests (~92% coverage) including multi-process network and resilience scenarios
  • Enhanced Desync Detection: Built-in checksum validation with P2PSession::confirmed_inputs_for_frame() for debugging state divergence

📋 Complete comparison with GGRS → — See all differences, bug fixes, and migration steps

Network Requirements

Condition Supported Optimal
RTT <200ms <100ms
Packet Loss <15% <5%
Jitter <50ms <20ms

For detailed configuration guidance, see the User Guide.

Feature Flags

Feature Description
sync-send Adds Send + Sync bounds for multi-threaded game engines (e.g., Bevy)
tokio Enables TokioUdpSocket for async Tokio applications
paranoid Runtime invariant checking in release builds
graphical-examples Enables ex_game graphical examples (requires macroquad deps)
loom Loom-compatible synchronization primitives for concurrency testing
json JSON serialization for telemetry types (to_json() methods)

For detailed feature documentation, see the User Guide.

Migration from ggrs

Moving from the original ggrs crate? See the step-by-step guide in migration.md. It covers the crate rename (fortress-rollback), the new Config::Address Ord bound, and import changes (fortress_rollback).

Web / WASM Support

Fortress Rollback works in the browser! WASM support is automatic — no feature flags needed. The library detects target_arch = "wasm32" at compile time and uses browser-compatible APIs (js-sys for time).

For networking in the browser, use Matchbox — it provides WebRTC sockets that implement NonBlockingSocket and work seamlessly with Fortress Rollback:

[dependencies]
fortress-rollback = "0.2"
matchbox_socket = { version = "0.13", features = ["ggrs"] }

Matchbox handles:

  • WebRTC peer-to-peer connections — direct data channels between browsers
  • Signaling server — connection establishment (only needed during setup)
  • Cross-platform — works on native and WASM with the same API

See the custom socket example for implementing your own transport (WebSockets, custom protocols, etc.)

Licensing

Fortress Rollback is dual-licensed under either

at your option.

Commit count: 795

cargo fmt