-
-
Notifications
You must be signed in to change notification settings - Fork 4.4k
Open
Labels
A-ECSEntities, components, systems, and eventsEntities, components, systems, and eventsC-Code-QualityA section of code that is hard to understand or changeA section of code that is hard to understand or changeC-FeatureA new feature, making something new possibleA new feature, making something new possibleC-PerformanceA change motivated by improving speed, memory usage or compile timesA change motivated by improving speed, memory usage or compile timesC-Tracking-IssueAn issue that collects information about a broad development initiativeAn issue that collects information about a broad development initiativeC-UsabilityA targeted quality-of-life change that makes Bevy easier to useA targeted quality-of-life change that makes Bevy easier to useS-Needs-Design-DocThis issue or PR is particularly complex, and needs an approved design doc before it can be mergedThis issue or PR is particularly complex, and needs an approved design doc before it can be mergedX-Needs-SMEThis type of work requires an SME to approve it.This type of work requires an SME to approve it.
Description
Schedules are a great tool for executing a graph of systems. In their current form, however, schedules impose a specific execution model: systems grouped into system sets with order constraints and run conditions. We should extend the scheduling API to become reusable in more scenarios.
Motivation
These problem domains involve a system graph, but have a different execution model:
bevy_render'sRenderGraphandNodeAPIs are shaped very similarly to a system graph, but differ in their execution model: nodes have read-only access to the world and can be executed fully in parallel, but their commands must be applied in-order. Therefore, the scheduling API cannot (yet) be reused to implement them as a system graph.- Observers are a kind of system graph, but focusing on entities. Reusing the scheduling API would provide a more consistent API surface, and easily enable things like observer ordering (if warranted).
- My utility AI library links systems' output scores to other systems' inputs for score aggregation. Additionally, all systems have read-only access. I've copied quite a lot of the scheduling API's surface, and would love to not need to maintain it myself.
- @urben1680 has a crate for reversible schedules that could be vastly simplified if it didn't have to work around the scheduling API's imposed execution model.
- Users have occasionally shown interest in statically-dispatched schedules, and while this is easy to do with repeated calls to
run_system_cached, the UX could be improved by reusing some of the scheduling API.
There are a few more examples that verge on the theoretical, but as you can see this is an open problem space.
Goals
- Provide reusable building blocks for:
- creating and updating system graphs
- creating serial and parallel schedule executors
- Minimize boilerplate for the most common cases.
- Enable dynamic schedule modification
- Remove barriers for building schedule inspection tooling
Non-Goals
- Provide first party solutions for all third party use cases.
Roadmap (very rough)
- Clean up
bevy_ecs::schedule- Thoroughly document
UninitializedIdsemantics #20080 - Remove
SystemSetNode#20100 - Improve node encapsulation in
ScheduleGraph#20119 - Change flattened dependency graph from
DiGraph<NodeId>toDiGraph<SystemKey>#20172 - Clean up
NodeIdkind fetching #20196 - Better
ScheduleBuildErrorintrospection and handling #20256 - Move toposorting onto
DiGraphdirectly, and cleanup error handling #21608 - Move more functions off of
ScheduleGraph#21817 - Tidy up old
SystemConditiontrait hierarchy #21844 - Pull
Schedules::ignored_scheduling_ambiguitiesinto a separate resource and avoid unnecessary allocation #21929 - Replace
BTreeMapwithIndexMapfor storedScheduleBuildPasses #21930 - Accept boxed conditions for
run_if, and cleanupIntoScheduleConfigs#21977
- Thoroughly document
- Improve performance of Schedule-related functions, like building.
- Increase structure for schedule executors to reduce boilerplate and ensure consistency #18453
- Run individual
SystemSets inSchedules #21893 - Expose generic system container and graph primitives
- Provide user-implementable traits to allow custom execution models
- Provide primitives for constructing serial and parallel executors for custom execution models
- Switch
bevy_renderto a render-graph-as-systems approach - Support systems with
Inparameters in schedules #21658 / Run schedules where all systems take a certain Input type. #10335
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
A-ECSEntities, components, systems, and eventsEntities, components, systems, and eventsC-Code-QualityA section of code that is hard to understand or changeA section of code that is hard to understand or changeC-FeatureA new feature, making something new possibleA new feature, making something new possibleC-PerformanceA change motivated by improving speed, memory usage or compile timesA change motivated by improving speed, memory usage or compile timesC-Tracking-IssueAn issue that collects information about a broad development initiativeAn issue that collects information about a broad development initiativeC-UsabilityA targeted quality-of-life change that makes Bevy easier to useA targeted quality-of-life change that makes Bevy easier to useS-Needs-Design-DocThis issue or PR is particularly complex, and needs an approved design doc before it can be mergedThis issue or PR is particularly complex, and needs an approved design doc before it can be mergedX-Needs-SMEThis type of work requires an SME to approve it.This type of work requires an SME to approve it.