diff --git a/Cargo.toml b/Cargo.toml index aaf86dd..b27acbd 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "bevy_ggrs" -version = "0.16.0" +version = "0.17.0" authors = ["Georg Schuppe "] edition = "2021" description = "Bevy plugin for the GGRS P2P rollback networking library" @@ -16,16 +16,17 @@ categories = ["network-programming", "game-development"] wasm-bindgen = ["instant/wasm-bindgen", "ggrs/wasm-bindgen"] [dependencies] -bevy = { version = "0.14", default-features = false } -bytemuck = { version = "1.7", features = ["derive"] } +bevy = { version = "0.15", default-features = false } instant = { version = "0.1", optional = true } log = "0.4" #ggrs = { version= "0.10.2", features=["sync-send"]} ggrs = { git = "/~https://github.com/gschup/ggrs", features = ["sync-send"] } seahash = "4.1" +disqualified = "1.0.0" +serde = { version = "1", default-features = false } [dev-dependencies] -bevy = { version = "0.14", default-features = true } +bevy = { version = "0.15", default-features = true } clap = { version = "4.4", features = ["derive"] } rand = "0.8.4" rand_xoshiro = "0.6" diff --git a/README.md b/README.md index 16cb60e..72e8757 100644 --- a/README.md +++ b/README.md @@ -19,17 +19,17 @@ bevy_GGRS has a demo app you can try in the browser! It uses [matchbox](https:// ## Compatible Versions -|bevy|bevy_ggrs|ggrs| -|---|---|---| -|0.14|main|main| -|0.14|0.16|0.10.2| -|0.13|0.15|0.10.1| -|0.12|0.14|0.10| -|0.11|0.13|0.9.4| -|0.10|0.12|0.9.4| -|0.9|0.11|0.9.3| -|0.8|0.10|0.9| -|0.6|0.9|0.9| +| bevy | bevy_ggrs | ggrs | +| ---- | --------- | ------ | +| 0.15 | main | main | +| 0.14 | 0.16 | 0.10.2 | +| 0.13 | 0.15 | 0.10.1 | +| 0.12 | 0.14 | 0.10 | +| 0.11 | 0.13 | 0.9.4 | +| 0.10 | 0.12 | 0.9.4 | +| 0.9 | 0.11 | 0.9.3 | +| 0.8 | 0.10 | 0.9 | +| 0.6 | 0.9 | 0.9 | ## Thanks diff --git a/examples/box_game/box_game.rs b/examples/box_game/box_game.rs index 79b6335..a11227b 100644 --- a/examples/box_game/box_game.rs +++ b/examples/box_game/box_game.rs @@ -3,7 +3,7 @@ use bevy_ggrs::{ AddRollbackCommandExtension, GgrsConfig, LocalInputs, LocalPlayers, PlayerInputs, Rollback, Session, }; -use bytemuck::{Pod, Zeroable}; +use serde::{Deserialize, Serialize}; use std::hash::Hash; const BLUE: Color = Color::srgb(0.8, 0.6, 0.2); @@ -28,7 +28,7 @@ const CUBE_SIZE: f32 = 0.2; pub type BoxConfig = GgrsConfig; #[repr(C)] -#[derive(Copy, Clone, Debug, PartialEq, Eq, Pod, Zeroable)] +#[derive(Copy, Clone, Debug, PartialEq, Eq, Default, Serialize, Deserialize)] pub struct BoxInput(u8); #[derive(Default, Component)] @@ -94,11 +94,10 @@ pub fn setup_system( }; // A ground plane - commands.spawn(PbrBundle { - mesh: meshes.add(Plane3d::new(Vec3::Y, Vec2::splat(PLANE_SIZE / 2.0))), - material: materials.add(StandardMaterial::from(Color::srgb(0.3, 0.5, 0.3))), - ..default() - }); + commands.spawn(( + Mesh3d(meshes.add(Plane3d::new(Vec3::Y, Vec2::splat(PLANE_SIZE / 2.0)))), + MeshMaterial3d(materials.add(StandardMaterial::from(Color::srgb(0.3, 0.5, 0.3)))), + )); let r = PLANE_SIZE / 4.; let mesh = meshes.add(Cuboid::from_length(CUBE_SIZE)); @@ -118,12 +117,9 @@ pub fn setup_system( commands .spawn(( // ...add visual information... - PbrBundle { - mesh: mesh.clone(), - material: materials.add(StandardMaterial::from(color)), - transform, - ..default() - }, + Mesh3d(mesh.clone()), + MeshMaterial3d(materials.add(StandardMaterial::from(color))), + transform, // ...flags... Player { handle }, // ...and components which will be rolled-back... @@ -135,15 +131,12 @@ pub fn setup_system( } // light - commands.spawn(PointLightBundle { - transform: Transform::from_xyz(4.0, 8.0, 4.0), - ..default() - }); + commands.spawn((PointLight::default(), Transform::from_xyz(4.0, 8.0, 4.0))); // camera - commands.spawn(Camera3dBundle { - transform: Transform::from_xyz(0.0, 7.5, 0.5).looking_at(Vec3::ZERO, Vec3::Y), - ..default() - }); + commands.spawn(( + Camera3d::default(), + Transform::from_xyz(0.0, 7.5, 0.5).looking_at(Vec3::ZERO, Vec3::Y), + )); } // Example system, manipulating a resource, will be added to the rollback schedule. diff --git a/examples/box_game/box_game_p2p.rs b/examples/box_game/box_game_p2p.rs index 4453280..1749bd2 100644 --- a/examples/box_game/box_game_p2p.rs +++ b/examples/box_game/box_game_p2p.rs @@ -34,7 +34,6 @@ fn main() -> Result<(), Box> { .with_num_players(num_players) .with_desync_detection_mode(ggrs::DesyncDetection::On { interval: 10 }) // (optional) set how often to exchange state checksums .with_max_prediction_window(12) - .expect("prediction window can't be 0") // (optional) set max prediction window .with_input_delay(2); // (optional) set input delay for the local player // add players diff --git a/examples/stress_tests/particles.rs b/examples/stress_tests/particles.rs index cc2c411..6a16fb5 100644 --- a/examples/stress_tests/particles.rs +++ b/examples/stress_tests/particles.rs @@ -139,7 +139,7 @@ fn main() -> Result<(), Box> { let mut session_builder = SessionBuilder::::new() .with_num_players(num_players) .with_desync_detection_mode(desync_mode) - .with_max_prediction_window(args.max_prediction)? + .with_max_prediction_window(args.max_prediction) .with_input_delay(args.input_delay); for (i, player_addr) in args.players.iter().enumerate() { @@ -170,7 +170,6 @@ fn main() -> Result<(), Box> { app.rollback_component_with_reflect::() .rollback_component_with_reflect::() .rollback_component_with_reflect::() - .rollback_component_with_reflect::>() .rollback_component_with_reflect::() .rollback_component_with_reflect::() .rollback_component_with_reflect::() @@ -188,7 +187,6 @@ fn main() -> Result<(), Box> { app.rollback_component_with_clone::() .rollback_component_with_clone::() .rollback_component_with_clone::() - .rollback_component_with_clone::>() .rollback_component_with_clone::() .rollback_component_with_clone::() .rollback_component_with_clone::() @@ -246,7 +244,7 @@ fn main() -> Result<(), Box> { } fn setup(mut commands: Commands) { - commands.spawn(Camera2dBundle::default()); + commands.spawn(Camera2d); } fn spawn_pressed(inputs: Res>) -> bool { @@ -260,14 +258,7 @@ fn spawn_particles(mut commands: Commands, args: Res, mut rng: ResMut, mut rng: ResMut, time: Res