sc2reader
sc2reader copied to clipboard
Which load_level should we use for game metadata?
What is a game metadata and why we need it?
There is a replay.gamemetadata.json
file included in the MPQArchive. An example of content is shown below.
{'BaseBuild': 'Base90870',
'DataBuild': '90870',
'DataVersion': 'A3FC7B99B9F515326107F490D0E0AA7C',
'Duration': 1883,
'GameVersion': '5.0.11.90870',
'Players': [{'APM': 145.0,
'AssignedRace': 'Prot',
'MMR': 2761,
'PlayerID': 1,
'Result': 'Win',
'SelectedRace': 'Prot'},
{'APM': 261.0,
'AssignedRace': 'Terr',
'PlayerID': 2,
'Result': 'Win',
'SelectedRace': 'Terr'},
{'APM': 197.0,
'AssignedRace': 'Prot',
'MMR': 5009,
'PlayerID': 3,
'Result': 'Loss',
'SelectedRace': 'Prot'},
{'APM': 292.0,
'AssignedRace': 'Zerg',
'MMR': 2609,
'PlayerID': 4,
'Result': 'Loss',
'SelectedRace': 'Zerg'}],
'Title': 'Arctic Dream LE'}
While most of the info is duplicated, there are still some interesting info that not included currently:
-
DataVersion
: it seems a hash related to datapack. We dont have it now. -
Duration
: this indicates the real length of the whole replay, whilereal_length
indicated the time from gamestart to last event. For the several replays I tested,Duration
is slightly larger thanreal_length
(usually 1~2 seconds, if count 16 frames as 1 second). I thinkDuration
is the time from gamestart to the time the replay recorder actually left the game. -
APM
for players: thisAPM
is exactly the number given by SC2 after game summary. I tried several algorithms to get it but still cannot calculate it myself. Someone may be interested in it. -
MMR
for players: while thisMMR
equals to 'scaled_rating' mentioned in #89 in 1v1 games, it's different in other types like 2v2. After some tests, I guess theMMR
here indicates the players' 1v1 mmr, while 'scaled_rating' indicates the players' mmr for the type of the game like 2v2.
Let's get it! But where?
sc2reader reads replays with different load_level
. Where should we put this one? Since it includes Duration
and DataVersion
, it's better to put it at level 0 or 1. But the players and teams will not be constructed until level 2, leads to all the Players
useless at level 0 or 1.
So where should we put it?
Solid analysis.
To the extent that users haven't been missing this data so far, I'm inclined to put this at load_level
1, with the caveat that the player data only gets incorporated if we have the corresponding objets for that if it's load_level
2.