Blizzard/heroprotocol

Name: heroprotocol

Owner: Blizzard Entertainment

Description: Python library to decode Heroes of the Storm replay protocols

Created: 2015-12-15 00:01:48.0

Updated: 2018-01-14 01:09:02.0

Pushed: 2018-01-16 18:20:23.0

Homepage: null

Size: 264

Language: Python

GitHub Committers

UserMost Recent Commit# Commits

Other Committers

UserEmailMost Recent Commit# Commits

README

Hero Protocol

heroprotocol is a reference Python library and standalone tool to decode Heroes of the Storm replay files into Python data structures.

Currently heroprotocol can decode these structures and events:

heroprotocol can be used as a base-build-specific library to decode binary blobs, or it can be run as a standalone tool to pretty print information from supported replay files.

Note that heroprotocol does not expose game balance information or provide any kind of high level analysis of replays; it's meant to be just the first tool in the chain for your data mining application.

Supported Versions

heroprotocol supports all Hereos of the Storm replay files that were written with retail versions of the game. The current plan is to support all future publicly released versions, including public betas.

How to Use

A working installation of Python 2.x is required. From the folder where heroprotocol is located, type the following into the command line, assuming that the replay file was also copied into the same folder:

eroprotocol.py --<option> "<replayFileName>" > output.txt

If you want the output shown directly in the terminal, leave out the > output.txt.

Example Usage
eroprotocol.py --details "Blackheart's Bay.StormReplay" > output.txt

-h, --help Show the options that are available.

--gameevents print all game events including coordinates

--messageevents print message events such as ping events

--trackerevents print tracker events such as units killed, game stat events, score result event

--attributeevents print attribute events, a table of attrid, namespace, and attribute values

--header print protocol header including HotS build and elapsedGameLoops

--details print protocol details, e.g. teamId, player names and chosen heroes, player region, game result, observer status

--initdata print protocol initdata, e.g. interface settings for every player

--stats print game stats

Tracker Events

Some notes on tracker events:

unitIndex = event['m_firstUnitIndex']
for i in xrange(0, len(event['m_items']), 3):
    unitIndex += event['m_items'][i + 0]
    x = event['m_items'][i + 1] * 4
    y = event['m_items'][i + 2] * 4
    # unit identified by unitIndex at the current event['_gameloop'] time is at approximate position (x, y)

License

Copyright (c) 2015 Blizzard Entertainment

Open sourced under the MIT license. See the included LICENSE file for more information.

Acknowledgements

The standalone tool uses mpyq to read mopaq files.

Thanks to David Joerg and Graylin Kim of GGTracker for design feedback and beta-testing of the s2protocol library that heroprotocol is based upon.

Thanks to Ben Barrett of HOTSLogs for feedback on and beta-testing of the heroprotocol library.


This work is supported by the National Institutes of Health's National Center for Advancing Translational Sciences, Grant Number U24TR002306. This work is solely the responsibility of the creators and does not necessarily represent the official views of the National Institutes of Health.