Open
Conversation
ad03c02 to
d65d478
Compare
Co-authored-by: Anthony Welte <tony.welte@gmail.com>
1c82c5e to
50bbd3f
Compare
Contributor
Author
|
Wait... I found an edge case when the timestep is changed while a world is running. (I think I meant to investigate this when I opened this and forgot :P ) Gimme a min, this shouldn't be a hard fix. |
…g in realtime mode
Contributor
Author
|
Fixed. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
This PR updates the timestep algorithm to calculate the mean of "ideal" delay times to determine how long to wait between timesteps rather than calculating the mean of elapsed times and calculating a delay based on that. This should remove the dependence of each data point on the current sleep time, reducing oscillations in the simulation speed. (See linked issue for more details.)This PR removes the algorithm that approximates the real-runtime of each timestep in order to calculate the real delay between timesteps in realtime mode. The old algorithm was prone to oscillations that caused the actual simulation speed to fluctuate by ~+-5%. (See discussion in linked issue.) This PR switches to just using QTimer at a fixed rate, which calls on OS APIs to more-reliably trigger the timesteps.
I've finally gotten around to actually doing some (not terrible) testing on this, and just watching the simulation speed indicates that realtime mode is much more stable under this change, varying by 1% or less most of the time. Additionally, I haven't noticed any significant change in the running speed of fast mode either with or without rendering enabled. Thus, I'm going to say that this is good to merge.
Special thanks to @TonyWelte for helping to identify/test and suggest fixes for this.
Related Issues
This pull-request fixes issue #6897.
Tasks
Add the list of tasks of this PR.