Add coroutine to intertwine updates/gc cycles with scoring #25
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.
This eliminates the memory overhead of scoring, and eliminates the issue of the game freezing while scoring is in progress.
An overlay with a simple "Calculating..." text appears while scoring, and the user has no control while this is happening.
The overlay only appears during the actual calculations involved in scoring.
The scoring animations the user sees are outside of the calculations, and as such the obstruction of the overlay disappears afterwards.
Updates run 10 times a second (along with GC cycles). If scoring takes less than a tenth of a second, the effects of the coroutine are nonexistent.
It's to be noted that scoring will always take up at least 0.1 seconds. The GC cycle time isn't included.
It seems that updates take a shit ton of time if scoring animations are enabled, likely due to the event manager iterating through all of the events in queue. This is negligible, since if you're performing that many retriggers with scoring animations on, the time it'll take to fully run through all the animations would be months anyways.
/
original PR to Steamodded: Steamodded/smods#295
Moved the code to here, tested it in the different cj hook and seems good.