Releases: simgine/bevy_replicon
Releases · simgine/bevy_replicon
Bevy Replicon 0.35.0
Added
PriorityMapcomponent for authorized clients to control how often mutations are sent.Signaturecomponent to match entities between client and server using hashes.*_filteredmethods forAppRuleExtthat allow usingWith,WithoutandOrfilters to define replication rules.compact_entitywith functions forserdeto packEntitymore efficienly.postcard_utils::entity_to_extend_mutandpostcard_utils::entity_from_bufhelpers that usecompact_entity.AppRuleExt::replicate_bundle_withto customize the priority of the bundle.AppRuleExt::replicate_as*functions to convert the component into a different struct before serialization and after deserialiation.
Changed
- Rename
RepliconClientStatustoClientStateandRepliconServerStatustoServerState. They are now regular Bevy states. As result, we now requireStatesPluginto be added. It's present by default inDefaultPlugins, but withMinimalPluginsyou have to add it manually. - Replace
ServerPlugin::tick_policywithServerPlugin::tick_schedule, which specifies the schedule where the tick increments. By default, it'sFixedPostUpdate. You can control how often it runs withTime<Fixed>resource. If you want to mimicTickPolicy::EveryFrame, set the schedule toPostUpdate. - All contexts now store
AppTypeRegistryinstead ofTypeRegistry. To getTypeRegistry, callAppTypeRegistry::read. - All events now use
ClientIdwrapper instead ofEntity. AppTypeRegistrynow available on replication for observers.postcard_utilsnow a top-level module. Instead ofbevy_replicon::shared::postcard_utils, it's now justbevy_replicon::postcard_utils.- Rename
FromClient::client_entityintoFromClient::client_id. - Rename
DisconnectRequest::client_entityintoDisconnectRequest::client. - Rename
SendRateintoReplicationMode. TheEveryTickvariant was also renated intoOnChange. - Rename
ClientSetintoClientSystems. - Rename
ServerSetintoServerSystems. - Rename
ComponentRule::send_rateintoComponentRule::mode. - Rename
replicon_channelsmodule intochannels. - Rename
replication_rulesmodule intorules. - Rename
replication_registrymodule intoregistry. - Rename
IntoComponentRule::register_componenttoIntoComponentRule::into_ruleand move it to theshared::replication::rules::componentmodule. - Rename
NetworkStatstoClientStatsand move it fromshared::backend::connected_clienttoshared::backend. It's also now a separate resource fromRepliconClient. - Rename
RepliconClientintoClientMessages. It holds only messages now. - Rename
RepliconServerintoServerMessages. It holds only messages now. - Replace
IntoReplicationRulewithIntoComponentRules, which returns onlyVec<ComponentRule>. - Replace
ReplicationBundlewithBundleRules, which returns onlyVec<ComponentRule>and uses an associated constant to customize the priority. - Hide
ServerEntityMapmutation methods from public API. - Hide
BufferedMutationsfrom public API. - Hide
server::increment_tickfrom public API. ExampleClient::newnow acceptsimpl Into<SocketAddr>. This makes it easier for backend developers to port examples since they usually specify IP address.- Switch from the FNV hasher to xxh3. It's faster and produces high-quality hashes. The hasher is now also wrapped in deterministic-hash, which ensures consistent endianness and handles
usizeportably.
Removed
ClientEntityMap. Use the newly addedSignaturecomponent instead.VisibilityPolicy::All. UseVisibilityPolicy::Blacklistinstead, which is the default now. There are not performance difference when the list is empty.entity_serde::serialize_entityandentity_serde::deserialize_entity. Usepostcard_utils::entity_to_extend_mutandpostcard_utils::entity_from_bufrespectively; just swap the argument order.SERVER. UseClientId::Serverinstead.SendRate::Periodic. UsePriorityMapinstead.TickPolicy. Set the schedule directly toServerPlugin::tick_schedule.- All provided run conditions. Just use
in_stateorOnEnter/OnExitwithServerStateandClientStateinstead.server_or_singleplayeris justin_state(ClientState::Disconnected).
Bevy Replicon 0.34.4
Changed
- Make
DeferredEntity::new,DeferredEntity::flushandDeferredChangespublic.
Bevy Replicon 0.34.3
Fixed
- Make
ProtocolHashdeterministic across platforms by usingfnvinstead offoldhash. - Reset
ServerMutateTickson disconnect. - Avoid calling
dropon uninitialized memory for components withBoxorArcduring buffered insertion.
Bevy Replicon 0.34.1
Changed
- Log replication errors instead of panicking. We use panics only for things that should never happen, but users could sometimes trigger them by messing with entities, so we now log these errors to simplify debugging in those cases.
- Spawn all allocated entities after processing each replicated entity.
Bevy Replicon 0.34.0
Added
- Authorization system. By default we just verify compatibility between client and server, but it's customizable via
RepliconSharedPlugin::auth_method. - Configurable
SendRatefor deterministic replication. UseSendRate::Onceto send only the initial value, orSendRate::Periodicto only sync the state periodically. AppRuleExt::replicate_with_priorityto configure replication rule priority.DisconnectRequestevent to queue a disconnection for a specific client on the server.ServerTriggerAppExt::make_trigger_independent.
Changed
AppRuleExt::replicate_withnow acceptsIntoReplicationRuletrait that allows to define rules with multiple components.- Rename
GroupReplicationintoBundleReplication. - Rename
ReplicatedClientintoAuthorizedClient. - Rename
AppRuleExt::replicate_groupintoAppRuleExt::replicate_bundle. - Rename
replication_registry::despawn_recursiveintoreplication_registry::despawn. - Rename
shared::event::triggermodule intoshared::event::remote_targets. - Rename
ServerEventAppExt::make_independentintoServerEventAppExt::make_event_independent. It never worked for triggers. ReplicationRulenow storesVec<ComponentRule>instead ofVec<(ComponentId, FnsId)>RuleFnsnow available from prelude.- Initialize channels in
App::finishinstead ofStartup. It's called automatically onApp::run, but in tests you need to callApp::finishmanually. - Rules created with the same priority now evaluated in their creation order.
- Component removals and insertions for an entity are now buffered and applied as bundles to avoid triggering observers without all components being inserted or removed. This also significantly improves performance by avoiding extra archetype moves and lookups.
- The
Replicatedcomponent is no longer automatically inserted into non-replicated entities spawned from replicated components. - Replace
ServerEntityMap::get_by_*andServerEntityMap::remove_by_*with an entry-based API. UseServerEntityMap::server_entryorServerEntityMap::client_entryinstead. - Split
ReplicationChannelintoServerChannelandClientChannelfor clarity. - Don't register an additional unreliable client channel for replication. While the server requires two channels, the client only needs one.
- Print error instead of panic on mapping overwrite in
ServerEntityMap. - Making
tracelogging level less verbose and more informative.
Removed
WriteCtx::commands. You can now insert and remove components directly throughDeferredEntity.RepliconClient::receiveandRepliconServer::receiveare now private since they should only be called internally by Replicon.ServerPlugin::replicate_after_connect. UseRepliconSharedPlugin::auth_methodwithAuthMethod::Custominstead.- Deprecated methods.
Bevy Replicon 0.34.0 RC 1
Added
- Authorization system. By default we just verify compatibility between client and server, but it's customizable via
RepliconSharedPlugin::auth_method. - Configurable
SendRatefor deterministic replication. UseSendRate::Onceto send only the initial value, orSendRate::Periodicto only sync the state periodically. AppRuleExt::replicate_with_priorityto configure replication rule priority.DisconnectRequestevent to queue a disconnection for a specific client on the server.ServerTriggerAppExt::make_trigger_independent.
Changed
AppRuleExt::replicate_withnow acceptsIntoReplicationRuletrait that allows to define rules with multiple components.- Rename
GroupReplicationintoBundleReplication. - Rename
ReplicatedClientintoAuthorizedClient. - Rename
AppRuleExt::replicate_groupintoAppRuleExt::replicate_bundle. - Rename
replication_registry::despawn_recursiveintoreplication_registry::despawn. - Rename
shared::event::triggermodule intoshared::event::remote_targets. - Rename
ServerEventAppExt::make_independentintoServerEventAppExt::make_event_independent. It never worked for triggers. ReplicationRulenow storesVec<ComponentRule>instead ofVec<(ComponentId, FnsId)>RuleFnsnow available from prelude.- Initialize channels in
App::finishinstead ofStartup. It's called automatically onApp::run, but in tests you need to callApp::finishmanually. - Rules created with the same priority now evaluated in their creation order.
- Component removals and insertions for an entity are now buffered and applied as bundles to avoid triggering observers without all components being inserted or removed. This also significantly improves performance by avoiding extra archetype moves and lookups.
- The
Replicatedcomponent is no longer automatically inserted into non-replicated entities spawned from replicated components. - Replace
ServerEntityMap::get_by_*andServerEntityMap::remove_by_*with an entry-based API. UseServerEntityMap::server_entryorServerEntityMap::client_entryinstead. - Split
ReplicationChannelintoServerChannelandClientChannelfor clarity. - Don't register an additional unreliable client channel for replication. While the server requires two channels, the client only needs one.
- Print error instead of panic on mapping overwrite in
ServerEntityMap.
Removed
WriteCtx::commands. You can now insert and remove components directly throughDeferredEntity.RepliconClient::receiveandRepliconServer::receiveare now private since they should only be called internally by Replicon.ServerPlugin::replicate_after_connect. UseRepliconSharedPlugin::auth_methodwithAuthMethod::Custominstead.- Deprecated methods.
Bevy Replicon 0.33.0
Added
- Support for
no_std. - Relationships networking. Use
SyncRelatedAppExt::sync_related_entities<C>to ensure that entities related byCare replicated in sync. - Seamless support for immutable components. For these components, replication is always applied via insertion.
server_just_startedrun condition.
Changed
- Update to Bevy 0.16.
- All serde methods now use
bevy::ecs::error::Resultinstead ofpostcard::Resultfor more informative errors. AppRuleExt::replicate_mapped,RuleFns::default_mappedanddefault_deserialize_mappednow deprecated. Entities inside components now mapped automatically, use methods without_mappedprefixes.- Use an observer instead of a system to track despawns.
Removed
parent_syncmodule and corresponding feature. Just replicateChildOfdirectly.
Bevy Replicon 0.32.2
Changed
- Preserve removals before inserts
Bevy Replicon 0.32.1
Changed
- Publicize
ClientTickscomponent and itsupdate_tickmethod.
Bevy Replicon 0.32.0
Added
RemoteEventRegistryto get channels for remote triggers and events.ConditionerConfigforbevy_replicon_example_backendto simulate various network conditions.
Changed
- Rename
ChannelKindinto justChannel. - Rename
channelsmodule intoreplicon_channels. - Rename
coremodule intosharedandRepliconCorePluginintoRepliconSharedPlugin. To avoid ambiguity with Rust'score, which will be used forno_stdsupport in the next release. - Move
replicon_server,replicon_client,connected_clientandreplicon_channelsunderbackendmodule to group all backend-related API. - All methods with
Into<Channel>now just acceptChannel. - Use
usizefor channel ID. Backends now decide how many channels user can create. - Don't insert
ClientVisibilityat all ifServerPlugin::visibility_policyis set toVisibilityPolicy::All. Previously all calls were just no-op.
Removed
RepliconChanneland all methods fromRepliconChannels, except channel getters. Now all channel configuration needs to be done on the backend side.