p2sr / SourceAutoRecord

Speedrun plugin for Source engine games.
https://sar.portal2.sr/
MIT License
93 stars 29 forks source link

Upgrade to sar_speedrun_time_pauses & Demo Pause Information #281

Open betsruner opened 1 day ago

betsruner commented 1 day ago

sar_speedrun_time_pauses Improvement

A pause either is or isn't pause abuse, and that needs to be more accurately reflected in the command/timer. By improving how sar_speedrun_time_pauses functions we can both make it more accurate, while also improving the lives of verifiers all around Illinois.

As far as I can tell there are two ways to improve sar_speedrun_time_pauses to make it more accurate.

  1. Make changes to sar_speedrun_time_pauses not take effect until after the current pause has been concluded.
  2. A slightly worse alternative to this would be to have the timer account for the change if the cvar is changed in a pause.

Examples for 2 in case it was hard to follow: If you entered the pause with sar_speedrun_time_pauses 0 then change it to 1 in the pause the result would be that it would add the amount of time that was at the start of the pause into the speedrun timer. Or if you enter a pause withsar_speedrun_time_pauses 1 then change it to 0 in the pause it would subtract the amount of time you took in the pause to do that from the speedrun timer.

Demo Pause Information

If either of the above improvements were to be made then pauses would either be counted or not 100% of the time. This would allow for the pause information stored in demos to include whether a pause was counted in the speedrun timer. Having the information inline with the pause would allow for more convenient verification as we wouldn't need to leave sar_speedrun_time_pauses unwhitelisted and keeping track of the value that it was last changed to by the runner to figure out if the pause was counted or not. It would also stop an annoying problem where for some reason people have three sar_speedrun_time_pauses on their sar_on_load.

ThisAMJ commented 1 day ago

the three time pauses is probably because of srconfigs update and they didn't delete the cats outside srconfigs folder so there's both cfg/cats/fullgame.cfg and cfg/srconfigs/cats/fullgame.cfg. srconfigs executes both for backcompat... but that should be 4 not 3... idk

betsruner commented 19 hours ago

2 and 4 are pretty common as well. I just used 3 cause that was the one I was currently viewing.

ThisAMJ commented 17 hours ago

Should be easy enough to separate the cvar from the timing using another variable, and change it whenever the load timer stops (and also starts to catch pesky edge cases)

ThisAMJ commented 17 hours ago

Recording whether a pause was timed is pretty simple too, just add one byte to the message (will be a breaking change for p2sr/mdp though, I can handle that)

betsruner commented 17 hours ago

Since it's a breaking change for mdp, should you instead version upgrade to v2 the pause information in the demo so when parsing old demos it can know ahead of time whether it should be looking for an extra byte at the end based on whether it's a v1 or v2 pause information?

ThisAMJ commented 17 hours ago

Custom demo data stores the length, so you can detect it from mdp's side without any fuss. It would only break forward compatibility i.e. new demo on old mdp, like most demo changes lol

betsruner commented 16 hours ago

That be making some good sense. Ty for the explanation