Unify FixedTime and Time (proof-of-concept)#8930
Closed
nakedible wants to merge 16 commits intobevyengine:mainfrom
Closed
Unify FixedTime and Time (proof-of-concept)#8930nakedible wants to merge 16 commits intobevyengine:mainfrom
nakedible wants to merge 16 commits intobevyengine:mainfrom
Conversation
Contributor
|
Example |
Contributor
|
Example |
Contributor
|
Example |
3 similar comments
Contributor
|
Example |
Contributor
|
Example |
Contributor
|
Example |
Contributor
|
Example |
Contributor
Author
|
Closing in favor of #8964 |
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.
PULL REQUEST ONLY FOR DISCUSSION, NOT MERGE READY BY FAR.
Objective
Current
FixedTimeandTimehave several problems. This pull aims to fix many of them at once.FixedUpdatefor a large number of steps. If the pause is merely seconds, then this will just mean jerkiness and possible unexpected behaviour in gameplay. If the pause is hours/days as with OS suspend, the game will appear to freeze until it has caught up with real time.FixedUpdatethat calculates elapsed or step count in a resource.FixedStep::periodrather thanTime::delta. This, coupled with the issue thatTime::elapsedisn't available at all for fixed steps, makes it that time requiring systems are either implemented to be run inFixedUpdateorUpdate, but rarely work in both.Solution
Timereport "fixed step clock" time while insideFixedUpdate....
maximum_deltatoTimethat limits how much the virtual game clock can be advanced with a single update. Does not affect raw clock.FixedTime::periodto beTime::fixed_periodand removeFixedTimestructure entirely.Time::delta,Time::elapsedand friends report time according to fixed steps insideFixedUpdate.Clockdata structure to make it more obvious what the independent tracked values are and to reduce code duplication.Changelog
Migration Guide