-
-
Notifications
You must be signed in to change notification settings - Fork 4.3k
Unify FixedTime and Time (proof-of-concept) #8930
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
Unify FixedTime and Time (proof-of-concept) #8930
Conversation
|
Example |
|
Example |
|
Example |
3 similar comments
|
Example |
|
Example |
|
Example |
|
Example |
|
Closing in favor of #8964 |
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