Skip to content

Commit 565cbd8

Browse files
committed
Rework events
Events was implemented this way since the initial release of replicon (it was more then a year ago, time flies quickly!), but it have some flaws: - Public API for custom ser/de require user to define the whole sending and receiving functions which is not ergonomic. It's especially bad for server events where user need to use a few public helpers that we provided to reduce the boilerplate. - It creates a new set of systems for each replicon event. It's not very efficient and Bevy recently did [a nice optimization](bevyengine/bevy#12936) which we also can do. It won't be that noticeable since user register much less amount of replicon events, but nice to have.
1 parent fc189a7 commit 565cbd8

25 files changed

+1484
-848
lines changed

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
77

88
## [Unreleased]
99

10+
### Changed
11+
12+
- Custom events now registered with serialization and deserialization functions instead of systems. This makes the API more convenient since the purpose of custom systems was to customize serialization.
13+
- All events are processed in one system instead of a separate system for each event. Bevy does a [similar optimization](https://github.com/bevyengine/bevy/pull/12936) for event updates. It won't be that noticeable since user register much less amount of replicon events.
14+
1015
## [0.25.2] - 2024-05-18
1116

1217
### Fixed

src/client.rs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,8 @@ use varint_rs::VarintReader;
1313
use crate::core::{
1414
command_markers::{CommandMarkers, EntityMarkers},
1515
common_conditions::{client_connected, client_just_connected, client_just_disconnected},
16-
replication_fns::{
17-
ctx::{DespawnCtx, RemoveCtx, WriteCtx},
18-
ReplicationFns,
19-
},
16+
ctx::{DespawnCtx, RemoveCtx, WriteCtx},
17+
replication_fns::ReplicationFns,
2018
replicon_channels::{ReplicationChannel, RepliconChannels},
2119
replicon_tick::RepliconTick,
2220
Replicated,

0 commit comments

Comments
 (0)