Blizzard / s2client-proto

StarCraft II Client - protocol definitions used to communicate with StarCraft II.
MIT License
3.78k stars 431 forks source link

unable to load old replays reliably via API #109

Open ttinies opened 6 years ago

ttinies commented 6 years ago

I haven't found an elegant solution though to ensure map version used for in match/replay is the same as the what's supplied as mapdata in the SC2APIProtocol.RequestStartReplay.

Kevin @Blizzard GM clarifies that watching replays with the intended map is necessary in this post. This is fine for loading the initial 3.16* replay packs or for replays created using the same machine, map version, client version, etc. that the match was played on just fine.

However, when downloading maps via the developer's Battle.net API, the maps aren't provided with these replay packs. Nor are they available in the replay packs from WCS, such as the recent 2018 WCS Valencia replay pack. If I load the replay directly using the regular client, the replay loads and plays just fine. The problem is when attempting to load using a versioned client (i.e. ...\Starcraft II\Versions\Base#####...) using the client protocol -- somehow loading the map data fails.

For example, if I load the replay between Has and Serral in the WCS Valencia finals on the map "Catalyst LE" using client version 4.4.0.65895, the protocol replay request I'm using has this basic information:

observed_player_id: 1
options {
  raw: true
  score: true
  feature_layer {
    width: 24.0
  }
}
replay_data: <binary data from Catalyst.SC2Replay>
map_data: <binary data from Catalyst LE.SC2Map>

The SC2 client then responds with this message: [quote]SC2APIProtocol.ResponseStartReplay.Error.LaunchError: 'The launch of this game makes reference to mod or map dependencies which are no longer available.'[/quote] I also poked around this replay file using Blizzard's s2protocol tool using python2.7. From the decoded mpyq file contents, there seems to be precious little that might have anything to do with the map. The info below is all I could find... nothing that seems to suggest the needed map version.

Sample decoded mpyq data of "Catalyst LE.SC2Replay" between Serral & Has:

...
"Title": "Catalyst LE"
...
"m_cacheHandles": ["http://xx.depot.battle.net:1119/6de41503baccd05656360b6f027db88169fa1989bb6357b1b215a2547939f5fb.s2ma", "http://xx.depot.battle.net:1119/421c8aa0f3619b652d23a2735dfee812ab644228235e7a797edecfe8b67da30e.s2ma", "http://xx.depot.battle.net:1119/66093832128453efffbb787c80b7d3eec1ad81bde55c83c930dea79c4e505a04.s2ma", "http://xx.depot.battle.net:1119/d92dfc48c484c59154270b924ad7d57484f2ab9a47621c7ab16431bf66c53b40.s2ma", "http://xx.depot.battle.net:1119/31cf26bc5cec194eb3341ba43c63c2b9fa13b49f43cad0b5ebcded00d6ac4cf0.s2ma", "http://xx.depot.battle.net:1119/042a49b3af33dfb47ddb6143667b2f1f04e80688e9be5e94bf662e38a6cb9ab7.s2ma", "http://xx.depot.battle.net:1119/7f41411aa597f4b46440d42a563348bf53822d2a68112f0104f9b891f6f05ae1.s2ma", "http://xx.depot.battle.net:1119/49777c9a5ca5b6e9ceaf51fde9d021c9b60f21661c31f387473692ef47a56528.s2ma"]
...

Is there a reliable way to get the version of the map that the replay was played with? Both version and actual map binary data for that version?

How can these replays load using the s2protocol API to extract in-game observation info?

note: Related SC2 API forum post

ttinies commented 6 years ago

Adding more detail.

SITUATION:

I wanted to extract some game information from replays from WCS Valencia 2018 using Blizzard's API protocol. However, it appears an automatically downloaded Battle.net cache does not sufficiently enable a manual launch of the replay using an older version of the game client which allows protocol connections.

PROBLEM STATEMENT:

Cannot play older replays using an older version of the SC2 game client manually launched offline with a valid connection to a compatible API client.

ERROR MESSAGE:

SC2APIProtocol.ResponseStartReplay.Error.LaunchError: 'The launch of this game makes reference to mod or map dependencies which are no longer available.'

STEPS TO REPRODUCE:

  1. remove existing Battle.net folder from the main SC2 application folder.
  2. Modify the command-line launch with the -PrePopulateCache option per these instructions.
    • Adding this option on the command line directly when launching a Base***** version also launches the downloader application, but it crashes.
  3. Place all WCS 2018 - Valencia replays in the main SC2 application folder \ Replays. (For good measure, I also placed the replay files inside the C:\Users\ME\Documents\StarCraft II\Accounts\#######\1-S2-1-####\Replays\Multiplayer folder where other replays are located.)
  4. Click 'Play' on the Blizzard game launcher.
    • A new window appears informing that additional downloads are required.
    • Game data is downloaded successfully; the window indicates as such.
  5. Execute the following command: C:/Program Files (x86)/StarCraft II\Versions\Base65895\SC2_x64.exe -listen 127.0.0.1 -port 16857 -dataDir C:/Program Files (x86)/StarCraft II\ -tempDir C:\Users\ME\AppData\Local\Temp\sc-a0tio9gx\ -displayMode 1 -dataVersion BF41339C22AE2EDEBEEADC8C75028F7D
    • the Base65895 version is downloaded previously when viewing a replay that was played with this game version -- i.e. a WCS Valencia 2018 replay.
    • this exact command works just fine when supplying a different replay in the StartReplay request.
    • the replay is able to launch when double clicking the .SC2Replay file directly.