-
-
Notifications
You must be signed in to change notification settings - Fork 3.6k
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
System Lifecycle Rework: all Systems are initialized by definition #2777
Conversation
This touches a lot of stuff and most of it is just noise. The most relevant changes are in function_system.rs, the System trait, system descriptors, and the executor. |
I'd prefer not to do this. The standalone They also tend to care about compile sizes and dependencies in ways that other Bevy users don't. |
@@ -104,6 +97,27 @@ impl FixedTimestep { | |||
} | |||
} | |||
|
|||
impl IntoSystem<(), ShouldRun, ()> for FixedTimestep { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I love the reduced boilerplate needed here.
@@ -90,3 +88,47 @@ pub(crate) fn check_system_change_tick( | |||
*last_change_tick = change_tick.wrapping_sub(MAX_DELTA); | |||
} | |||
} | |||
|
|||
// TODO: This impl could result in multi-boxed systems, but it also enables things like the new FixedTimestep impl | |||
// maybe fine generally? who boxes their systems on insert? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, that seems like a weirdly pathological thing for users to do.
let mut shaders = world.get_resource_mut::<Assets<Shader>>().unwrap(); | ||
let mut active_cameras = world.get_resource_mut::<ActiveCameras>().unwrap(); | ||
let msaa = world.get_resource::<Msaa>().unwrap(); | ||
world.resource_scope(|world, mut graph: Mut<RenderGraph>| { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Deeply nested resource_scope's seems a bit suspicious. Is this driven by the other changes in this PR?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This was the "quick and dirty" solution I called out in the description. The better fix would be to adapt the Render Graph to account for the System lifecycle, but thats more work than I wanted to invest in a proof of concept.
# Objective - Fix the ugliness of the `config` api. - Supercedes bevyengine#2440, bevyengine#2463, bevyengine#2491 ## Solution - Since bevyengine#2398, capturing closure systems have worked. - Use those instead where we needed config before - Remove the rest of the config api. - Related: bevyengine#2777
Worth considering but this is way out of date and would need significant reworks at this point. |
Note: This is just very rough experimentation. I (currently) have no intention to move this forward as-is ... I just created it because people are discussing reworking system descriptors and scheduling right now and this change is something that relates / that I've been wanting to explore for awhile.
This does the following:
The things this accomplishes:
This comes at the cost of: