[](https://gschup.github.io/ggrs/)

April 9, 2026 · View on GitHub

crates.io GitHub Workflow Status

Bevy GGRS

Bevy plugin for the GGRS P2P rollback networking library. Handles advancing game state and rollbacks via a dedicated schedule, snapshotting only the components and resources you register.

Quickstart

# Cargo.toml
[dependencies]
bevy_ggrs = { git = "https://github.com/gschup/bevy_ggrs" }
use bevy::prelude::*;
use bevy_ggrs::prelude::*;

type GgrsConfig = bevy_ggrs::GgrsConfig<u8>; // replace u8 with your input type

App::new()
    .add_plugins(GgrsPlugin::<GgrsConfig>::default())
    .insert_resource(RollbackFrameRate(60))
    // register components/resources for snapshotting
    .rollback_component_with_clone::<Transform>()
    // provide inputs each frame
    .add_systems(ReadInputs, read_local_inputs)
    // your game logic — must be deterministic!
    .add_systems(GgrsSchedule, move_players)
    .insert_resource(Session::SyncTest(session))
    .run();

// #[require(Rollback)] ensures Rollback is always added with Player —
// no need to include it manually in every spawn call.
#[derive(Component)]
#[require(Rollback)]
struct Player;

fn spawn_player(mut commands: Commands) {
    commands.spawn((Transform::default(), Player));
}

For full P2P and spectator session examples, see examples/. For guides on writing correct rollback systems, see docs/pitfalls.md and docs/debugging-desyncs.md. For an overview of how bevy_ggrs works internally, see docs/architecture.md.

Live Demonstration (unmaintained)

bevy_ggrs has a demo app using matchbox for browser-based P2P. It is currently unmaintained and may not work with the latest version.

Compatible Versions

bevybevy_ggrsggrs
0.18mainmain
0.180.210.12.0
0.180.200.11.1
0.170.190.11.1
0.160.180.11.1
0.150.170.11.0
0.140.160.10.2
0.130.150.10.1
0.120.140.10
0.110.130.9.4
0.100.120.9.4
0.90.110.9.3
0.80.100.9
0.60.90.9

Community

  • matchbox — WebRTC socket layer, pairs well with bevy_ggrs for browser/WASM P2P
  • extreme_bevy — tutorial and example project: how to build a low-latency P2P web game with bevy_ggrs and matchbox

Thanks

to bevy_backroll and bevy_rollback for figuring out pieces of the puzzle that made bevy_ggrs possible. Special thanks to the helpful folks in the Bevy Discord for their support along the way.

Licensing

Bevy_GGRS is dual-licensed under either

at your option.