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

Hierarchical states (substates) through system ordering #11073

Closed
MiniaczQ opened this issue Dec 23, 2023 · 6 comments
Closed

Hierarchical states (substates) through system ordering #11073

MiniaczQ opened this issue Dec 23, 2023 · 6 comments
Labels
A-ECS Entities, components, systems, and events C-Feature A new feature, making something new possible X-Controversial There is active debate or serious implications around merging this PR

Comments

@MiniaczQ
Copy link
Contributor

MiniaczQ commented Dec 23, 2023

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

Bevy's state API is good for flat states, but it's hard to work with nested/hierarchical states.

What solution would you like?

Add API for adding substates and system ordering for propagating it same tick.
This also requires substates to be inactive when their parent isn't in the correct state.

Prototype, tests double as examples.

What alternative(s) have you considered?

@MiniaczQ MiniaczQ added C-Feature A new feature, making something new possible S-Needs-Triage This issue needs to be labelled labels Dec 23, 2023
@alice-i-cecile alice-i-cecile added A-ECS Entities, components, systems, and events and removed S-Needs-Triage This issue needs to be labelled labels Dec 25, 2023
@alice-i-cecile alice-i-cecile changed the title Hierarchical states through system ordering Hierarchical states (substates) through system ordering Dec 25, 2023
@alice-i-cecile alice-i-cecile added the X-Controversial There is active debate or serious implications around merging this PR label Dec 25, 2023
@SIGSTACKFAULT
Copy link
Contributor

previous work: #9942

@MiniaczQ
Copy link
Contributor Author

previous work: #9942

Appears to be the source of #10088

@lee-orr
Copy link
Contributor

lee-orr commented Dec 29, 2023

@MiniaczQ - I'd consider this more of a compliment to #10088. That PR doesn't actually provide built in hierarchical states, instead focusing on allowing a wider array of pattern matching options for the currently supported state types (which can be structs or enums, but currently only have a built-in way to handle full equality for matches).

Overall I do like a lot of this approach, though I only had a cursory glance here. The text history around #9957 might give some context for how I ended up with #10088, and the removal of Conditional States (which were my attempt at handling hierarchy). - figured that older PR might be useful as a reference for prior work as well...

@MiniaczQ
Copy link
Contributor Author

Yeah, the more I work on a solution the less it collides with the state matching PR.
While access to lower level states in a simple way is important, I run into a lot of cases where partial access, both for matching and updating, would be nice.
Pattern matching is certainly not something that can be done with schedules.

A complementary to matching would be partial update through NextState, which I'm considering the necessity of

@lee-orr
Copy link
Contributor

lee-orr commented Feb 2, 2024

@MiniaczQ - With the addition of SubStates to #11426 - do you think that would resolve this issue? Or would more work be necessary on that front?

@MiniaczQ
Copy link
Contributor Author

MiniaczQ commented Feb 3, 2024

I think this covers the use case :)

@MiniaczQ MiniaczQ closed this as completed Feb 3, 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-Feature A new feature, making something new possible X-Controversial There is active debate or serious implications around merging this PR
Projects
None yet
Development

No branches or pull requests

4 participants