Skip to content
Python library to decode Heroes of the Storm replay protocols
Branch: master
Clone or download
Pull request Compare This branch is 112 commits behind Blizzard:master.
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
mpyq
.gitattributes
.gitignore
LICENSE
README.md
__init__.py
decoders.py
heroprotocol.py
protocol29406.py
protocol30414.py
protocol30509.py
protocol30829.py
protocol30948.py
protocol31090.py
protocol31360.py
protocol31566.py
protocol31726.py
protocol31948.py
protocol32120.py
protocol32253.py
protocol32455.py
protocol32524.py
protocol33182.py
protocol33353.py
protocol33684.py
protocol34053.py
protocol34190.py
protocol34659.py
protocol34846.py
protocol35360.py
protocol35529.py
protocol35634.py
protocol35702.py
protocol36144.py
protocol36280.py
protocol36359.py
protocol36536.py
protocol36693.py
protocol37069.py
protocol37117.py
protocol37274.py
protocol37351.py
protocol37569.py
protocol37795.py
protocol38236.py
protocol38500.py
protocol38593.py
protocol38793.py
protocol39015.py
protocol39153.py
protocol39271.py
protocol39445.py
protocol39595.py
protocol39709.py
protocol39951.py
protocol40087.py
protocol40322.py
protocol40336.py
protocol40431.py
protocol40697.py
protocol40798.py
protocol41150.py
protocol41393.py
protocol41504.py
protocol41609.py
protocol41707.py
protocol41764.py
protocol41810.py
protocol42178.py
protocol42273.py
protocol42406.py
protocol42506.py
protocol42590.py
protocol42742.py
protocol42958.py
protocol43051.py
protocol43170.py
protocol43259.py
protocol43481.py
protocol43527.py
protocol43571.py
protocol43905.py
protocol44124.py
protocol44256.py
protocol44468.py
protocol44737.py
protocol44797.py
protocol44941.py
protocol45024.py
protocol45228.py
protocol45635.py
protocol45815.py
protocol45889.py
protocol45949.py
protocol46158.py
protocol46416.py
protocol46446.py
protocol46690.py
protocol46787.py
protocol46869.py
protocol46889.py
protocol47024.py
protocol47133.py
protocol47219.py
protocol47479.py
protocol47801.py
protocol47903.py
protocol47944.py
protocol48027.py
protocol48297.py
protocol48548.py
protocol48583.py
protocol48760.py
protocol49008.py
protocol49076.py
protocol49278.py
protocol49495.py
protocol49582.py
protocol49747.py
protocol49838.py
protocol49907.py
protocol50286.py
protocol50424.py
protocol50441.py
protocol50673.py
protocol50950.py
protocol51150.py
protocol51375.py
protocol51609.py
protocol51779.py
protocol51923.py
protocol51978.py
protocol52008.py
protocol52124.py
protocol52214.py
protocol52351.py
protocol52381.py
protocol52561.py
protocol52647.py
protocol52860.py
protocol52986.py
protocol53174.py
protocol53270.py
protocol53275.py
protocol53548.py
protocol53965.py
protocol54098.py
protocol54339.py
protocol54968.py
protocol55010.py

README.md

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:

  • replay header
  • game details
  • replay init data
  • game events
  • message events
  • tracker 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:

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

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

Example Usage

py heroprotocol.py --details "Blackheart's Bay.StormReplay" > output.txt

-- arguments

-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:

  • Convert unit tag index, recycle pairs into unit tags (as seen in game events) with protocol.unit_tag(index, recycle)
  • Interpret the NNet.Replay.Tracker.SUnitPositionsEvent events like this:
    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)
  • Only units that have inflicted or taken damage are mentioned in unit position events, and they occur periodically with a limit of 256 units mentioned per event.
  • NNet.Replay.Tracker.SUnitInitEvent events appear for units under construction. When complete you'll see a NNet.Replay.Tracker.SUnitDoneEvent with the same unit tag.
  • NNet.Replay.Tracker.SUnitBornEvent events appear for units that are created fully constructed.
  • You may receive a NNet.Replay.Tracker.SUnitDiedEvent after either a UnitInit or UnitBorn event for the corresponding unit tag.
  • In NNet.Replay.Tracker.SPlayerStatsEvent, m_scoreValueFoodUsed and m_scoreValueFoodMade are in fixed point (divide by 4096 for integer values). All other values are in integers.
  • There's a known issue where revived units are not tracked, and placeholder units track death but not birth.

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.

You can’t perform that action at this time.