LaihoE / demoparser

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

How to get map, round and match details? #89

Open marcotama opened 11 months ago

marcotama commented 11 months ago

I am trying to recreate the GSI (Game State Integration; learn more: [Valve] [Reddit]) stream from a demo. The GSI data includes details about the map and other general info about the round and match. Is it currently possible to retrieve this information using the parser? If not, would you consider adding the capability?

    "provider": {
        "name": "Counter-Strike: Global Offensive",
        "appid": 730,
        "version": 13973,
        "steamid": "76561198013136282",
        "timestamp": 1701325232
    },
    "map": {
        "mode": "competitive",
        "name": "de_ancient",
        "phase": "warmup",
        "round": 0,
        "team_ct": {
            "score": 0,
            "name": "Entropiq",
            "consecutive_round_losses": 1,
            "timeouts_remaining": 4,
            "matches_won_this_series": 0
        },
        "team_t": {
            "score": 0,
            "name": "IKLA",
            "consecutive_round_losses": 1,
            "timeouts_remaining": 4,
            "matches_won_this_series": 0
        },
        "num_matches_to_win_series": 0
    },
    "phase_countdowns": {
        "phase": "warmup",
        "phase_ends_in": "-538.5"
    },
    "grenades": {
        "313": {
            "owner": "76561198176422667",
            "position": "-1692.14, 997.48, 72.26",
            "velocity": "-160.75, -137.72, 66.00",
            "lifetime": "1.4",
            "type": "flashbang"
        }
    },
LaihoE commented 11 months ago

I think this should be ~doable currently.

"Provider": parse_header() "map": parse_header() + parse_event()/parse_tick() (check long list of props in readme) "phase_countdowns": parse_event()/parse_tick() "grenades": parse_grenades() (lifetime and velocity not available but can be calculated, velocity if just the difference in position between this tick and last)

marcotama commented 11 months ago

I see, I am going through the fields one by one, thanks.

To give you context into why it would be useful to get the GSI data stream from a demofile: GSI is the only data available while a game is live, so any tool that works for live games, needs it. If the tool uses a Machine Learning model, GSI data is needed to train it. The game will give GSI data given a demo file, but it's slow and requires user interaction. And it's buggy, from what I can tell.

So it would be great if demoparser provided the necessary data for one to programmatically generate the GSI stream. Regardless, it's a great tool already! Thanks for the hard work!

marcotama commented 11 months ago

@LaihoE Is it normal that I don't get X,Y,Z coordinates for he_grenade and flashbang grenade types?

image