Skip to content

Query as Entities #19454

@re0312

Description

@re0312

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:

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-ECSEntities, components, systems, and eventsC-FeatureA new feature, making something new possibleD-ComplexQuite challenging from either a design or technical perspective. Ask for help!S-Ready-For-ImplementationThis issue is ready for an implementation PR. Go for it!X-Needs-SMEThis type of work requires an SME to approve it.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions