Rainyan / sourcemod-nt-competitive

SourceMod plugin for competitive Neotokyo.
1 stars 3 forks source link

Fix STV recording not stopping after match end #44

Closed Rainyan closed 10 months ago

Rainyan commented 10 months ago

Fix #42

Rainyan commented 10 months ago

@bauxiteDYS I can't reproduce this bug. Here's what I've tried, using v0.6.0 (the tag just before this change):

sv_cheats 1; bot_add; bot_add; sv_cheats 0 // need player in both teams
sm_forcelive // force start match
// (wait for the match start countdown...)
sm_forcelive;sm_forcelive // force end match

But I'm seeing the SourceTV replays in NeotokyoSource/replays_competitive being started and stopped correctly.

bauxiteDYS commented 10 months ago

Yeah, now when you end the match, note the size of the demo, then do some actions for a few minutes and refresh the folder, the demo file size should increase, it will keep slowly increasing until the map changes. If that doesn't work then I'll have to check again.

Rainyan commented 10 months ago

Doesn't seem to be the case for me. Here's the printout from the local SRCDS:

] sm_forcelive
Recording SourceTV demo to replays_competitive/20231121-0405_nt_dawn_Ctg_1700532300.dem...
] sm_forcelive
[COMP] Stopping a competitive match, are you sure?
Please repeat the command to confirm.
] sm_forcelive
Completed SourceTV demo "replays_competitive/20231121-0405_nt_dawn_Ctg_1700532300.dem", recording time 10.7

Inspecting the OS file handles, no app is accessing the demo file after this.

Are you sure this is not in fact a duplicate of ec652a6cf3631bc606ea4cd0cd14bf93c9a1cc18? Glancing at the code change here, it doesn't seem obvious why moving the ToggleSourceTV call up in the function body would affect this behaviour.

Same deal if I create a match between 2 bots with sm_competitive_round_limit 1, forcelive and then slay one of the bots to force a match conclusion manually.

Rainyan commented 10 months ago

Ok, there's something weird going on here. After ending the match with a slay, sm_forcelive still considers the match as active:

] sm_slay #6
L 11/21/2023 - 04:21:23: [playercommands.smx] "Console<0><Console><Console>" slayed "<6><BOT><>"
L 11/21/2023 - 04:21:23: "<6><BOT><Jinrai>" committed suicide with "player"
Death HitLocation 2
[SM] Slayed .
Completed SourceTV demo "replays_competitive/20231121-0421_nt_dawn_ctg_0.dem", recording time 34.7
] sm_forcelive
[COMP] Stopping a competitive match, are you sure?
Please repeat the command to confirm.

Not sure if this is related to this bug.

Rainyan commented 10 months ago

While this change does toggle the recording, it also breaks the replay filename, since it relies on the timestamp creation code that happens before the call to ToggleSourceTV, so you end up with demos where the epoch timestamp following the map name is zero:

Recording SourceTV demo to replays_competitive/20231121-0524_nt_dawn_ctg_0.dem...

edit: removed incorrect stuff

bauxiteDYS commented 10 months ago

Hmm interesting, although I'm almost 99% sure that versions including and before 0.6.0 the stv doesn't stop recording, perhaps it's only on NSF win? I'll have to test that, but I don't believe so.

Rainyan commented 10 months ago

It seems c9fbd6d fixed the underlying bug here.

bauxiteDYS commented 10 months ago

Yeah that makes sense

Rainyan commented 10 months ago

Ok, I think it all works now. Thanks again for the PR!