Open SayfT opened 6 years ago
You can take the same approach I took for sc2replaystats, I output the data to json and import it into PHP as that's my preferred language. Sadly I have not used it in python other than exporting the data so I cant really offer any help
@SayfT if you're working in R then dumping to JSON is probably your best bet,
Try running
python s2_cli.py --all --ndjson your-reply.SC2Replay > your-replay.ndjson
This will dump all of the contents of the file into a newline delimited JSON file that is suitable for streaming.
You can then use a package such as: https://cran.r-project.org/web/packages/ndjson/ndjson.pdf to load your results into R.
There is some limited documentation available for the protocol itself and we welcome more (via PRs).
One of the strengths of R is it's capability in exploring new data sets. I'm excited to see what you can discover in your studies.
This is quite frustrating! I have been scouring the internet for some sort of idea how to get started with this replay parser. I can get the "load programmatically" http://s2protocol.readthedocs.io/en/latest/tutorial.html#using-s2protocol-programmatically
`import mpyq
archive = mpyq.MPQArchive("C:/Users/Tim/Desktop/Replays/replay1.SC2Replay") contents = archive.header['user_data_header']['content']
from s2protocol import versions header = versions.latest().decode_replay_header(contents)`
I get the header object result but it seems it is just a bunch of game version, and bunch of not what I need beeswax.
What other parameters are there besides ['user_data_header'] and ['content']? What do I need to parse to get the game events? such as number of workers, or minerals mined or game time?
The documentation does no help it just says "Oh you would need to load the files programmatically", ok, then what? the example was useful to load the replay file but how do I read the bloody contents?
I am sorry, I am a complete python noob and would prefer to work in R for this but unfortunately the parser is written in python :(