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

Replace RemovedComponents with observers #13928

Open
alice-i-cecile opened this issue Jun 19, 2024 · 2 comments
Open

Replace RemovedComponents with observers #13928

alice-i-cecile opened this issue Jun 19, 2024 · 2 comments
Labels
A-ECS Entities, components, systems, and events C-Code-Quality A section of code that is hard to understand or change C-Usability A targeted quality-of-life change that makes Bevy easier to use D-Modest A "normal" level of difficulty; suitable for simple features or challenging fixes S-Blocked This cannot move forward until something else changes X-Contentious There are nontrivial implications that should be thought through
Milestone

Comments

@alice-i-cecile
Copy link
Member

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

RemovedComponents isn't a particularly nice tool: it doesn't fit into our existing tools for responding to changes well, doesn't allow users to read the data as it's being removed, must be continually monitored to avoid missing events, and risks desynchronization because of the polling-based mechanism.

What solution would you like?

Observers (merged in #10839) offer an alternative solution to this problem space without the caveats.

We should deprecate and then remove [RemovedComponents], being careful to update and improve documentation and write a clear migration guide.

In particular, users can emit events, triggered by an observer, to recreate the previous polling-style behavior when it is preferred.

What alternative(s) have you considered?

Other solutions to solve and/or work around the problem presented.

Additional context

#2148 proposes a Removed query filter, which might still be a valuable (if complex) complement even with this PR implemented.

@alice-i-cecile alice-i-cecile added A-ECS Entities, components, systems, and events C-Code-Quality A section of code that is hard to understand or change C-Usability A targeted quality-of-life change that makes Bevy easier to use X-Contentious There are nontrivial implications that should be thought through D-Modest A "normal" level of difficulty; suitable for simple features or challenging fixes labels Jun 19, 2024
@alice-i-cecile alice-i-cecile added this to the 0.15 milestone Jul 4, 2024
@alice-i-cecile alice-i-cecile moved this to Active: engine observers and hooks in Alice's Work Planning Jul 8, 2024
@Azorlogh
Copy link
Contributor

Just a note: I think this issue should be blocked on the ability to order observers. The event still has the advantage that we can read it at precise moments until that feature is implemented

@Shatur
Copy link
Contributor

Shatur commented Nov 8, 2024

RemovedComponents also allow to react on despawns.
We need to implement a similar mechanism for observers before removing them.

@BenjaminBrienen BenjaminBrienen added the S-Blocked This cannot move forward until something else changes label Nov 10, 2024
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-Code-Quality A section of code that is hard to understand or change C-Usability A targeted quality-of-life change that makes Bevy easier to use D-Modest A "normal" level of difficulty; suitable for simple features or challenging fixes S-Blocked This cannot move forward until something else changes X-Contentious There are nontrivial implications that should be thought through
Projects
Archived in project
Development

No branches or pull requests

4 participants