Skip to content

Commit

Permalink
Update to 0.14.0-rc (#289)
Browse files Browse the repository at this point in the history
* Update to 0.14.0-rc.2

* Temporary disable CI for bevy_replicon_renet

* Minor stylistic changes

Just a few spaces and an intermediate veriable to make the code look a
little bit nicer.

* Bump version to 0.27.0-rc.1

* Remove bevy_replicon_renet from workspace

* Bump version to 0.27.0-rc.2

* Undo changes in bevy_replicon_renet [skip ci]

* Rework events organization

- Swap `receive` system between ServerEventsPlugin and `ClientEventsPlugin` to properly separate what what runs on client or server.
- Move `ServerEventsPlugin::reset` logic inside `ClientEventsPlugin::reset` because this logic runs on client.
- Move `server::events::event_data` module to `core::event_registry::server_event`.
- Move `client::events::event_data` module to `core::event_registry::client_event`.

No functional changes, except `ServerEventsPlugin` and `ClientEventsPlugin` can be disabled on client-only and server-only apps respectively.

Closes #276.

* Do not divide values per seconds by the number of messages

* Update changelog [skip ci]

* Put `ClientDiagnosticsPlugin` under `diagnostics` feature (#295)

* Put `scene` module under `scene` feature (enabled by default)

* Put `parent_sync` module under `parent_sync` feature

* Client-server-features (#298)

* Use GitHub's warning about semver compatibility

https://docs.github.com/en/get-started/writing-on-github/getting-started-with-writing-and-formatting-on-github/basic-writing-and-formatting-syntax#alerts

* Document features better

I took inspiration from Bevy.

* Update src/lib.rs

* Move `bevy_replicon_renet` to a dedicated repository

* Bump version to 0.27.0-rc.3

* Fix copy-paste

* Speedup removals caching

The necessary method was provided in 0.14.

* Remove mentions of the RC

Without it it will be quite hard to read the changelog (users will have to check  the changes from RC) or I will need to copy all changes from RC for the upcoming 0.27.0.

I also removed it from the compatibility table as suggested by @UkoeHB. I also don't think that they will be useful... Keeping them will make the table harder to read.
Another option would be to keep them, but put under a spoiler.

---------

Co-authored-by: UkoeHB <[email protected]>
  • Loading branch information
Shatur and UkoeHB authored Jul 4, 2024
1 parent 84c38cf commit 30ef986
Show file tree
Hide file tree
Showing 55 changed files with 1,762 additions and 3,159 deletions.
2 changes: 0 additions & 2 deletions .github/workflows/dependencies.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,5 +26,3 @@ jobs:

- name: Check dependencies
uses: EmbarkStudios/cargo-deny-action@v1
with:
arguments: --workspace
31 changes: 25 additions & 6 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,12 +47,10 @@ jobs:
uses: Swatinem/rust-cache@v2

- name: Clippy
run: cargo clippy --workspace --benches --tests -- -D warnings
run: cargo clippy --benches --tests -- -D warnings

- name: Rustdoc
run: |
cargo rustdoc -- -D warnings
cargo rustdoc -p bevy_replicon_renet -- -D warnings
run: cargo rustdoc --all-features -- -D warnings

doctest:
name: Doctest
Expand All @@ -68,7 +66,28 @@ jobs:
uses: Swatinem/rust-cache@v2

- name: Test doc
run: cargo test --workspace --doc
run: cargo test --all-features --doc

feature-combinations:
name: Feature combinations
runs-on: ubuntu-latest
steps:
- name: Clone repo
uses: actions/checkout@v4

- name: Instal stable toolchain
uses: dtolnay/rust-toolchain@stable

- name: Cache crates
uses: Swatinem/rust-cache@v2

- name: Install Cargo Hack
run: cargo install cargo-hack

- name: Check feature combinations
run: cargo hack check --feature-powerset
env:
RUSTFLAGS: -Aunused -Dwarnings

test:
name: Test
Expand All @@ -90,7 +109,7 @@ jobs:
run: cargo install cargo-tarpaulin

- name: Test
run: cargo tarpaulin --workspace --engine llvm --out lcov --exclude-files benches/*
run: cargo tarpaulin --all-features --engine llvm --out lcov --exclude-files benches/*

- name: Upload code coverage results
if: github.actor != 'dependabot[bot]'
Expand Down
23 changes: 23 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,29 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

### Changed

- Update to Bevy `0.14.0-rc.4`.
- Move `bevy_replicon_renet` to a [dedicated repository](https://github.com/projectharmonia/bevy_replicon_renet).
- `ServerEventsPlugin` and `ClientEventsPlugin` can be disabled on client-only and server-only apps respectively.
- Put `ClientDiagnosticsPlugin` under `client_diagnostics` feature (disabled by default) and make it part of the `RepliconPlugins` group.
- Put `scene` module under `scene` feature (enabled by default).
- Put `parent_sync` module under `parent_sync` feature (enabled by default).
- Put `client` module under `client` feature (enabled by default).
- Put `server` module under `server` feature (enabled by default).
- `TestFnsEntityExt::serialize` now accepts `RepliconTick` for server tick instead of using `ServerTick` resource internally.
- Move `replicon_client`, `server_entity_map`, `replicon_server`, `connected_clients` under `core` module. These modules are needed for both client and server.
- Move `VisibilityPolicy` to `connected_clients` module.
- Move `server::events::event_data` module to `core::event_registry::server_event`.
- Move `client::events::event_data` module to `core::event_registry::client_event`.
- Move `ClientEventAppExt`, `client::events::SerializeFn`, `client::events::DeserializeFn`, `default_serialize`, `default_serialize_mapped`, `default_deserialize` and `FromClient` to `core::event_registry::client_event`.
- Move `ServerEventAppExt`, `server::events::SerializeFn`, `server::events::DeserializeFn`, `default_serialize`, `default_serialize_mapped`, `default_deserialize`, `ToClients` and `SendMode` to `core::event_registry::server_event`.
- Speedup removals caching.

### Fixed

- Do not divide values per seconds by the number of messages for `ClientDiagnosticsPlugin`.

## [0.26.3] - 2024-06-09

### Added
Expand Down
86 changes: 78 additions & 8 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "bevy_replicon"
version = "0.26.3"
version = "0.27.0-rc.3"
authors = [
"Hennadii Chernyshchyk <[email protected]>",
"koe <[email protected]>",
Expand All @@ -20,31 +20,101 @@ categories = ["game-development", "network-programming"]
license = "MIT OR Apache-2.0"
include = ["/benches", "/src", "/tests", "/LICENSE*"]

[package.metadata.docs.rs]
rustdoc-args = ["-Zunstable-options", "--cfg", "docsrs"]
all-features = true

[dependencies]
bevy = { version = "0.13", default-features = false, features = ["bevy_scene"] }
bevy = { version = "0.14.0-rc.4", default-features = false, features = [
"serialize",
] }
bytes = "1.5"
bincode = "1.3"
serde = "1.0"
varint-rs = "2.2"
ordered-multimap = "0.7"

[dev-dependencies]
bevy = { version = "0.13", default-features = false, features = [
bevy = { version = "0.14.0-rc.4", default-features = false, features = [
"serialize",
"bevy_asset",
"bevy_scene",
"bevy_sprite",
] }
criterion = { version = "0.5", default-features = false, features = [
"cargo_bench_support",
] }

[lints.clippy]
type_complexity = "allow"
too_many_arguments = "allow"
[features]
default = ["scene", "parent_sync", "client", "server"]

# Client-related logic.
client = []

# Server-related logic.
server = []

# Integration with Bevy diagnostics for client.
client_diagnostics = ["client"]

# Replication into a scene.
scene = ["bevy/bevy_scene"]

# Hierarchy synchronization.
parent_sync = []

[[bench]]
name = "replication"
harness = false

[workspace]
members = ["bevy_replicon_renet"]
[[test]]
name = "changes"
required-features = ["client", "server"]

[[test]]
name = "client_event"
required-features = ["client", "server"]

[[test]]
name = "connection"
required-features = ["client", "server"]

[[test]]
name = "despawn"
required-features = ["client", "server"]

[[test]]
name = "fns"
required-features = ["client"]

[[test]]
name = "insertion"
required-features = ["client", "server"]

[[test]]
name = "removal"
required-features = ["client", "server"]

[[test]]
name = "scene"
required-features = ["scene"]

[[test]]
name = "server_event"
required-features = ["client", "server"]

[[test]]
name = "spawn"
required-features = ["client", "server"]

[[test]]
name = "stats"
required-features = ["client_diagnostics", "client", "server"]

[[test]]
name = "visibility"
required-features = ["client", "server"]

[lints.clippy]
type_complexity = "allow"
too_many_arguments = "allow"
21 changes: 11 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,17 +39,18 @@ See also [What kind of networking should X game use?](https://github.com/bevyeng

Check out the [quick start guide](https://docs.rs/bevy_replicon).

See also [examples](bevy_replicon_renet/examples) with [`bevy_replicon_renet`](bevy_replicon_renet) as a messaging backend.
For examples navigate to [messaging backends](#messaging-backends) repositories because you will need I/O in order to run them.

Have any questions? Feel free to ask in the dedicated [`bevy_replicon` channel](https://discord.com/channels/691052431525675048/1090432346907492443) in Bevy's Discord server.

## Related Crates

**Note:** Ensure that your `bevy_replicon` version is compatible with the used crate according to semantic versioning.
> [!WARNING]
> Ensure that your `bevy_replicon` version is compatible with the used crate according to semantic versioning.
#### Messaging backends

- [`bevy_replicon_renet`](bevy_replicon_renet) - integration for [`bevy_renet`](https://github.com/lucaspoffo/renet/tree/master/bevy_renet). Provided by this repo.
- [`bevy_replicon_renet`](https://github.com/projectharmonia/bevy_replicon_renet) - integration for [`bevy_renet`](https://github.com/lucaspoffo/renet/tree/master/bevy_renet). Maintained by the authors of this crate.
- [`bevy_replicon_renet2`](https://github.com/UkoeHB/renet2/tree/main/bevy_replicon_renet2) - integration for [`bevy_renet2`](https://github.com/UkoeHB/renet2/tree/main/bevy_renet2). Includes a WebTransport backend for browsers, and enables servers that can manage multi-platform clients simultaneously.
- [`bevy_replicon_quinnet`](https://github.com/Henauxg/bevy_quinnet/tree/main/bevy_replicon_quinnet) - integration for [`bevy_quinnet`](https://github.com/Henauxg/bevy_quinnet).

Expand All @@ -69,10 +70,10 @@ Have any questions? Feel free to ask in the dedicated [`bevy_replicon` channel](

## Bevy compatibility

| bevy | bevy_replicon |
| ------ | ------------- |
| 0.13.0 | 0.23-0.26 |
| 0.12.1 | 0.18-0.22 |
| 0.11.0 | 0.6-0.17 |
| 0.10.1 | 0.2-0.6 |
| 0.10.0 | 0.1 |
| bevy | bevy_replicon |
| ----------- | ------------- |
| 0.13.0 | 0.23-0.26 |
| 0.12.1 | 0.18-0.22 |
| 0.11.0 | 0.6-0.17 |
| 0.10.1 | 0.2-0.6 |
| 0.10.0 | 0.1 |
28 changes: 14 additions & 14 deletions benches/replication.rs
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ fn replication<C: Component + Default + Serialize + DeserializeOwned + Clone>(c:
}

server_app
.world
.world_mut()
.spawn_batch(vec![(Replicated, C::default()); ENTITIES as usize]);

let instant = Instant::now();
Expand All @@ -74,7 +74,7 @@ fn replication<C: Component + Default + Serialize + DeserializeOwned + Clone>(c:
for client_app in &mut client_apps {
server_app.exchange_with_client(client_app);
client_app.update();
assert_eq!(client_app.world.entities().len(), ENTITIES);
assert_eq!(client_app.world().entities().len(), ENTITIES);
}
}

Expand All @@ -95,20 +95,20 @@ fn replication<C: Component + Default + Serialize + DeserializeOwned + Clone>(c:
}

server_app
.world
.world_mut()
.spawn_batch(vec![(Replicated, C::default()); ENTITIES as usize]);
let mut query = server_app.world.query::<&mut C>();
let mut query = server_app.world_mut().query::<&mut C>();

server_app.update();
for client_app in &mut client_apps {
server_app.exchange_with_client(client_app);
client_app.update();
assert_eq!(client_app.world.entities().len(), ENTITIES);
assert_eq!(client_app.world().entities().len(), ENTITIES);
}

let mut elapsed = Duration::ZERO;
for _ in 0..iter {
for mut component in query.iter_mut(&mut server_app.world) {
for mut component in query.iter_mut(server_app.world_mut()) {
component.set_changed();
}

Expand All @@ -119,7 +119,7 @@ fn replication<C: Component + Default + Serialize + DeserializeOwned + Clone>(c:
for client_app in &mut client_apps {
server_app.exchange_with_client(client_app);
client_app.update();
assert_eq!(client_app.world.entities().len(), ENTITIES);
assert_eq!(client_app.world().entities().len(), ENTITIES);
}
}

Expand All @@ -138,7 +138,7 @@ fn replication<C: Component + Default + Serialize + DeserializeOwned + Clone>(c:
server_app.connect_client(&mut client_app);

server_app
.world
.world_mut()
.spawn_batch(vec![(Replicated, C::default()); ENTITIES as usize]);

server_app.update();
Expand All @@ -147,7 +147,7 @@ fn replication<C: Component + Default + Serialize + DeserializeOwned + Clone>(c:
let instant = Instant::now();
client_app.update();
elapsed += instant.elapsed();
assert_eq!(client_app.world.entities().len(), ENTITIES);
assert_eq!(client_app.world().entities().len(), ENTITIES);
}

elapsed
Expand All @@ -162,18 +162,18 @@ fn replication<C: Component + Default + Serialize + DeserializeOwned + Clone>(c:
server_app.connect_client(&mut client_app);

server_app
.world
.world_mut()
.spawn_batch(vec![(Replicated, C::default()); ENTITIES as usize]);
let mut query = server_app.world.query::<&mut C>();
let mut query = server_app.world_mut().query::<&mut C>();

server_app.update();
server_app.exchange_with_client(&mut client_app);
client_app.update();
assert_eq!(client_app.world.entities().len(), ENTITIES);
assert_eq!(client_app.world().entities().len(), ENTITIES);

let mut elapsed = Duration::ZERO;
for _ in 0..iter {
for mut component in query.iter_mut(&mut server_app.world) {
for mut component in query.iter_mut(server_app.world_mut()) {
component.set_changed();
}

Expand All @@ -184,7 +184,7 @@ fn replication<C: Component + Default + Serialize + DeserializeOwned + Clone>(c:

client_app.update();
elapsed += instant.elapsed();
assert_eq!(client_app.world.entities().len(), ENTITIES);
assert_eq!(client_app.world().entities().len(), ENTITIES);
}

elapsed
Expand Down
48 changes: 0 additions & 48 deletions bevy_replicon_renet/Cargo.toml

This file was deleted.

Loading

0 comments on commit 30ef986

Please sign in to comment.