bevy icon indicating copy to clipboard operation
bevy copied to clipboard

Query as Entities

Open re0312 opened this issue 8 months ago • 1 comments

relationship requires a more performant and powerful way to manage query's state, as archetype fragmentation becomes prevalent when relationships are used.

This goal can be achieved through 'Query as Entities' – a pattern that selectively exposes new/deleted archetypes only to affected queries requiring iteration over them.

There are some excellent PRs that have tried to implement it for Bevy: #14668 , #18860

Implementation Steps:

  • [x] Trigger an event when a new archetype is created.
  • [ ] Componentize system-internal QueryState.
  • [ ] Use Observer to manage query entities.
  • [ ] Type-erased QueryState Component.
  • [ ] (optional) Provide users with a more ergonomic way to use managed QueryState.
  • [ ] (optional) To optimize, only notify observers of impacted query entities instead of iterating over every query entity.

re0312 avatar Jun 01 '25 02:06 re0312

As SME-ECS, I'm in favor of this plan :)

alice-i-cecile avatar Jun 02 '25 18:06 alice-i-cecile