I'm in the process of learning about Bevy, so please bear with me if this issue is invalid. I'm running the ecs_guide example on b05708f66a4b4b1dbd92a42dfc62a11693dce628. After a few rounds with delayed steps, the game goes crazy and starts spitting out rounds in the thousands:
Begin round 3584 of 10
This game is fun!
Alice scored a point! Their score is: 1739
Bob did not score a point! Their score is: 1800
Player 3 did not score a point! Their score is: 1757
Player 4 did not score a point! Their score is: 1753
Player 3 won the game!
Begin round 3585 of 10
This game is fun!
Alice scored a point! Their score is: 1740
Bob did not score a point! Their score is: 1800
Player 3 did not score a point! Their score is: 1757
Player 4 did not score a point! Their score is: 1753
Player 3 won the game!
From reading the comments, I expected the AppExit event to be sent and the game to exit. Is what I'm seeing the correct behavior?
Thanks for reporting! The correct behavior should be if a player reaches a winning score or the maximum rounds are reached (where no one wins), the app should gracefully exit. I am able to reproduce the above issue and will try bisecting the commit that introduced this.
This was introduced in #496, which made some changes to the app exit logic to help simplify support for the wasm target.
https://github.com/bevyengine/bevy/blob/74dba5f36be1fc64bec8312e5d4fccfa08a02b8b/crates/bevy_app/src/schedule_runner.rs#L95-L102
tick() returns None when an AppExit event is received, but the run loop is never broken in that case. I'll open a patch now.
Awesome, I can definitely confirm that AppExit is the issue
Thank you so much for the quick fix!
Most helpful comment
This was introduced in #496, which made some changes to the app exit logic to help simplify support for the wasm target.
https://github.com/bevyengine/bevy/blob/74dba5f36be1fc64bec8312e5d4fccfa08a02b8b/crates/bevy_app/src/schedule_runner.rs#L95-L102
tick()returnsNonewhen anAppExitevent is received, but the run loop is never broken in that case. I'll open a patch now.