Skip to content

Improve 0.9 -> 0.10 scheduling migration advice #604

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

Merged
merged 11 commits into from
Mar 11, 2023

Conversation

alice-i-cecile
Copy link
Member

Fixes most of #603.

@alice-i-cecile alice-i-cecile marked this pull request as ready for review March 11, 2023 17:01
@alice-i-cecile
Copy link
Member Author

I've omitted the other smaller fixes, as a) they're unrelated and b) I'm not immediately sure how to solve them. Please feel free to open more PRs to fix those.

@rparrett
Copy link
Contributor

rparrett commented Mar 11, 2023

Just in case we want to address the custom stages part, I think these are equivalent.

// Bevy 0.9
#[derive(Debug, Hash, PartialEq, Eq, Clone, StageLabel)]
pub struct AfterUpdate;

app.add_stage_after(CoreStage::Update, AfterUpdate, SystemStage::parallel());

// Bevy 0.10
#[derive(Debug, Hash, PartialEq, Eq, Clone, SystemSet)]
#[system_set(base)]
pub struct AfterUpdate;

app.configure_set(
    AppSet::AfterUpdate
        .after(CoreSet::UpdateFlush)
        .before(CoreSet::PostUpdate),
);

One thing I wish the migration guide addressed more explicitly are scenarios where the user was (ab)using various core bevy stages because they need a command flush between systems.

We are "mostly" just saying (via code snippets) that StartupStage::PostUpdate is now StartupSet::PostUpdate. But this situation is so common that I think it would help to spell out in code how to use apply_system_buffers in that situation.

edit: It feels like we are talking about apply_system_buffers enough and in the right way, but not actually showing users how to use it.

@Malax
Copy link

Malax commented Mar 11, 2023

Awesome to see better docs! Thanks for working on these! FWIW: My biggest hurdle migrating was the difference between in_set and in_base_set. Adding a system to a set via in_set would still add it to a base set. That caused

thread 'main' panicked at '`"Update"` and `"Render"` have a `before`-`after` relationship (which may be transitive) but share systems.'

errors that I wasn't able to understand without resorting to the amazing folks on Discord. (Thread: https://discord.com/channels/691052431525675048/1083571454404214885/1083571454404214885)

Would be cool to see this addressed in the migration notes, but I am not sure how. Given that I don't understand the new scheduling fully, I'm not really qualified to make suggestions :)

Co-authored-by: Rob Parrett <[email protected]>
@rparrett
Copy link
Contributor

Labels could be removed for brevity from the custom stages section since they are covered just below, if that's a concern.

@alice-i-cecile
Copy link
Member Author

@rparrett I've adapted and added your suggestion, thank you!

@Malax excellent edge case, but I'm unsure how to address it here. This is definitely one of the rougher edges in the whole design IMO.

@djeedai
Copy link
Contributor

djeedai commented Mar 11, 2023

Excellent, this is miles better than before, thanks a lot @alice-i-cecile!

Ouch on the subtle difference between OnEnter/OnExit and OnUpdate, that's a big footgun :(

Copy link
Contributor

@Weibye Weibye left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These are good changes and now is in a state where I would be able to migrate my apps. Everything I struggled with has been answered.

alice-i-cecile and others added 2 commits March 11, 2023 13:13
@alice-i-cecile alice-i-cecile added S-Ready-For-Final-Review Ready for a maintainer to consider for merging A-News C-Content labels Mar 11, 2023
@alice-i-cecile
Copy link
Member Author

Thanks a ton for the reviews, merging now :)

@alice-i-cecile alice-i-cecile added this pull request to the merge queue Mar 11, 2023
Merged via the queue into bevyengine:main with commit b036281 Mar 11, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-News C-Content S-Ready-For-Final-Review Ready for a maintainer to consider for merging
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants