Expand description
bevy_ggrs is a bevy plugin for the P2P rollback networking library GGRS.
See GgrsPlugin for getting started.
For an overview of the internals, see the
architecture doc.
Re-exports§
pub use ggrs;
Modules§
- prelude
- Convenient re-exports of the most commonly used types. Glob-import this to get started.
Structs§
- Advance
World - Label for the schedule which advances the current world to the next frame.
- Checksum
- Represents a total checksum for a given frame.
- Checksum
Flag - Flags an entity as containing a checksum for a type
T - Checksum
Part - Represents a checksum value for a specific type, flagged by
ChecksumFlag. - Checksum
Plugin - A
Pluginwhich creates aChecksumresource which can be read after or during theSaveWorldSystems::Snapshotset in theSaveWorldschedule has been run. - Child
OfSnapshot Plugin - Specialized snapshotting plugin for
ChildOfcomponents. - Clone
Strategy - A
Strategybased onClone - Component
Checksum Plugin - A
Pluginwhich will track theComponentConRollbackentities and ensure aChecksumPartis available and updated. This can be used to generate aChecksum. - Component
MapEntities Plugin - A
Pluginwhich updates the state of a post-rollbackComponentCusingMapEntities. - Component
Snapshot Plugin - A
Pluginwhich manages snapshots for aComponentusing a providedStrategy. - Confirmed
Frame Count - The most recently confirmed frame. Any information for frames stored before this point can be safely discarded.
- Copy
Strategy - A
Strategybased onCopy - Entity
Checksum Plugin - A plugin that contributes a checksum of the current rollback entity state to the frame checksum.
- Entity
Snapshot Plugin - A
Pluginwhich manages the rollback forEntities. This will ensure allEntitiesmatch the state of the desired frame, or can be mapped using aRollbackEntityMap, which thisPluginwill also manage. - Ggrs
Component Snapshot - A storage type suitable for per-
Entitysnapshots, such asComponenttypes. - Ggrs
Config - A sensible default GGRS Config type suitable for most applications.
- Ggrs
Plugin - GGRS plugin for bevy.
- Ggrs
Schedule - The schedule that runs your rollback game logic each GGRS frame.
- Ggrs
Snapshots - Collection of snapshots for a type
For, stored asAs - Ggrs
Time - A
Timetype for use with GGRS. This time is guaranteed to be in-sync with all peers, and reflect that exactlyRollbackFrameCountframes have passed at theRollbackFrameRaterate. Note that in theGgrsSchedule, this is the default time. - Ggrs
Time Plugin - This plugins provides
Time<GgrsTime>, which is rolled-back automatically, and will also automatically replaceTime<()>when accessed insideGgrsSchedule. - Immutable
Component Snapshot Plugin - A
Pluginwhich manages snapshots for aComponentusing a providedStrategythat works with immutable components. - Load
World - Label for the schedule which loads and overwrites a snapshot of the world.
- Local
Inputs - Inputs from local players. You have to fill this resource in the ReadInputs schedule.
- Local
Players - Handles for the local players, you can use this when writing an input system.
- MaxPrediction
Window - The maximum prediction window for this
Session, provided as a concreteResource. - Player
Inputs - A resource holding the inputs for all players in the current GGRS frame.
- Read
Inputs - Label for the schedule which reads the inputs for the current frame
- Reflect
Strategy - A
Strategybased onReflectandFromWorld - Resource
Checksum Plugin - Plugin which will track the
ResourceRand ensure aChecksumPartis available and updated. This can be used to generate aChecksum. - Resource
MapEntities Plugin - A
Pluginwhich updates the state of a post-rollbackResourceRusingMapEntities. - Resource
Snapshot Plugin - A
Pluginwhich manages snapshots for aResourceusing a providedStrategy. - Rollback
- Marker component that flags an entity for inclusion in the rollback save/load schedule.
- Rollback
Despawn Plugin - Plugin that enables rollback-safe despawning via
RollbackDespawned. - Rollback
Despawned - Marks an entity as despawned, contains the frame that the entity was despawned on.
- Rollback
Entity Map - A
Resourcewhich provides an entity-to-entity mapping describing howEntityIDs changed during a rollback. - Rollback
Frame Count - Keeps track of the current frame the rollback simulation is in
- Rollback
Frame Rate Resourcedescribing the rate at which theAdvanceWorldwill run.- Rollback
Id - A stable identifier for rollback entities, used as a key in snapshot storage.
Automatically inserted when
Rollbackis added to an entity. - Rollback
Ordered - A
Resourcewhich provides methods for stable ordering ofRollbackIdcomponents. - RunGgrs
Systems - A
SystemSetlabel for the system that drives all GGRS schedules each Bevy frame. - Save
World - Label for the schedule which saves a snapshot of the current world.
- Snapshot
Plugin - This plugin sets up the
LoadWorld,SaveWorld, andAdvanceWorldschedules and adds the required systems and resources for basic rollback functionality. - Snapshot
SetPlugin - Sets up the
LoadWorldSystemsandSaveWorldSystemssets, allowing for explicit ordering of rollback systems across plugins. - Sync
Test Mismatch - Triggered when a
SyncTestSessiondetects a checksum mismatch after rollback resimulation. This means the resimulated state diverged from the original — indicating a rollback correctness issue.
Enums§
- Advance
World Systems - Set for ordering systems during the
AdvanceWorldschedule. - Load
World Systems - Set for ordering systems during the
LoadWorldschedule. The most common option isLoadWorldSystems::Data, which is whereComponentandResourcesnapshots are loaded and applied to theWorld. - Save
World Systems - Set for ordering systems during the
SaveWorldschedule. - Session
- Defines the Session that the GGRS Plugin should expect as a resource.
Traits§
- Rollback
App - Extension trait to ergonomically add rollback plugins to Bevy Apps
- Rollback
Despawn Command Extension - Extension trait for
EntityCommandsthat adds rollback-safe despawn methods. - Strategy
- Describes how to efficiently transform a
Targetinto aStoredversion, and vice versa. Any implementation for aStrategyshould form a bijection betweenTargetandStored
Functions§
- checksum_
hasher - Returns a hasher built using the
seahashlibrary appropriate for creating portable checksums.
Type Aliases§
- Ggrs
Component Snapshots - Typical
Resourceused to store snapshots for aComponentCas the typeAs. For most types, the defaultAs = Cwill suffice. - Ggrs
Resource Snapshots - Typical
Resourceused to store snapshots for aResourceRas the typeAs. For most types, the defaultAs = Rwill suffice.