How to distinguish HotS replays from WoL replays #97

dsjoerg opened this Issue Feb 19, 2013 · 4 comments


None yet

3 participants


WoL is now on version as of today.
HotS continues to be on version

Here's a WoL replay:

Using the version number is probably already wrong.
In the HotS beta, even now, you can go to Options->Gameplay and pick Expansion Level: Wings of Liberty.

So people can play Wings of Liberty games using the HotS client.

Presumably there is some other indicator inside the replay to say which version of the game is being played.

This will be mission-critical for GGTracker soon as in statistics we don't want to mix WoL and HotS.


Agreed, the version number is already wrong. I think for this we're going to have to fall back to map dependencies information. Specifically:

>>> import sc2reader
>>> from xml.etree import ElementTree

>>> hots = sc2reader.load_replay('hots.SC2Replay', load_map=True)
>>> hots_xml = ElementTree.fromstring('DocumentInfo'))
>>> [value.text for value in hots_xml.findall('Dependencies/Value')]
['bnet:Swarm (Mod)/0.0/999,file:Mods/Swarm.SC2Mod']

>>> wol = sc2reader.load_replay('wol.SC2Replay', load_map=True)
>>> wol_xml = ElementTree.fromstring('DocumentInfo'))
>>> [value.text for value in wol_xml.findall('Dependencies/Value')]
['bnet:Liberty (Mod)/0.0/999,file:Mods/Liberty.SC2Mod']

It may also be reasonable to do this at the replay level by looking for Swarm (Mod) in the list of map resources found here:


I'll try to implement something along these lines soon.




Okay, I'm pushing out an improved fix that doesn't involve fetching dependencies from the depots. Instead it takes advantage of the depot convention of naming files by the sha256 digest their contents. From what I can tell, HotS games depend on 'Standard Data: Swarm.SC2Mod' and WoL games depend on 'Standard Data: Liberty.SC2Mod'.

if hashlib.sha256('Standard Data: Swarm.SC2Mod').hexdigest() in dependency_hashes:
    self.expansion = 'HotS'
elif hashlib.sha256('Standard Data: Liberty.SC2Mod').hexdigest() in dependency_hashes:
    self.expansion = 'WoL'
    self.expansion = ''

I'm pushing this out in the next batch of commits.


Outstanding, thank you!

@GraylinKim GraylinKim closed this Mar 11, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment