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

fix: do not run behavior simulation while paused #5054

Merged
merged 2 commits into from
Jun 26, 2022

Conversation

keturn
Copy link
Member

@keturn keturn commented Jun 22, 2022

Fixes some of the messages about entities not having finite position or rotation.

Contains

Skips all BehaviorSystem.update when the time delta is zero.

The issue was coming up specifically as a result of movement actions running during this update, since they were coming up with absurd results trying to calculate changes in position over zero time.

But I figured that skipping the entire system is probably a sensible thing to do. Unless you can think of anything Behavior-related that should still be ticking during the pause menu?

Or perhaps we should have a separate variant of UpdateSubscriberSystem that only updates when engine-time is advancing.

How to test

  • play single player (no network) with WildAnimals
  • find some deer (or some other animal with a functioning movement behavior)
  • hit Escape for pause menu
  • note whether log is being spammed with messages about entities with a non-finite position or location

Fixes some of the messages about entities not having finite position or rotation.
@github-actions github-actions bot added the Type: Bug Issues reporting and PRs fixing problems label Jun 22, 2022
@jdrueckert
Copy link
Member

jdrueckert commented Jun 26, 2022

Unless you can think of anything Behavior-related that should still be ticking during the pause menu?

Depends on whether time is halted when the player is in the main menu. In multiplayer scenarios it shouldn't be, so behaviors also shouldn't pause. In singleplayer I'm not entirely sure right now, whether or not we pause everything - I thought not, but I could be mistaken. If we indeed don't pause everything, then behaviors should also not be paused such that animals can continue walking around, minions can continue working and for instance the NPCs in cities can continue to go about their business, for instance to satisfy their individual needs.

Or perhaps we should have a separate variant of UpdateSubscriberSystem that only updates when engine-time is advancing.

That would better fit what I described above I guess 👍

@keturn
Copy link
Member Author

keturn commented Jun 26, 2022

The check I added here is for whether the time delta on update is zero. I think it should handle those cases appropriately, but I guess we should take a quick look at it in multiplayer to be sure.

@jdrueckert jdrueckert merged commit 45bde3d into develop Jun 26, 2022
@jdrueckert jdrueckert deleted the fix/pauseBehaviors branch June 26, 2022 20:54
@jdrueckert
Copy link
Member

For the record: tested out fine both in singleplayer (behavior halted) and multiplayer (behavior not halted, neither when host in pause, nor when client in pause nor when both in pause).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: Bug Issues reporting and PRs fixing problems
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants