google-deepmind / pysc2

StarCraft II Learning Environment
Apache License 2.0
7.99k stars 1.15k forks source link

Old binaries for Mac? #288

Closed yangkevin2 closed 4 years ago

yangkevin2 commented 4 years ago

Hi,

Thanks for the great repo. I'm trying to extract some data from replays on my Mac, but I'm having trouble with versions, for example:

ValueError: Unknown game version: 4.10.1. Known versions: ['latest'].

I suspect that this is just because I have only the very latest version of Starcraft II installed (in /Applications/Starcraft II/Versions), but where can I get binaries for older versions? Are they still available somewhere?

Thanks! Kevin

bradensawatsky commented 4 years ago

First, open the replay manually in Starcraft II, forcing it to download the required binaries. Then edit and run the below using the replay. This will print out the game version, build version and data version. You must then add this information to an array found in pysc2/run_configs/lib.py Now it will understand the version of the replay and should open it correctly! Let me know if you need any additional help.

`import mpyq import six import json

def get_replay_version(replay_path): with open(replay_path, "rb") as f: replay_data = f.read() replay_io = six.BytesIO() replay_io.write(replay_data) replay_io.seek(0) archive = mpyq.MPQArchive(replay_io).extract() metadata = json.loads(archive[b"replay.gamemetadata.json"].decode("utf-8")) print(metadata)

return metadata['BaseBuild'], metadata['DataVersion']

get_replay_version(r"D:\Downloads\meepmeepvRoachRush-AcropolisLE.SC2Replay")`

(Credit: Dan_The_Man on Discord)

yangkevin2 commented 4 years ago

Ah I see, so I get the old binary by opening the replay manually. It worked for me after I did that. Thank you, and happy holidays!

GoingMyWay commented 1 year ago

Works for me. You can open it with SCII. Then it will download the corresponding version of the game.