Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Indexes: look up entities by the value of their components #4513

Open
alice-i-cecile opened this issue Apr 18, 2022 · 1 comment
Open

Indexes: look up entities by the value of their components #4513

alice-i-cecile opened this issue Apr 18, 2022 · 1 comment
Labels
A-ECS Entities, components, systems, and events C-Enhancement A new feature S-Needs-Design-Doc This issue or PR is particularly complex, and needs an approved design doc before it can be merged

Comments

@alice-i-cecile
Copy link
Member

alice-i-cecile commented Apr 18, 2022

What problem does this solve or what need does it fill?

An "index" is a way to quickly find entries based on their value.
In the context of an ECS, indexes would let us e.g. "find all entities with components of this enum value", identify all entities inside a spatial region using a quadtree on Transform, quickly look up entities by their Name, or filter entities to find all components whose value lies within a range.

What solution would you like?

Provide a native, efficient, fool-proof indexing solution.
Ideally, this should be user-extensible to account for other forms of acceleration data-structure.
This will be naturally coupled with change detection to ensure efficient updating.

The design of this is rather challenging, and requires a full RFC.

What alternative(s) have you considered?

Linear time search will always work... slowly. Parallel query tools will help though.

Users can hand-roll this themselves right now, using a resource and Query::get. This is not particularly ergonomic, requires writing a lot of boilerplate, forces users to duplicate the API work for each project, and forces them to reckon with the perils of synchronization alone.

Additional context

May be useful for #3742. Would be useful for #1470. #1205 discusses some of the challenges and possible designs for data synchronization.

@alice-i-cecile alice-i-cecile added C-Enhancement A new feature A-ECS Entities, components, systems, and events S-Needs-Design-Doc This issue or PR is particularly complex, and needs an approved design doc before it can be merged labels Apr 18, 2022
@alice-i-cecile alice-i-cecile changed the title Indexes: Indexes: look up entities by the value of their components Apr 18, 2022
@laundmo
Copy link
Contributor

laundmo commented May 4, 2022

I just released a crate which would benefit a lot from some better way of integrating with bevy: https://crates.io/crates/bevy_spatial

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-ECS Entities, components, systems, and events C-Enhancement A new feature S-Needs-Design-Doc This issue or PR is particularly complex, and needs an approved design doc before it can be merged
Projects
None yet
Development

No branches or pull requests

2 participants