|
Some checks failed
Rust / build-linux (linux-x86_64, X64, ubuntu-24.04, x86_64-unknown-linux-gnu) (pull_request) Failing after 5s
Rust / build-android (29.0.14206865, ubuntu-24.04, 33) (pull_request) Failing after 2s
Rust-lint / lint-linux (pull_request) Failing after 2s
Rust / build-linux (linux-aarch64, ARM64, ubuntu-24.04-arm, aarch64-unknown-linux-gnu) (pull_request) Has been cancelled
Rust / build-windows (windows-aarch64, woa64, windows-11-arm, aarch64-pc-windows-msvc) (pull_request) Has been cancelled
Rust / build-windows (windows-x86_64, win64, windows-2025, x86_64-pc-windows-msvc) (pull_request) Has been cancelled
Rust / build-macos (macos-aarch64, ARM64, aarch64-apple-darwin) (pull_request) Has been cancelled
Rust / Collect release artifacts (pull_request) Has been cancelled
After a netplay savestate load, the GGRS session's internal frame counter
must be reset to match the savestate's frame, or desync detection fires
immediately on resume.
Changes:
- Patch vendored ggrs 0.13.0 to expose set_current_frame(frame) on
P2PSession and SyncTestSession, with internal SyncLayer and InputQueue
reset methods to clear stale saved states, checksum history, and input
queues
- Add [patch.crates-io] ggrs = { path = 'vendor/ggrs' } in Cargo.toml
- Add netplay::reset_frame(session, frame) wrapper function
- Record current GGRS frame in Savestate.netplay_frame during
create_savestate when in netplay context
- Call reset_frame after load_savestate in netplay context
- Add tests: advance 120 frames, reset to 60, verify current_frame()==60
and clean resume with matching inputs; reset to 0; idempotent reset
Closes #5
|
||
|---|---|---|
| .. | ||
| examples | ||
| src | ||
| tests | ||
| Cargo.lock | ||
| Cargo.toml | ||
| Cargo.toml.orig | ||
| LICENSE | ||
| README.md | ||
P2P Rollback Networking in Rust
GGRS (good game rollback system) is a reimagination of the GGPO network SDK written in 100% safe Rust 🦀. The callback-style API from the original library has been replaced with a much saner, simpler control flow. Instead of registering callback functions, GGRS returns a list of requests for the user to fulfill.
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
GGRS has two demo apps — one written with macroquad, the other with bevy. Both use matchbox for WebRTC-based matchmaking.
Note: The hosted matchmaking server is currently offline, so the links below will not find opponents automatically. You can still open the link in two separate browser windows on the same machine to test locally.
Projects using GGRS
- Jumpy
- Gamercade
- NES-bundler
- Girls with Swords (gameplay footage)
- NieR Automata: Online (Youtube)
- Signs of Danger (devlog, forked)
Getting Started
To get started with GGRS, check out the following resources:
- Docs — guide covering setup, sessions, the main loop, requests/events, time sync, and more
- Examples — runnable P2P, spectator, and sync-test demos
- API Documentation
Development Status
GGRS is fairly stable. The core functionality for multiple players and spectators has not changed significantly in recent versions. See the Changelog for the latest changes, including those not yet published to crates.io. If you want to contribute, check out existing issues and the contribution guide!
Useful Links
Bevy Plugin
The authors of GGRS are also maintaining a bevy plugin. Check it out:
WASM support through WebRTC sockets
If you are interested to run a GGRS application in your browser, check the amazing Matchbox project! The matchbox sockets are compatible with GGRS through a feature flag:
Godot Wrapper
Godot is a popular open-source game engine. marcello505 is developing a wrapper for GGRS. Find the repository here:
Other Rollback Implementations in Rust
Also take a look at the awesome backroll project, a completely async rollback library. Special thanks to james7132 for a lot of inspiration and fruitful discussion.
Licensing
GGRS is dual-licensed under either
- MIT License: Also available online
- Apache License, Version 2.0: Also available online
at your option.
