heroprotocol icon indicating copy to clipboard operation
heroprotocol copied to clipboard

Trying to extract data from a replay

Open themhz opened this issue 1 year ago • 2 comments

Hello there, I am trying to use this tools to export some data from my game replays, like hero damage per hero . For example I am looking for dataset like

Hero damage source | Hero damage destination | Damage Type | Level | Amount | TimeStamp Muradin | Nazebo | Auto Attack | 1 | 100 | 10:56:12:10 Muradin | Nazebo | Auto Attack | 1 | 100 | 10:56:12:50 Nazebo | Muradin | Spell Damage {Frog hit} | 2 | 200 | 10:56:13:10 Nazebo | Muradin | Spell Damage {Frog hit} | 2 | 200 | 10:56:14:10 ...

This for every hero to every hero per level in the match

I have exported the gamevetns.json but I cant figure how this file is structured. I mean its json but what does it actually mean? is there a documentation?

themhz avatar May 05 '24 19:05 themhz

What you want isn't possible. The event you're probably looking for is the NNet.Game.SCmdEvent event. This event is for when an ability is used. Though there isn't a way to map the m_abilLink to determine the actual ability. Things like damage numbers are not stored in the replay, only actions are.

{'_bits': 264,
 '_event': 'NNet.Game.SCmdEvent',
 '_eventid': 27,
 '_gameloop': 7898,
 '_userid': {'m_userId': 3},
 'm_abil': {'m_abilCmdData': None, 'm_abilCmdIndex': 0, 'm_abilLink': 26},
 'm_cmdFlags': 1048832,
 'm_data': {'TargetUnit': {'m_snapshotControlPlayerId': 12,
                           'm_snapshotPoint': {'x': 524308, 'y': 454650, 'z': 48640},
                           'm_snapshotUnitLink': 1310,
                           'm_snapshotUpkeepPlayerId': 12,
                           'm_tag': 780140580,
                           'm_targetUnitFlags': 111,
                           'm_timer': 0}},
 'm_otherUnit': None,
 'm_sequence': 986,
 'm_unitGroup': None,
 'm_vector': None}

See also #27 and #28.

koliva8245 avatar May 06 '24 01:05 koliva8245

The gameevents.json file you’ve exported from heroprotocol is indeed in JSON format, but it can be a bit complex. Here’s a quick breakdown to help you understand it:

Understanding gameevents.json

  1. General Structure: The file generally consists of a series of game events that happened during the replay. Each event might include details about actions, timings, and sometimes specific game mechanics.

  2. Event Types: Look for keys like "event", "timestamp", "source", "target", etc. These will tell you what kind of event happened, when it happened, and which heroes were involved.

  3. Damage Events: For damage data, you might find events related to "Damage" or "Combat" actions. The specifics can vary, but these are usually the sections where you’ll see details about who dealt the damage, who received it, and how much was done.

  4. Levels and Types: Details about hero levels and damage types might be nested within the events. You might need to look for additional keys or values inside each event to extract this data.

Steps to Extract Data

  1. Identify Relevant Events: Start by identifying which events are related to damage. You might need to sift through a lot of data to find the right ones.

  2. Parse the JSON: Use a JSON parser or a script to iterate through the data. Look for patterns in the event types and their structure to pull out the relevant info (like hero names, damage values, etc.).

  3. Transform the Data: Once you’ve identified the relevant events, you’ll need to transform this data into your desired format. This might involve aggregating information by timestamp, hero, or damage type.

Documentation

Blizzard doesn’t have official documentation for heroprotocol that’s widely available, but you can find a lot of community resources and tools online. Forums, GitHub repositories, and communities like the Heroes of the Storm subreddit might have some insights or tools to help with parsing this data.

Tools

You might want to look into existing tools or libraries that handle heroprotocol files. There are some open-source projects out there that can simplify this process for you.

If you need more help with parsing or if there’s a specific part of the JSON that’s confusing, feel free to share more details! I’d be happy to dive into it with you. 😊

MKokeshi avatar Aug 08 '24 10:08 MKokeshi