blizzard / heroprotocol Goto Github PK
View Code? Open in Web Editor NEWPython library to decode Heroes of the Storm replays
License: MIT License
Python library to decode Heroes of the Storm replays
License: MIT License
the following command creates a blank file
py heroprotocol.py --stats "Blackheart's Bay.StormReplay" > output.txt
The package is missing a setup.py along with the following:
1 and 2 should be doable in a single PR but 3 should probably be done in another repo and by someone at Blizzard.
I'm trying to parse the 'Round of 8' replays from 'Heroes of the Dorm 2016', which are publicly available: https://compete.tespa.org/tournament/19/phase/1
So far in this tournament I've been able to parse most of them fine. However, in 'Round of 8', I've only been able to successfully line up the 'ScoreResultEvent' player indexes with the 'ClientList' 2/10 times.
I'm not sure why this happens, but it seems to be related to many observers.
For example, in the one replay I'm looking at, I see Observers in ClientList slots 0,1,2,3,4, and players in ClientList slots 5,6,7,8,9,10,11,12,13,14. However, in the 'ScoreResultEvent', stats are being recorded for ClientList slots 6-15. There isn't a player in ClientList slot 15.
The first 'PlayerSetup' tracker events also show each player with a client list index from 5-14. It seems to only be the 'ScoreResultEvent' that is showing the 6-15.
python /Users/jbailey/workspace/heroprotocol/heroprotocol.py --json --trackerevents Sky\ Temple\ (82).StormReplay
I get the following error when running the json through a parser. Note, this is outside of python, but json is json.
Parse Error: "m_slotId": 0}{ "m_playerId":
Can you please upload this file? thanks
I am running the heroprotocol from php application but the output data are not json compatible format
can you give me some hint how to use output data to get json format?
It looks like Thrall's 'SelfHealing' values are duplicated into his 'Healing' field as well. In the few replays I've looked at, these values match eachother in each game
Chen also has some 'Healing', as well as 'SelfHealing'. In a couple games I looked at, his 'SelfHealing' was around 15000, and 'Healing' was around 1000. Perhaps one of his talents' 'SelfHealing' or shielding is applying to 'Healing'
Looks like 'Li-Ming' can also have 'Healing' - a very small 94 in one game
There may be others, this is all I've found for now. If this is unintended, could you fix where these values are applied in a future build?
In the 'replay.attribute.events' file, it seems any Hero beyond level 20 is just recorded as '1' or '2'
Adjusted hero levels post-patch HotS 2.0 do show the updated numbers properly - there is just some kind of issue with heroes beyond level 20
The values are odd, I tried dividing by 4096 but the values seems too slow to be correct.
{
"_eventid": 10,
"m_stringData": [
{
"m_key": "Punisher Type",
"m_value": "ArcaneShrine"
}
],
"m_intData": [
{
"m_key": "Event",
"m_value": 1
},
{
"m_key": "Owning Team of Punisher",
"m_value": 2
},
{
"m_key": "Duration",
"m_value": 25
}
],
"_event": "NNet.Replay.Tracker.SStatGameEvent",
"_bits": 1648,
"_gameloop": 4862,
"m_eventName": "Punisher Killed",
"m_fixedData": [
{
"m_key": "Siege Damage Done",
"m_value": 6417493
},
{
"m_key": "Hero Damage Done",
"m_value": 541696
}
]
}
Hello,
I am trying to find documentation or some sort of explanation for the items in the output.
For example, I was not sure whether in --details, under m_playerList, m_result "1" means defeat and "2" means victory or the other way around. Many things are self-explanatory but some of the dictionaries (many of the things starting with "m_") are not...
As may be clear, I don't have an understanding of JSON formats and I just basically dumped it into a Pandas dataframe with pd.read_json, so forgive me if I am missing something blatantly obvious :)
Thanks in advance!
It seems to parse fine with 37569 and does NOT parse with 38236.
So, I would guess that's it's just another copy of 37569.
Hi, using heroprotocol.py --detail I managed to parse my playlogs, but can't seem to parse timestamp correctly. For example the one i have is data['m_timeUTC'] = '131485808427443680'. On the replay section in the game it seems its '2017-04-17'. I'd appreciate if someone could tell me how to parse this in python. Thanks!
Missing PTR protocol 59837! Seems to be different from the two surrounding it
Hi,
I was checking some replays and noted the total amount of experience earned by a team at the end of the game, as reported by SScoreResultEvent in the MetaExperience field is different than the sum of HeroXP + TrickleXP + StructureXP + CreepXP + MinionXP reported in SStatGameEvent in the field EndOfGameXPBreakdown.
Also, if you sum the ExperienceContribution (reported in SScoreResultEvent) for each hero of each team you will get a third value for what is supposed to be the total amount of experience earned by a team.
Summarizing, if you sum the XP contribution by hero you will get a different value if you sum the XP contribution by XP Type which is also different as the MetaExperience.
Do you know how should we interpret the values so they match?
I'm keen to see where this goes or what it's used for - are you willing to share any example implementation code or projects that use this?
Thanks for open sourcing this!
Attempted the following in a Windows 10 cmd prompt using Python 2.7 with the latest master branch of HeroProtocol and a StormReplay from today:
python.exe D:\HeroProtocol\heroprotocol-master\heroprotocol.py --stats "D:\HeroProtocol\output\Test_20180118\Towers of Doom 20180118.StormReplay" > "D:\HeroProtocol\output\Test_20180118\Towers of Doom 20180118 stats.txt"
This returns an empty txt document, as does the "--json" argument. Removing the write-to-file argument does not solve the issue; instead, the terminal does not print anything. Other arguments, however, appear to work as intended, i.e. "--gameevents" returns a 50 MB file with game events.
Please let me know if the Stats and Json arguments are broken functionality, or if I am not using them correctly. Thanks!
Exactly what this says. A new map was released but with missing data (understandable) but also completely wrong data in the replay files? According to many previous values (value/4096), this time on payload would convert to 1048020 seconds. Nice sticking to it, team, you stuck with the payload for 1 million seconds! This means I need to hard code an exception for this stat into the replay analyzer I've made.
It looks like the 'Time Dead' is including full deaths for Diablo even if he has his quick soul resurrection?
I've also had people report that it counts the full 'Time Dead' duration of a death if they die just before the game ends, even if they're only dead for a few seconds until the Core is killed
Hello,
in this event, how to interpret that integer?
{
"_eventid": 10,
"m_stringData": null,
"m_intData": [
{
"m_key": "PlayerID",
"m_value": 1
}
],
"_event": "NNet.Replay.Tracker.SStatGameEvent",
"_bits": 664,
"_gameloop": 41597,
"m_eventName": "EndOfGameTimeSpentDead",
"m_fixedData": [
{
"m_key": "Time",
"m_value": 1609728
}
]
}
Hi there!
I apologize if this question is elementary. I have a small pet project I am working on and I'm wondering if someone can point me in the right direction.
I want to figure out which players died during a game. I see the NNet.Replay.Tracker.SUnitDiedEvent events, and I can locate the player who killed the unit using their slotID. However, I can't figure out how to figure out which SUnitDiedEvent events are player deaths and how to map them back to the player that was killed.
Can anyone shed some light on this?
I'd love to implement this natively, as I only require a bit of information from the replay files. I'm guessing the specification exists somewhere at Blizzard ๐
As a developer working in python I should be able to import an object which I can initialize with the path to a .StormReplay file. After which I have access to all of the decode_replay_*
method directly on the object.
The following protocols are missing:
Could this be added? :)
Hi, I don't understand this value as is quite high.
Do we need to divide it?
I have a project that I am working on that will be automatically downloading from this project and performing some conversion to the source files. I know there are other projects out there such as heroprotocoljs that are also doing something similar.
Is there a way these automated protocol uploads could be GPG signed to help ensure authenticity?
Just a heads up, thanks!
Hi,
I don't think this is there, but I thought I'd ask anyway: are there any periodic events that indicate the total current hero damage / siege damage / etc throughout the replay? This would be useful for constructing graphs of cumulative damage/etc.
If not, are there plans to add this in the future?
Alternatively, do you have any hints as to how to calculate this easily? Or does this require knowing the skills and levels and all of that fun stuff that the game has?
hi
i'm a beginner in python and i try to use the first example but it didn't work
i have a error
heroprotocol.py to few arguments
i have just replace the name of my replay file in the command like this
py heroprotocol.py --details "test.StormReplay" > output.txt
someone can explain me what is my mystake please
Thank you
Straziboy
Hello,
I'm trying to retrieve abilities casted by heroes, in gameevents I see a SCmdEvent is created every time a hero uses an ability:
{'_bits': 264,
'_event': 'NNet.Game.SCmdEvent',
'_eventid': 27,
'_gameloop': 108,
'_userid': {'m_userId': 9},
'm_abil': {'m_abilCmdData': None, 'm_abilCmdIndex': 0, 'm_abilLink': 173},
'm_cmdFlags': 256,
'm_data': {'TargetUnit': {'m_snapshotControlPlayerId': 12,
'm_snapshotPoint': {'x': 849167,
'y': 420404,
'z': 32304},
'm_snapshotUnitLink': 938,
'm_snapshotUpkeepPlayerId': 12,
'm_tag': 46137345,
'm_targetUnitFlags': 111,
'm_timer': 0}},
'm_otherUnit': None,
'm_sequence': 1,
'm_unitGroup': None}
Is there any way to determine what ability was the hero using?
Thanks in advance
_event: NNet.Replay.Tracker.SScoreResultEvent
m_name: TimeOnPayload
Thanks
Let me start with saying that I'm not super experienced with Python yet but I'm learning gradually. Can you please assist when I am trying to port the heroprotocol to Python 3? I installed the required library and when I try to run header = protocol.decode_replay_header(mpq.header['user_data_header']['content'])
I get this error: TypeError: ord() expected string of length 1, but int found
. The error says that it's in the decoders.py file on the row 69. Just to clarify, I am using latest Anaconda release. Thanks for any help.
Have a replay with m_baseBuild 39595
Is it possible to pull stats from the score screen when the game ends, e.g. Siege Damage, Healing, Hero Damage, Experience, etc. ?
Thank you.
My quest to find quest progress data continues, I ended up finding Nova's snipe master stacks in NNet.Replay.Tracker.SUpgradeEvent but not any other talent. So I started looking at the game data to see if there's any reason why this may be.
Nova is one of a few (I think only Gall has a similar statement) heroes that has a <CUpgrade>
tag, causing the data to be carried over to the replay SUpgradeEvent packet. Other talent/trait quests use Tokens as defined in Galaxy scripts via UnitSetTokenCount
and UnitCreateEffectUnit
, which are seemingly missing from replay data. Why don't all quests use CUpgrade, or how/why isn't token data in the replay?
Chromie has "ChromieSandBlastPastAndFutureMeQuestToken" and "ChromieSandBlastQuestToken", neither of those strings are present in the replay.
Hi Guys,
I understand the reluctance to offer true MMR values but would it be possible to include the players League and Rank within the League in the replay files? Preferably in a file other than battlelobby that we can parse :)
This information is available in-game and would be great for us to have in the replays.
Thanks!
Is there a good reason to include this in StormReplay files when it causes them to grow in size by 2-3 times? (there are about 200,000 such events in the game.events file I just looked at). Ignoring the effect on developers trying to still get replay files, this will for sure cause many more users to delete their old replay files.
I've seen a few replays where this events appears more than once, not sure if is intended or not.
The first occurrence happens at gameloop 0 and most of the fields are 0. Here is an example: https://gist.github.com/crorella/d69a63975951989e7043
Hello!
In the new PTR replay protocol, I haven't been able to find ban information.
Is this available in the replay file?
If not, would you be able to add it to 'replay.attribute.events', since there is other related draft info?
I was hoping to create a "www.warcraftlogs.com" style combat log parser for HOTS. Some of the things I'd like to be able to do:
From what I can tell the game.events
only includes movement, and the details only includes the final damage done numbers. Looking at Barret777's C# code he is also only tracking at this level...
Is there some way to parse these events to get this per-event data?
Apologies if this is not the correct forum. Is it possible to derive unit/hero movements from the parsed replay data? From the gameevents report, I do see events such as:
{
"_eventid": 8,
"_event": "NNet.Replay.Tracker.SUnitPositionsEvent",
"_bits": 1800,
"m_items": [0, 133, 125, 7, 104, ..., N],
"m_firstUnitIndex": 1,
"_gameloop": 13440
}
In other events, such as UnitBorn, I do see coordinate m_x/m_y
properties.
Is it possible to derive the movement and/or path of a unit from the parsed replay data?
Current hotfix on live is unsupported. I was assuming that changes are automatically pushed to this repo on client release, how come that this time it wasn't updated?
A m_toon
object for each player can be found in details.m_playerList
. Inside this object is a value called m_id
that seems to be a unique number for each player, consistent for the same player across different replays.
At first thought, I assumed it could be the BattleTag of a player, but the two did not match. What is a player's Toon Id, and what is it used for? In addition, is there any way of finding the BattleTags of players in the replay file?
Does the replay store an event or structure for quest progress and/or completion, or is it tracked programmatically by the build?
Could you clarify 'TimeCCdEnemyHeroes' in the 'ScoreResultEvent'?
First, is this value in seconds or frames?
Second, what exactly does this include? It looks like it applies to Slows as well as Stuns. Does it apply to Silences?
I have a replay with a 'Lunara' having a value of 90. I don't think she has any stuns, so does this value include time a Hero is slowed?
I also see Murky with a value of 729, so I'm guessing the slow that his 'Q' applies must apply to this.
I see an Abathur with a value of 21 as well. However, he did not take the 'Vile Nest' talent. Do you know what may be applying to his value?
Edit: Okay I think something is wonky here, I just found two Stitches in the same match, with values of 196689 and 196690
Each protocol has methods like _decode_event_stream
, but they all seem to be the same at first sight. Are the subtle differences? Could these duplicate methods be refactored to generic methods?
Hello,
it's not possible to decode the game events from the newest replay version, the error:
Traceback (most recent call last):
File "heroprotocol.py", line 112, in <module>
for event in protocol.decode_replay_game_events(contents):
File "/Users/cristiano/Others/hots-parser/heroprotocol/protocol42958.py", line 412, in decode_replay_game_events
decode_user_id=True):
File "/Users/cristiano/Others/hots-parser/heroprotocol/protocol42958.py", line 385, in _decode_event_stream
raise CorruptedError('eventid(%d) at %s' % (eventid, decoder))
CorruptedError: eventid(0) at buffer(00/4,[3918]=04)
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.