-
Hey, Was curious how anyone handled when a demo restarts the first round multiple times, and then at the very end of the demo, the round is again reset to round 1. I currently have it so when round 1 restarts (or sometimes goes to more rounds then resets back to 1), I wipe out everything so I don't have bad data or the wrong round 1. But, this causes a problem when it restarts at the very end. I haven't been able to find a variable or anything that tells me that the match is actually over and it isn't just restarting to actually start the match. This Mythic match is an example of this happening - https://www.hltv.org/matches/2359572/mythic-vs-x13-esl-challenger-league-season-42-north-america-relegation Just curious if anyone has a reliable way to know if the match is over or if the match is restarting for the first time. Thanks, |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
One solution would be to keep track of all rounds. Each time you see the round number resets to 1, assume that a new 'game' is starting. The key part is to never drop any data - capture it all while the demo is running, and decide which rounds were part of the actual match when the demo finishes. By the end of the demo you will have something like this: const games = [
{
rounds: [
// round 1
]
},
{
rounds: [
// round 1
// round 2
// ...
// round 10
]
},
{
rounds: [
// round 1
]
},
];
demoFile.on('end', e => {
let longestGame = games[0];
for (let game of games) {
if (game.rounds.length > longestGame.rounds.length) {
longestGame = game;
}
}
let rounds = longestGame.rounds;
// do your analysis on `rounds` here...
}) Let me know if you have any more questions. |
Beta Was this translation helpful? Give feedback.
One solution would be to keep track of all rounds. Each time you see the round number resets to 1, assume that a new 'game' is starting. The key part is to never drop any data - capture it all while the demo is running, and decide which rounds were part of the actual match when the demo finishes.
By the end of the demo you will have something like this: