Skip to content

Add coroutine to intertwine updates/gc cycles with scoring#25

Merged
MathIsFun0 merged 11 commits intoSpectralPack:mainfrom
cg-223:main
Nov 21, 2024
Merged

Add coroutine to intertwine updates/gc cycles with scoring#25
MathIsFun0 merged 11 commits intoSpectralPack:mainfrom
cg-223:main

Conversation

@cg-223
Copy link
Contributor

@cg-223 cg-223 commented Nov 17, 2024

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.

@MathIsFun0
Copy link
Collaborator

Will test this tomorrow

@cg-223
Copy link
Contributor Author

cg-223 commented Nov 18, 2024

I've had a thought, what if instead of just an ever-expanding mass of dots, we try to approximate how much time is left in scoring? Might try to get that in

@cg-223
Copy link
Contributor Author

cg-223 commented Nov 18, 2024

thinking more about that, it's pretty hard to get right
so, probably would be best to leave this PR as is without trying to mush any more stuff into it
approximating how long scoring will take is pretty difficult and if i ever do decide to implement such a timer itll be in a different PR

@cg-223
Copy link
Contributor Author

cg-223 commented Nov 20, 2024

fyi, information provided in the above is:
jokers that have yet to have any calculation function called (likely to remove this, it's kinda pointless)
elapsed calculations
calculations last hand

additionally, gc will only be called if the gc counts more than 1 gigabyte of memory
additionally 2, errors during scoring will now be caught and retossed instead of just letting them happen (which will cause play evaluation to cease with no clear error indicator. now this just proceeds to the crash screen normally for the user)

@MathIsFun0 MathIsFun0 merged commit 8057814 into SpectralPack:main Nov 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants