Improved system insertion syntax #1060
alice-i-cecile
started this conversation in
Ideas
Replies: 1 comment
-
I'm fond of the nested builders ("descriptors") approach. It should even be possible to ditch the app
.add_system(system_a)
.add_system(system_b.run_criteria(sometimes()))
.add_system_to_stage(STAGE, system_c.run_criteria(rarely())) stage
.with_system(system_a)
.with_system(system_b.label("sys_b"))
.with_system_set(
SystemSet::new()
.run_criteria(next_tuesday())
.with_system(system_c)
.with_system(system_d.label("sys_d").run_criteria(occasionally()))
.with_system(system_e.depends_on("sys_b").depends_on("sys_d")),
); There's also typestate pattern, but I feel like it'd be more trouble than it's worth on this scale. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
As Bevy gains functionality, the list of possible ways that we might want to tweak a system continues to grow.
Currently, I believe we have the following modifiers:
Things that might or might not be modifiers in the same sense:
In many cases, there are great defaults for this: they're simple systems that live in UPDATE and aren't thread-local. But we need to be able to access all possible permutations of these feature flags, and
add_thread_local_startup_system_to_stage
starts to get a little cumbersome (and makes things hard to refactor).As discussed in #ecs on Discord with @cart @smokku @sY9sE33, there's a need for better, more composable syntax than just having wrapper functions.
Desiderata
.add_system(my_system)
syntax should still just work.Open Questions
.add_startup_system
continue to exist once a more flexible syntax is introduced?.stage
syntax found in Improve usability of StateStage and cut down on "magic" #1059?Proposals
System Descriptors
Questions
Method Chaining
Questions
.finish()
) method on it at the end, as @cart suggested?.add_resource
? This leads to unclear code, but could probably be disambiguated automatically.Beta Was this translation helpful? Give feedback.
All reactions