2 unstable releases

0.2.0 Mar 15, 2024
0.1.0 Nov 14, 2023

#1500 in Game dev

Download history 10/week @ 2024-02-18 7/week @ 2024-02-25 4/week @ 2024-03-03 114/week @ 2024-03-10 23/week @ 2024-03-17 2/week @ 2024-03-24 55/week @ 2024-03-31 2/week @ 2024-04-07

62 downloads per month

MIT/Apache

19KB
107 lines

bevy_roll_safe

crates.io MIT/Apache 2.0 docs.rs

Rollback-safe implementations and utilities for Bevy Engine.

Motivation

Some of Bevy's features can't be used in a rollback context (with crates such as bevy_ggrs). This is either because they behave non-deterministically, rely on inaccessible local system state, or are tightly coupled to the Main schedule.

Roadmap

  • States
  • FrameCount
  • Events

States

Bevy states when added through app.add_state::<FooState>() have two big problems:

  1. They happen in the StateTransition schedule within the MainSchedule
  2. If rolled back to the first frame, OnEnter(InitialState) is not re-run.

This crate provides an extension method, add_roll_state::<S>(schedule), which lets you add a state to the schedule you want, and a resource, InitialStateEntered<S> which can be rolled back and tracks whether the initial OnEnter should be run (or re-run on rollbacks to the initial frame).

See the states example for usage with bevy_ggrs.

Cargo features

  • bevy_ggrs: Enable integration with bevy_ggrs
  • math_determinism: Enable cross-platform determinism for operations on Bevy's (glam) math types.

Bevy Version Support

bevy bevy_roll_safe
0.13 0.2, main
0.12 0.1

License

bevy_roll_safe is dual-licensed under either

at your option.

Contributions

PRs welcome!

Dependencies

~19–48MB
~764K SLoC