Skip to content

Extensible Schedule Graphs #20115

Open
Open
@ItsDoot

Description

@ItsDoot

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's RenderGraph and Node APIs 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)

Metadata

Metadata

Assignees

Labels

A-ECSEntities, components, systems, and eventsC-Code-QualityA section of code that is hard to understand or changeC-FeatureA new feature, making something new possibleC-PerformanceA change motivated by improving speed, memory usage or compile timesC-Tracking-IssueAn issue that collects information about a broad development initiativeC-UsabilityA targeted quality-of-life change that makes Bevy easier to use

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions