Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/rust.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ jobs:
with:
components: clippy
- uses: ./.github/actions/install-bevy-deps
- run: cargo clippy --target '${{ matrix.target }}' --workspace --all-features -- -Dwarnings
- run: cargo clippy --target '${{ matrix.target }}' --workspace --all-features --all-targets -- -Dwarnings

doc:
runs-on: ubuntu-latest
Expand All @@ -65,7 +65,7 @@ jobs:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
- uses: ./.github/actions/install-bevy-deps
- run: cargo check --target '${{ matrix.target }}' --workspace --all-features
- run: cargo check --target '${{ matrix.target }}' --workspace --all-features --all-targets

check-fuzz:
runs-on: ubuntu-latest
Expand Down
17 changes: 9 additions & 8 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 7 additions & 7 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,19 +4,19 @@ members = ["crates/*", "examples"]

[workspace.package]
edition = "2024"
rust-version = "1.86.0"
rust-version = "1.88.0"
repository = "https://github.com/aecsocket/aeronet"
license = "MIT OR Apache-2.0"
keywords = ["bevy", "gamedev", "network"]
categories = ["game-development", "network-programming"]

[workspace.dependencies]
aeronet = { path = "crates/aeronet", version = "0.17.0", default-features = false }
aeronet_io = { path = "crates/aeronet_io", version = "0.17.0", default-features = false }
aeronet_replicon = { path = "crates/aeronet_replicon", version = "0.17.0", default-features = false }
aeronet_transport = { path = "crates/aeronet_transport", version = "0.17.0", default-features = false }
aeronet_websocket = { path = "crates/aeronet_websocket", version = "0.17.0" }
aeronet_webtransport = { path = "crates/aeronet_webtransport", version = "0.17.0" }
aeronet = { path = "crates/aeronet", version = "0.17.1", default-features = false }
aeronet_io = { path = "crates/aeronet_io", version = "0.17.1", default-features = false }
aeronet_replicon = { path = "crates/aeronet_replicon", version = "0.17.1", default-features = false }
aeronet_transport = { path = "crates/aeronet_transport", version = "0.17.1", default-features = false }
aeronet_websocket = { path = "crates/aeronet_websocket", version = "0.17.1" }
aeronet_webtransport = { path = "crates/aeronet_webtransport", version = "0.17.1" }
anyhow = { version = "1.0.97", default-features = false }
arbitrary = { version = "1.3.2", features = ["derive"] }
base64 = { version = "0.22.1" }
Expand Down
8 changes: 4 additions & 4 deletions crates/aeronet/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "aeronet"
version = "0.17.0"
version = "0.17.1"
edition.workspace = true
rust-version.workspace = true
description = "Low-level networking for Bevy"
Expand All @@ -20,14 +20,14 @@ document-features = { workspace = true, optional = true }

[features]
default = ["std"]
# #Enable this when generating docs.
## Enable this when generating docs.
document-features = [
"aeronet_transport/document-features",
"dep:document-features",
]
# #Enables standard library support.
## Enables standard library support.
std = ["aeronet_transport/std"]
# #Enables `aeronet_transport/visualizer`.
## Enables `aeronet_transport/visualizer`.
visualizer = ["aeronet_transport/visualizer", "std"]

[lints]
Expand Down
2 changes: 1 addition & 1 deletion crates/aeronet_channel/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "aeronet_channel"
version = "0.17.0"
version = "0.17.1"
edition.workspace = true
description = "In-memory MPSC channel IO layer implementation for `aeronet`"
repository.workspace = true
Expand Down
8 changes: 6 additions & 2 deletions crates/aeronet_channel/examples/channel.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ fn main() -> AppExit {
// This will automatically add the `AeronetIoPlugin`.
ChannelIoPlugin,
))
.add_systems(Startup, setup)
.add_systems(Startup, (setup_camera, setup_io))
.add_systems(Update, add_msgs_to_ui)
.add_systems(EguiPrimaryContextPass, session_ui)
.run()
Expand All @@ -35,7 +35,11 @@ struct SessionUi {
log: Vec<String>,
}

fn setup(mut commands: Commands) {
fn setup_camera(mut commands: Commands) {
commands.spawn(Camera2d);
}

fn setup_io(mut commands: Commands) {
// Typically, you'll use commands to create a session.
// With other implementations, you spawn an entity and push an
// `EntityCommand` onto it to set up the session.
Expand Down
4 changes: 2 additions & 2 deletions crates/aeronet_io/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "aeronet_io"
version = "0.17.0"
version = "0.17.1"
edition.workspace = true
rust-version.workspace = true
description = "IO abstraction primitives for `aeronet`"
Expand Down Expand Up @@ -34,7 +34,7 @@ bytes = { workspace = true, features = ["extra-platforms"] }

[features]
default = ["std"]
# #Enables standard library support.
## Enables standard library support.
std = ["anyhow/std", "bevy_platform/std", "bytes/std", "log/std"]

[lints]
Expand Down
10 changes: 5 additions & 5 deletions crates/aeronet_replicon/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "aeronet_replicon"
version = "0.17.0"
version = "0.17.1"
edition.workspace = true
rust-version.workspace = true
description = "`aeronet` backend implementation for `bevy_replicon`"
Expand All @@ -26,13 +26,13 @@ log = { workspace = true }

[features]
default = ["std"]
# #Enables support for `bevy_replicon/client`.
## Enables support for `bevy_replicon/client`.
client = ["bevy_replicon/client"]
# #Enable this when generating docs.
## Enable this when generating docs.
document-features = ["dep:document-features"]
# #Enables support for `bevy_replicon/server`.
## Enables support for `bevy_replicon/server`.
server = ["bevy_replicon/server"]
# #Enables standard library support.
## Enables standard library support.
std = ["aeronet_transport/std"]

[lints]
Expand Down
7 changes: 4 additions & 3 deletions crates/aeronet_steam/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "aeronet_steam"
version = "0.17.0"
version = "0.17.1"
edition.workspace = true
rust-version.workspace = true
description = "Steam networking IO layer implementation for `aeronet`"
Expand Down Expand Up @@ -44,14 +44,15 @@ tracing = { workspace = true }
[dev-dependencies]
bevy = { workspace = true }
bevy_egui = { workspace = true }
cfg-if = { workspace = true }

[target.'cfg(not(target_family = "wasm"))'.dependencies]
steamworks = { workspace = true }

[features]
# #Enables the `client` module.
## Enables the `client` module.
client = []
# #Enables the `server` module.
## Enables the `server` module.
server = []

[lints]
Expand Down
26 changes: 19 additions & 7 deletions crates/aeronet_steam/examples/steam_client.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,13 @@
//! Example showing a Steam sockets client which can send and receive UTF-8
//! strings.

cfg_if::cfg_if! {
if #[cfg(target_family = "wasm")] {
fn main() {
panic!("not supported on WASM");
}
} else {

use {
aeronet_io::{
Session, SessionEndpoint,
Expand All @@ -27,6 +34,7 @@ fn main() -> AppExit {
})
.add_plugins((DefaultPlugins, EguiPlugin::default(), SteamNetClientPlugin))
.init_resource::<Log>()
.add_systems(Startup, setup_camera)
.add_systems(Update, add_msgs_to_ui)
.add_systems(EguiPrimaryContextPass, (global_ui, session_ui).chain())
.add_observer(on_connecting)
Expand All @@ -44,6 +52,10 @@ struct SessionUi {
log: Vec<String>,
}

fn setup_camera(mut commands: Commands) {
commands.spawn(Camera2d);
}

fn on_connecting(trigger: On<Add, SessionEndpoint>, names: Query<&Name>, mut log: ResMut<Log>) {
let session = trigger.event_target();
let name = names
Expand Down Expand Up @@ -192,13 +204,11 @@ fn session_ui(
})
.inner;

if send_msg {
if let Some(session) = &mut session {
let msg = mem::take(&mut ui_state.msg);
ui_state.log.push(format!("< {msg}"));
session.send.push(msg.into());
ui.memory_mut(|m| m.request_focus(msg_resp.id));
}
if send_msg && let Some(session) = &mut session {
let msg = mem::take(&mut ui_state.msg);
ui_state.log.push(format!("< {msg}"));
session.send.push(msg.into());
ui.memory_mut(|m| m.request_focus(msg_resp.id));
}

if ui.button("Disconnect").clicked() {
Expand Down Expand Up @@ -231,3 +241,5 @@ fn session_ui(

Ok(())
}

}}
9 changes: 9 additions & 0 deletions crates/aeronet_steam/examples/steam_server.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,13 @@
//! Example server using Steam which listens for clients sending strings and
//! sends back a string reply.

cfg_if::cfg_if! {
if #[cfg(target_family = "wasm")] {
fn main() {
panic!("not supported on WASM");
}
} else {

use {
aeronet_io::{
Session, SessionEndpoint,
Expand Down Expand Up @@ -129,3 +136,5 @@ fn reply(mut clients: Query<(Entity, &mut Session), With<ChildOf>>) {
}
}
}

}}
18 changes: 15 additions & 3 deletions crates/aeronet_steam/src/config.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,17 @@
use {core::time::Duration, steamworks::networking_types::NetworkingConfigEntry};

/// Configuration for establishing a Steam networking session.
/// **(CURRENTLY BROKEN)** Configuration for establishing a Steam networking
/// session.
///
/// Default values are obtained from [`steamnetworkingsockets.cpp`][sns].
///
/// # Currently Broken
///
/// Due to [steamworks-rs #169](https://github.com/Noxime/steamworks-rs/issues/169),
/// these configuration options currently do nothing. If you attempt to
/// re-enable the functionality and make a non-empty vector of config entries,
/// you will always receive an invalid handle and run into a Steam error.
///
/// [sns]: https://github.com/ValveSoftware/GameNetworkingSockets/blob/62b395172f157ca4f01eea3387d1131400f8d604/src/steamnetworkingsockets/clientlib/csteamnetworkingsockets.cpp#L43
#[derive(Debug, Clone)]
#[allow(
Expand Down Expand Up @@ -65,7 +73,7 @@ impl SessionConfig {
NetworkingConfigEntry as Entry, NetworkingConfigValue as Key,
};

vec![
let entries = vec![
Entry::new_float(Key::FakePacketLossSend, self.fake_packet_loss_send * 100.0),
Entry::new_float(Key::FakePacketLossRecv, self.fake_packet_loss_recv * 100.0),
Entry::new_int32(
Expand Down Expand Up @@ -105,7 +113,11 @@ impl SessionConfig {
Entry::new_int32(Key::MTUPacketSize, usize_to_i32(self.mtu_packet_size)),
Entry::new_int32(Key::SymmetricConnect, i32::from(self.symmetric_connect)),
Entry::new_int32(Key::LocalVirtualPort, self.local_virtual_port),
]
];

// CURRENTLY BROKEN: return an empty vector instead
_ = entries;
Vec::new()
}
}

Expand Down
Loading