Skip to content

Commit

Permalink
0.19 (#853)
Browse files Browse the repository at this point in the history
* 0.19

* publish 0.19
  • Loading branch information
cBournhonesque authored Jan 28, 2025
1 parent cd60a28 commit e61e01a
Show file tree
Hide file tree
Showing 15 changed files with 54 additions and 54 deletions.
19 changes: 9 additions & 10 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ exclude = ["examples/certificates"]


[workspace.package]
version = "0.18.0"
version = "0.19.0"
authors = ["Charles Bournhonesque <[email protected]>"]
publish = false
edition = "2021"
Expand All @@ -40,9 +40,9 @@ debug = false

[workspace.dependencies]

lightyear_avian = { path = "./lightyear_avian", version = "0.18.0", default-features = false }
lightyear_avian = { path = "./lightyear_avian", version = "0.19.0", default-features = false }
lightyear_examples_common = { path = "./examples/common", default-features = false }
lightyear = { path = "./lightyear", version = "0.18.0", default-features = false }
lightyear = { path = "./lightyear", version = "0.19.0", default-features = false }

# utils

Expand Down Expand Up @@ -76,7 +76,7 @@ chacha20poly1305 = { version = "0.10", features = ["std"] }

# derive

lightyear_macros = { version = "0.18.0", path = "./macros" }
lightyear_macros = { version = "0.19.0", path = "./macros" }

# tracing

Expand Down Expand Up @@ -156,7 +156,7 @@ bevy_web_keepalive = "0.3.4"

futures-lite = "2.1.0"
getrandom = { version = "0.3.0", features = [
"wasm_js", # feature 'js' is required for wasm, see https://github.com/rust-random/getrandom?tab=readme-ov-file#webassembly-support
"wasm_js", # feature 'js' is required for wasm, see https://github.com/rust-random/getrandom?tab=readme-ov-file#webassembly-support
] }
xwt-core = "0.6"
xwt-web = "0.15.0"
Expand Down Expand Up @@ -190,13 +190,13 @@ leafwing-input-manager = { version = "0.16", default-features = false, features
] }

# physics
avian2d = { version = "0.2", default-features = false }
avian3d = { version = "0.2", default-features = false }
# NOTE: avian 0.2.1 seems to be causing some issues, test with the fps example
avian2d = { version = "=0.2.0", default-features = false }
avian3d = { version = "=0.2.0", default-features = false }


# gui debug ui
# TODO: switch to the released version once inspector upgrades to bevy_egui 0.32
bevy-inspector-egui = { git = "https://github.com/blip-radar/bevy-inspector-egui.git", branch = "egui-0.30", default-features = false, features = [
bevy-inspector-egui = { version = "0.29", default-features = false, features = [
"bevy_pbr",
"bevy_image",
"bevy_render",
Expand All @@ -210,7 +210,6 @@ bevy_egui = { version = "0.32", default-features = false, features = [
bevy_metrics_dashboard = "0.4"
egui_extras = "0.30"


# bevygap for deploying on Edgegap
bevygap_server_plugin = { version = "0.3.1" }
bevygap_client_plugin = { version = "0.3.1" }
Expand Down
2 changes: 1 addition & 1 deletion examples/fps/src/renderer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ use lightyear::prelude::client::{
use lightyear::prelude::server::ReplicationTarget;
use lightyear::prelude::{NetworkIdentity, PreSpawnedPlayerObject, Replicated};
use lightyear::transport::io::IoDiagnosticsPlugin;
use lightyear_avian::prelude::AabbEnvelopeHolder;
use lightyear_avian::prelude::{AabbEnvelopeHolder, LagCompensationHistory};

#[derive(Clone)]
pub struct ExampleRendererPlugin;
Expand Down
4 changes: 3 additions & 1 deletion examples/fps/src/server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,12 @@ impl Plugin for ExampleServerPlugin {
app.add_systems(FixedUpdate, interpolated_bot_movement);
app.add_systems(
PhysicsSchedule,
compute_hit_lag_compensation.in_set(LagCompensationSet::Collisions),
// lag compensation collisions must run after the SpatialQuery has been updated
compute_hit_lag_compensation.after(PhysicsStepSet::SpatialQuery),
);
app.add_systems(
FixedPostUpdate,
// check collisions after physics have run
compute_hit_prediction.after(PhysicsSet::Sync),
);
}
Expand Down
2 changes: 1 addition & 1 deletion examples/fps/src/shared.rs
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ fn predicted_bot_movement(
fn log_predicted_bot_transform(
tick_manager: Res<TickManager>,
rollback: Option<Res<Rollback>>,
mut query: Query<
query: Query<
(&Position, &Transform),
(With<PredictedBot>, Or<(With<Predicted>, With<Replicating>)>),
>,
Expand Down
10 changes: 5 additions & 5 deletions examples/simple_setup/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@ publish = false
clap.workspace = true
lightyear.workspace = true
bevy = { workspace = true, features = [
"bevy_render",
"bevy_core_pipeline",
"bevy_winit",
"bevy_window"
]}
"bevy_render",
"bevy_core_pipeline",
"bevy_winit",
"bevy_window",
] }
serde.workspace = true
2 changes: 1 addition & 1 deletion examples/simple_setup/src/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -58,4 +58,4 @@ impl Plugin for ExampleClientPlugin {
fn connect_client(mut commands: Commands) {
commands.spawn(Camera2d);
commands.connect_client();
}
}
4 changes: 2 additions & 2 deletions examples/simple_setup/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,13 @@ pub struct Cli {
#[derive(Subcommand, Debug)]
pub enum Mode {
Client,
Server
Server,
}

fn main() {
let cli = Cli::parse();
let mut app = App::new();

match cli.mode {
Mode::Client => {
app.add_plugins(client::ExampleClientPlugin);
Expand Down
28 changes: 14 additions & 14 deletions lightyear/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,31 +16,31 @@ publish = true
[features]
trace = []
metrics = [
"dep:metrics",
"dep:metrics-util",
"dep:metrics-tracing-context",
"dep:metrics-exporter-prometheus",
"dep:metrics",
"dep:metrics-util",
"dep:metrics-tracing-context",
"dep:metrics-exporter-prometheus",
]
visualizer = ["dep:bevy_metrics_dashboard", "metrics"]
mock_time = ["dep:mock_instant"]
webtransport = [
"dep:wtransport",
"dep:xwt-core",
"dep:xwt-web",
"dep:web-sys",
"dep:wasm-bindgen-futures",
"dep:wtransport",
"dep:xwt-core",
"dep:xwt-web",
"dep:web-sys",
"dep:wasm-bindgen-futures",
]
leafwing = ["dep:leafwing-input-manager"]
# NOTE: because lightyear doesn't enable any features of avian by default, your crate must
# enable essential features (like f32 or f64).
avian2d = ["dep:avian2d"]
avian3d = ["dep:avian3d", "avian3d/3d"]
websocket = [
"dep:tokio-tungstenite",
"dep:futures-util",
"dep:web-sys",
"dep:wasm-bindgen",
"dep:wasm-bindgen-futures",
"dep:tokio-tungstenite",
"dep:futures-util",
"dep:web-sys",
"dep:wasm-bindgen",
"dep:wasm-bindgen-futures",
]
steam = ["dep:steamworks"]
track_change_detection = ["bevy/track_change_detection"]
Expand Down
2 changes: 1 addition & 1 deletion lightyear/src/client/input/leafwing.rs
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ pub struct LeafwingInputConfig<A> {
/// If enabled, the client will send the interpolation_delay to the server so that the server
/// can apply lag compensation when the predicted client is shooting at interpolated enemies.
///
/// See: https://developer.valvesoftware.com/wiki/Lag_Compensation
/// See: <https://developer.valvesoftware.com/wiki/Lag_Compensation>
pub lag_compensation: bool,
// TODO: right now the input-delay causes the client timeline to be more in the past than it should be
// I'm not sure if we can have different input_delay_ticks per ActionType
Expand Down
17 changes: 7 additions & 10 deletions lightyear/src/client/networking.rs
Original file line number Diff line number Diff line change
Expand Up @@ -486,16 +486,13 @@ fn connect(world: &mut World) {
// new client connection and connection manager, which want to do because we need to reset
// the internal time, sync, priority, message numbers, etc.)
rebuild_client_connection(world);
if let Err(e) = world
.resource_mut::<ClientConnection>()
.connect() {
error!("Error connecting client: {}", e);
world.resource_mut::<ClientConnection>()
.disconnect_reason = Some(e);

world
.resource_mut::<NextState<NetworkingState>>()
.set(NetworkingState::Disconnected);
if let Err(e) = world.resource_mut::<ClientConnection>().connect() {
error!("Error connecting client: {}", e);
world.resource_mut::<ClientConnection>().disconnect_reason = Some(e);

world
.resource_mut::<NextState<NetworkingState>>()
.set(NetworkingState::Disconnected);
}
let config = world.resource::<ClientConfig>();
if matches!(
Expand Down
2 changes: 1 addition & 1 deletion lightyear/src/client/prediction/despawn.rs
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ pub(crate) fn remove_component_for_despawn_predicted<C: SyncComponent>(

// TODO: compare the performance of cloning the component versus popping from the World directly
/// In case of a rollback, check if there were any entities that were predicted-despawn
/// that we need to re-instate. (all the entities that have RemovedCache<C> are in this scenario)
/// that we need to re-instate. (all the entities that have `RemovedCache<C>` are in this scenario)
/// If we didn't need to re-instate them, the Confirmed entity would have been despawned.
///
/// Remember to reinstate components if SyncComponent != Full
Expand Down
6 changes: 4 additions & 2 deletions lightyear/src/connection/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,9 @@ impl NetConfig {
} => {
let client = super::steam::client::Client::new(
steamworks_client.unwrap_or_else(|| {
Arc::new(RwLock::new(SteamworksClient::new_with_app_id(config.app_id)))
Arc::new(RwLock::new(SteamworksClient::new_with_app_id(
config.app_id,
)))
}),
config,
conditioner,
Expand Down Expand Up @@ -348,5 +350,5 @@ pub enum ConnectionError {
SteamError(#[from] steamworks::SteamError),
#[error("client was disconnected")]
#[cfg(all(feature = "steam", not(target_family = "wasm")))]
SteamDisconnection(steamworks::networking_types::NetConnectionEnd)
SteamDisconnection(steamworks::networking_types::NetConnectionEnd),
}
4 changes: 1 addition & 3 deletions lightyear/src/connection/netcode/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,7 @@ use bevy::prelude::Resource;
use tracing::{debug, error, info, trace};

use crate::client::io::Io;
use crate::connection::client::{
ConnectionError, ConnectionState, IoConfig, NetClient,
};
use crate::connection::client::{ConnectionError, ConnectionState, IoConfig, NetClient};
use crate::connection::id;
use crate::packet::packet_builder::RecvPayload;
use crate::transport::io::IoState;
Expand Down
4 changes: 3 additions & 1 deletion lightyear/src/connection/server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,9 @@ impl NetConfig {
// TODO: handle errors
let server = super::steam::server::Server::new(
steamworks_client.unwrap_or_else(|| {
Arc::new(RwLock::new(SteamworksClient::new_with_app_id(config.app_id)))
Arc::new(RwLock::new(SteamworksClient::new_with_app_id(
config.app_id,
)))
}),
config,
conditioner,
Expand Down
2 changes: 1 addition & 1 deletion lightyear_avian/src/lag_compensation/history.rs
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ fn update_collider_history(
|(min, max), (_, (_, _, aabb))| (min.min(aabb.min), max.max(aabb.max)),
);
let aabb_envelope = ColliderAabb::from_min_max(min, max);
// we cannot use the aabb_envelope directly, the SpatialQuery uses Position, Rotation, Collider
// we cannot use the aabb_envelope directly because the SpatialQuery uses Position, Rotation, Collider
// instead we will use a cuboid collider with the same dimensions as the aabb envelope, and whose position
// is the center of the aabb envelope.
// We don't need to change the Rotation since the aabb envelope is axis-aligned
Expand Down

0 comments on commit e61e01a

Please sign in to comment.