Skip to content

Proof of concept StateRegistry#13757

Closed
MiniaczQ wants to merge 4 commits intobevyengine:mainfrom
MiniaczQ:state-registry
Closed

Proof of concept StateRegistry#13757
MiniaczQ wants to merge 4 commits intobevyengine:mainfrom
MiniaczQ:state-registry

Conversation

@MiniaczQ
Copy link
Contributor

@MiniaczQ MiniaczQ commented Jun 8, 2024

Objective

Fixes #13711

Solution

Introduce StateRegistry, similar to EventRegistry, which manages state-related system execution
as opposed to the current StateTransitions schedule.
The registry holds a linearized DAG of state dependencies.
The update method applies all transitions and then runs the schedules in 3 waves:

  • exits - From leaf to root
  • transitions - Arbitrary (implemented as from root to leaf)
  • enters - From root to leaf

Pros

  • Manual state transition triggered through a StateRegistry::update rather than running a schedule.
  • Cleaner ordering, without a lot of after conditions.
  • Much simplified custom schedule execution.

Cons

  • Potential performance drop.
    While schedule execution is world-exclusive, updates could run in parallel.

Testing

  • A single test proves the order is correct.
  • Before finalization, this needs benchmarking.

Changelog

TODO

Migration Guide

TODO

@MiniaczQ
Copy link
Contributor Author

MiniaczQ commented Jun 9, 2024

Closed in favor of #13763

@MiniaczQ MiniaczQ closed this Jun 9, 2024
@MiniaczQ MiniaczQ deleted the state-registry branch September 7, 2024 19:13
@MiniaczQ MiniaczQ restored the state-registry branch September 7, 2024 19:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Ordered OnExit and OnEnter

1 participant