Relational Queries
- Dominant language
- Rust
- Stars
- 48.2k
- Forks
- 4.8k
- Avg merge
- 3d 16h
- Merged PRs (30d)
- 171
Description
## Goal Description
Accessing related entities (parents, children, ancestors) is a common demand when writing more complex logic in the ECS (particularly when working with scenes or UI). Our existing solutions are insufficiently ergonomic and challenging to discover, and inadequately composable. Without the use of multiple queries, boilerplate logic or exclusive systems, users should be able to:
- fetch the value of a given component on the entity's parent
- fetch the value of a given component from the first encountered ancestor on an entity, if such an entity is found
- fetch the entity ID of the first encountered sibling entity with the given component
- find the first child or grand-child with the given component
- check if the values of a given component on any of the (recursive) children have changed
- perform all of these operations but using arbitrary tree-like relationships instead of `Children`/`ChildOf`
Relational queries which involve value-checking are out-of-scope: only existing query filters need to be supported.
Previously: https://github.com/bevyengine/bevy/issues/17647
## Goal Status
This is a potential [Bevy Project Goal](https://bevy.org/learn/contribute/project-information/project-goals/). Its state on the [Project Goals Board](https://github.com/orgs/bevyengine/projects/23/views/1) determines if it is Proposed, Postponed, Blocked (Approved), Inactive (Approved), Active (Approved), Completed, or Declined.
- **Staffing SMEs**: Not yet staffed
- **Working Group Link**: Working Group not yet formed
- **Design Documents**: Design documents not yet written
Contributor guide
Research direction
Start with the previous issue (#17647) and the Project Goals Board; no implementation files or tests are named. Review the requested parent, ancestor, sibling, child, change-detection, and arbitrary-tree operations, then consult the design documents once written. Done should cover the stated operations while keeping relational value-checking out of scope.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- game-dev
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Quiet
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100