Repository navigation
frame advancing in-game #238
Copy link
Copy link
Open
Description
When to pause
- I need it to pause on both
updateandfixed updateas the user wishes - I should pause before the events happen
How to pause
- I already have code to pause
MonoBehaviourso I can use this to pause and unpause the game - On PreUpdate, before any UniTAS operation is done, check if game needs to be paused or not
How to unpause
- I need to sync update offset with when it was paused
- For example, if paused before FixedUpdate, this means FixedUpdate has yet to run and (assuming update happens with perfect timing), the offset would be 0
- By reusing code that I use to restart the game, I should be able to sync the update timing to the right offset and continue running the game
While paused
- Keep fps at config's fallback fps value as unpausing will handle the update offset problem
Pause state tracking
- I could have an enum of the timing of when the pause happened
- So either
UpdateorFixedUpdatein my case
- So either
Pausable coroutines
- I need to track all running coroutines
- What I could do is modify IEnumerator firstly to not run
MoveNextwhen paused (which doesn't updateCurrentso I have control over that) - Coroutines have a
Currentto express what is the next wait period, so while paused, I can force return this property to whatever is the next coroutine yield (like for update pause, yield null) for all coroutines- So when pause happens, I need to store all
Currentfor the coroutines for restoration later on
- So when pause happens, I need to store all
MoveNextcan be invoked by unity specified by the event execution order- As for
WaitForSecondsandWaitForSecondsRealTime, because these callbacks only happen after some time, i can't "pause" them so I have to modify their behaviour to be the exact same BUT waiting for n frames instead with a custom tracker for this - For
WaitUntilandWaitWhile, I need to figure out timing on when they get yielded, but they should work fine with the normal hijacking as they just check for a condition and while paused, nothing should change
Tasks
- make coroutines pausable and resumable #258
- what's the timing on
WaitUntilyield - what's the timing on
WaitWhileyieldyield null->yield WaitUntil->yield WaitWhile
- what's the timing on
- pause and resume with proper update offset
- implement
- test
- UpdateActual test class
- test unity project
- make unity animation pausable #257
- some parts of
TimeEnvisn't paused, frame count and offset related trackers
I modified ISyncFixedUpdateCycle.OnSync to also allow for waiting at any index of FixedUpdate too
- Test ingame with logs
- Test with tests debug prints with UniTAS and watch out offset
- Test with external tool, and make sure it passes
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels
Activity
Eddio0141 commentedon Oct 28, 2023
not complete yet, check list