Skip to content
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

Is ecs_guide.rs broken? #534

Closed
sztomi opened this issue Sep 20, 2020 · 4 comments · Fixed by #536
Closed

Is ecs_guide.rs broken? #534

sztomi opened this issue Sep 20, 2020 · 4 comments · Fixed by #536
Labels
C-Bug An unexpected or incorrect behavior

Comments

@sztomi
Copy link

sztomi commented Sep 20, 2020

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 b05708f. 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?

@memoryruins
Copy link
Contributor

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.

@memoryruins memoryruins added the C-Bug An unexpected or incorrect behavior label Sep 20, 2020
@memoryruins
Copy link
Contributor

This was introduced in #496, which made some changes to the app exit logic to help simplify support for the wasm target.

#[cfg(not(target_arch = "wasm32"))]
{
loop {
if let Some(delay) = tick(&mut app, wait) {
thread::sleep(delay);
}
}
}

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.

@cart
Copy link
Member

cart commented Sep 20, 2020

Awesome, I can definitely confirm that AppExit is the issue

@cart cart closed this as completed in #536 Sep 20, 2020
@sztomi
Copy link
Author

sztomi commented Sep 21, 2020

Thank you so much for the quick fix!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-Bug An unexpected or incorrect behavior
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants