From fae78e32dd4113b6c3c451f82832ebbce37e3de9 Mon Sep 17 00:00:00 2001 From: griffi-gh Date: Tue, 31 Jan 2023 01:28:35 +0100 Subject: [PATCH] replace `rkyv` with `serde` and `bincode` change to serde --- kubi-shared/Cargo.toml | 6 +++--- kubi-shared/src/networking.rs | 2 -- kubi-shared/src/networking/client.rs | 0 kubi-shared/src/networking/messages.rs | 29 +++++++++++++++++++------- kubi-shared/src/networking/server.rs | 0 kubi/Cargo.toml | 2 +- 6 files changed, 25 insertions(+), 14 deletions(-) delete mode 100644 kubi-shared/src/networking/client.rs delete mode 100644 kubi-shared/src/networking/server.rs diff --git a/kubi-shared/Cargo.toml b/kubi-shared/Cargo.toml index 73c42a5..6fa1d1a 100644 --- a/kubi-shared/Cargo.toml +++ b/kubi-shared/Cargo.toml @@ -6,8 +6,8 @@ edition = "2021" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] -glam = { version = "0.22", features = ["debug-glam-assert", "mint", "fast-math", "rkyv"] } +glam = { version = "0.22", features = ["debug-glam-assert", "fast-math", "serde"] } strum = { version = "0.24", features = ["derive"] } +bincode = { version = "2.0.0-rc", default_features = false, features = ["std", "serde"] } +serde = { version = "1.0", features = ["derive"] } bracket-noise = "0.8" -rkyv = { version = "0.7", features = ["validation", "archive_le"] } -bytecheck = "*" diff --git a/kubi-shared/src/networking.rs b/kubi-shared/src/networking.rs index 527f935..ba63992 100644 --- a/kubi-shared/src/networking.rs +++ b/kubi-shared/src/networking.rs @@ -1,3 +1 @@ -pub mod client; -pub mod server; pub mod messages; diff --git a/kubi-shared/src/networking/client.rs b/kubi-shared/src/networking/client.rs deleted file mode 100644 index e69de29..0000000 diff --git a/kubi-shared/src/networking/messages.rs b/kubi-shared/src/networking/messages.rs index b0734e5..af646e7 100644 --- a/kubi-shared/src/networking/messages.rs +++ b/kubi-shared/src/networking/messages.rs @@ -1,14 +1,27 @@ -use rkyv::{Archive, Deserialize, Serialize}; -use bytecheck::CheckBytes; +use glam::{Vec3, Quat}; +use serde::{Serialize, Deserialize}; -#[derive(Archive, Deserialize, Serialize, Debug, PartialEq)] -#[archive_attr(derive(CheckBytes, Debug))] +#[derive(Serialize, Deserialize)] pub enum ClientToServerMessage { - Placeholder + ClientHello { + username: String, + password: Option, + }, + PositionChanged { + position: Vec3, + direction: Quat + } } -#[derive(Archive, Deserialize, Serialize, Debug, PartialEq)] -#[archive_attr(derive(CheckBytes, Debug))] +#[derive(Serialize, Deserialize)] pub enum ServerToClientMessage { - Placeholder + ServerHello { + client_id: u16, + }, + ServerFuckOff { + reason: String, + }, + PlayerPositionChanged { + + }, } diff --git a/kubi-shared/src/networking/server.rs b/kubi-shared/src/networking/server.rs deleted file mode 100644 index e69de29..0000000 diff --git a/kubi/Cargo.toml b/kubi/Cargo.toml index 564478e..099fa92 100644 --- a/kubi/Cargo.toml +++ b/kubi/Cargo.toml @@ -6,7 +6,7 @@ edition = "2021" [dependencies] kubi-shared = { path = "../kubi-shared" } glium = "0.32" -glam = { version = "0.22", features = ["debug-glam-assert", "mint", "fast-math"] } +glam = { version = "0.22", features = ["debug-glam-assert", "fast-math"] } image = { version = "0.24", default_features = false, features = ["png"] } log = "0.4" env_logger = "0.10"