Skip to content

Commit

Permalink
Rework events
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
Shatur committed May 21, 2024
1 parent fc189a7 commit 565cbd8
Show file tree
Hide file tree
Showing 25 changed files with 1,484 additions and 848 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

### Changed

- 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.
- 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.

## [0.25.2] - 2024-05-18

### Fixed
Expand Down
6 changes: 2 additions & 4 deletions src/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,8 @@ use varint_rs::VarintReader;
use crate::core::{
command_markers::{CommandMarkers, EntityMarkers},
common_conditions::{client_connected, client_just_connected, client_just_disconnected},
replication_fns::{
ctx::{DespawnCtx, RemoveCtx, WriteCtx},
ReplicationFns,
},
ctx::{DespawnCtx, RemoveCtx, WriteCtx},
replication_fns::ReplicationFns,
replicon_channels::{ReplicationChannel, RepliconChannels},
replicon_tick::RepliconTick,
Replicated,
Expand Down
Loading

0 comments on commit 565cbd8

Please sign in to comment.