LaihoE / demoparser

Counter-Strike 2 replay parser for Python and JavaScript
MIT License
247 stars 29 forks source link

Some Tournament Demos Skipping First Round in parseEvent #59

Open dbalders opened 8 months ago

dbalders commented 8 months ago

Error: For demos from some tournament organizers, it seems that when parsing events like round_start/round_end/etc, it isn't capturing the first round of the match. It is starting on round 2. TotalRoundsPlayed is already at 1 for the first object in the array.

Version: 0.12.0

Code: let roundStartTimes = parseEvent(demoFileName, "round_start", startEvents)

Example 1 (Broken) (Thunderpick): https://www.hltv.org/matches/2367520/furia-vs-apeks-roobet-cup-2023

Screenshot 2023-11-01 at 1 14 51 PM

Example 2 (Broken) (Roobet Cup): https://www.hltv.org/matches/2367600/complexity-vs-mouz-thunderpick-world-championship-2023

Screenshot 2023-11-01 at 1 15 23 PM

Example 3 (Working) (ESL Challenger League): https://www.hltv.org/matches/2367288/bad-news-bears-vs-nouns-esl-challenger-league-season-46-north-america

Screenshot 2023-11-01 at 1 15 55 PM

Example 4 (Working) (ESL Challenger League): https://www.hltv.org/matches/2367484/spirit-vs-saw-esl-challenger-league-season-46-europe

Screenshot 2023-11-01 at 1 27 02 PM

Example 5 (Working) (CCT): https://www.hltv.org/matches/2367826/forze-vs-preasy-cct-central-europe-series-8

Screenshot 2023-11-01 at 1 38 58 PM

Example 6 (Broken) (ESL Impact): https://www.hltv.org/matches/2367268/9-pandas-fearless-vs-gl-prism-esl-impact-league-season-4-europe

Screenshot 2023-11-01 at 1 44 25 PM
LaihoE commented 8 months ago

Yes I think this was also a bug in csgo demos, seems like they didn't fix it for cs2.

Unfortunately I'm quite confident this is not a bug in the parser, but a bug in the demo and so there is no easy fix. It's quite interesting that it works for some demos :thinking:

dbalders commented 8 months ago

Ah, bummer. I'll comment back if I can find a workaround. For csgo, I was using demofile and ya had to use entity changing cause I think I remember that too with it not triggering the actual event:

demoFile.entities.on('change', e => {
     if (e.changes[0].tableName === 'DT_CSGameRules' &&
         e.changes[0].varName === 'm_bFreezePeriod') {
LaihoE commented 8 months ago

Yeah seems like implementing something similar will be needed. I'm just wondering didn't that absolutely ruin performance?

LaihoE commented 8 months ago

of course there is a tiny chance that they fix the events for cs2. Not too hopeful tho...

dbalders commented 8 months ago

I'm not sure about performance, I'm sorry. Didn't have anything to compare it to since I had to do it at the very beginning to be able to get consistent data.

dbalders commented 8 months ago

I submitted a bug report to them, so we will see.

UROjQ6r80p commented 8 months ago

@LaihoE @dbalders I checked those matches mentioned above in demoinfocs-golang.

the first round event is emitted in both matches (by workaround I guess), found this line, might be helpful: https://github.com/markus-wa/demoinfocs-golang/blob/master/pkg/demoinfocs/datatables.go#L1205

Also in https://github.com/saul/demofile first round_start event is not emitted https://github.com/saul/demofile/issues/377 same issue.

LaihoE commented 8 months ago

I went and looked at the demos and the ones that are breaking are those that start when the first round has already started. Is this normal for pro demos? Was this also the reason for the csgo demos missing the first round?

UROjQ6r80p commented 8 months ago

I have not seen enough of those demos, but I assume it's rather normal on HLTV to start demo few seconds after first round when players are just leaving their spawn, also not sure whether that was the reason of missing first rounds in csgo demos.

dbalders commented 8 months ago

I don't know 100% since I've never built the actual demo parser. But, historically the demos do not start mid already in first round. Usually its mid warm up round which gets reset (sometimes multiple times) before the match actually starts. With the code I sent earlier I can capture the first round of every csgo demo (and did for the last year+), so it is resetting to start the round, just not in the same way it starts all the other rounds for some reason.

dbalders commented 7 months ago

Their last 2 cs patches did both mention changes to the demo system. So, maybe work is still being done. Also, just wanted to say I appreciate your work on this package @LaihoE. Thank you for making it.