projectharmonia / bevy_replicon

Server-authoritative networking crate for the Bevy game engine.
https://crates.io/crates/bevy_replicon
Apache License 2.0
329 stars 30 forks source link

Use `EntityWorldMut::insert_by_ids` #332

Open Shatur opened 2 weeks ago

Shatur commented 2 weeks ago

Currently, we insert components one by one, which causes a lot of archetype moves and behaves somewhat unexpectedly with observers/hooks. To solve this, we could pass a special buffer for components instead of using Commands, and after all insertions, call EntityWorldMut::insert_by_ids.

UkoeHB commented 2 weeks ago

If bevy implements command batching, this would no longer be a perf issue (although observers might still run separately).