You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Originally, we used commands to insert or remove components during
replication. This wasn't optimal because Bevy doesn't batch commands.
However, since Bevy was considering adding support for batching, we
decided to wait.
With the introduction of triggers, this became a real issue: triggers
would fire after each insertion, and inside the observer, the user
might not be able to access all components (depending on the insertion
order).
This change replaces commands with insertion and removal methods on
`DeferredEntity` that buffer all changes and apply them later using
`EntityWorldMut::insert_by_ids` and `EntityWorldMut::remove_by_ids`.
They are flushed after processing each entity. This not only makes
triggers behave as expected, but also significantly improves
performance by avoiding extra archetype moves and lookups.
I also slightly changed the behavior of the `Replicated` component to
simplify the implementation and unlock additional performance.
`Replicated` is no longer automatically inserted into non-replicated
entities spawned from replicated components. This change is consistent
with server behavior, where such entities also do not have the
`Replicated` component.
The commit entry-based API for `ServerEntityMap` that is required for this change.
Copy file name to clipboardExpand all lines: CHANGELOG.md
+5Lines changed: 5 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -21,9 +21,14 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
21
21
-`ReplicationRule` now stores `Vec<ComponentRule>` instead of `Vec<(ComponentId, FnsId)>`
22
22
-`RuleFns` now available from prelude.
23
23
- Rules created with the same priority now evaluated in their creation order.
24
+
- 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.
25
+
- The `Replicated` component is no longer automatically inserted into non-replicated entities spawned from replicated components.
26
+
- Replace `ServerEntityMap::get_by_*` and `ServerEntityMap::remove_by_*` with an entry-based API. Use `ServerEntityMap::server_entry` or `ServerEntityMap::client_entry` instead.
27
+
- Print error instead of panic on mapping overwrite in `ServerEntityMap`.
24
28
25
29
### Removed
26
30
31
+
-`WriteCtx::commands`. You can now insert and remove components directly through `DeferredEntity`.
0 commit comments