Skip to content

Commit

Permalink
Updated Comments and Formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
bushrat011899 committed Oct 24, 2023
1 parent 18c0416 commit 9c32199
Show file tree
Hide file tree
Showing 7 changed files with 23 additions and 21 deletions.
8 changes: 3 additions & 5 deletions examples/box_game/box_game_p2p.rs
Original file line number Diff line number Diff line change
Expand Up @@ -63,12 +63,10 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
.set_rollback_schedule_fps(FPS)
// this system will be executed as part of input reading
.add_systems(ReadInputs, read_local_inputs)
// Rollback behavior can be controlled through many modular plugins
// The FrameCount resource implements Copy
// We can use that to have minimal overhead rollback
// Rollback behavior can be customized using a variety of extension methods and plugins:
// The FrameCount resource implements Copy, we can use that to have minimal overhead rollback
.rollback_resource_with_copy::<FrameCount>()
// Transform and Velocity components only implement Clone,
// so instead we'll use that to snapshot and rollback with
// Transform and Velocity components only implement Clone, so instead we'll use that to snapshot and rollback with
.rollback_component_with_clone::<Transform>()
.rollback_component_with_clone::<Velocity>()
.insert_resource(opt)
Expand Down
8 changes: 3 additions & 5 deletions examples/box_game/box_game_spectator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,12 +41,10 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
.set_rollback_schedule_fps(FPS)
// this system will be executed as part of input reading
.add_systems(ReadInputs, read_local_inputs)
// Rollback behavior can be controlled through many modular plugins
// The FrameCount resource implements Copy
// We can use that to have minimal overhead rollback
// Rollback behavior can be customized using a variety of extension methods and plugins:
// The FrameCount resource implements Copy, we can use that to have minimal overhead rollback
.rollback_resource_with_copy::<FrameCount>()
// Transform and Velocity components only implement Clone,
// so instead we'll use that to snapshot and rollback with
// Transform and Velocity components only implement Clone, so instead we'll use that to snapshot and rollback with
.rollback_component_with_clone::<Transform>()
.rollback_component_with_clone::<Velocity>()
.insert_resource(opt)
Expand Down
8 changes: 3 additions & 5 deletions examples/box_game/box_game_synctest.rs
Original file line number Diff line number Diff line change
Expand Up @@ -43,12 +43,10 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
.add_systems(ReadInputs, read_local_inputs)
.insert_resource(opt)
.add_plugins(DefaultPlugins)
// Rollback behavior can be controlled through many modular plugins
// The FrameCount resource implements Copy
// We can use that to have minimal overhead rollback
// Rollback behavior can be customized using a variety of extension methods and plugins:
// The FrameCount resource implements Copy, we can use that to have minimal overhead rollback
.rollback_resource_with_copy::<FrameCount>()
// Transform and Velocity components only implement Clone,
// so instead we'll use that to snapshot and rollback with
// Transform and Velocity components only implement Clone, so instead we'll use that to snapshot and rollback with
.rollback_component_with_clone::<Transform>()
.rollback_component_with_clone::<Velocity>()
.add_systems(Startup, setup_system)
Expand Down
4 changes: 2 additions & 2 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@ pub trait GgrsApp {

/// Registers a component type for saving and loading from the world. This
/// uses [`reflection`](`Reflect`) based snapshots for rollback.
///
///
/// NOTE: Unlike previous versions of `bevy_ggrs`, this will no longer automatically
/// apply entity mapping through the [`MapEntities`](`bevy::ecs::entity::MapEntities`) trait.
/// If you require this behavior, see [`GgrsComponentMapEntitiesPlugin`].
Expand All @@ -204,7 +204,7 @@ pub trait GgrsApp {

/// Registers a resource type for saving and loading from the world. This
/// uses [`reflection`](`Reflect`) based snapshots for rollback.
///
///
/// NOTE: Unlike previous versions of `bevy_ggrs`, this will no longer automatically
/// apply entity mapping through the [`MapEntities`](`bevy::ecs::entity::MapEntities`) trait.
/// If you require this behavior, see [`GgrsComponentMapEntitiesPlugin`].
Expand Down
6 changes: 5 additions & 1 deletion src/snapshot/component_checksum_hash.rs
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,11 @@ where

let result = ChecksumPart(hasher.finish() as u128);

trace!("Component {} has checksum {:X}", std::any::type_name::<C>(), result.0);
trace!(
"Component {} has checksum {:X}",
std::any::type_name::<C>(),
result.0
);

if let Ok(mut checksum) = checksum.get_single_mut() {
*checksum = result;
Expand Down
6 changes: 5 additions & 1 deletion src/snapshot/resource_checksum_hash.rs
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,11 @@ where

let result = ChecksumPart(hasher.finish() as u128);

trace!("Resource {} has checksum {:X}", std::any::type_name::<R>(), result.0);
trace!(
"Resource {} has checksum {:X}",
std::any::type_name::<R>(),
result.0
);

if let Ok(mut checksum) = checksum.get_single_mut() {
*checksum = result;
Expand Down
4 changes: 2 additions & 2 deletions src/snapshot/set.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,11 +38,11 @@ pub enum LoadWorldSet {
#[derive(SystemSet, Hash, Debug, PartialEq, Eq, Clone)]
pub enum SaveWorldSet {
/// Generate checksums for any tracked data.
///
///
/// Within this set, it is expected that all data which will participate in the
/// total checksum recorded for this frame will have updated/created a single [`Entity`]
/// with a [`ChecksumPart`](`crate::ChecksumPart`) component, containing its contribution.
///
///
/// The final [`Checksum`](`crate::Checksum`) for the frame will be produced after this set, but before
/// the [`Snapshot`](`SaveWorldSet::Snapshot`) set.
Checksum,
Expand Down

0 comments on commit 9c32199

Please sign in to comment.