s2client-api icon indicating copy to clipboard operation
s2client-api copied to clipboard

Loading replay files fails on Windows

Open Tommy544 opened this issue 7 years ago • 3 comments

Hi,

I am trying to process replays in order to extract some features out of them. I use a custom ReplayObserver and this is how the main function looks like:

int main(int argc, char* argv[]) {
    sc2::Coordinator coordinator;
    if (!coordinator.LoadSettings(argc, argv)) {
        return 1;
    }

    if (!coordinator.SetReplayPath(kReplayFolder)) {
        std::cout << "Unable to find replays." << std::endl;
        return 1;
    }

    Replay replay_observer;

    coordinator.SetStepSize(16);
    coordinator.SetRealtime(false);

    coordinator.AddReplayObserver(&replay_observer);

    while (coordinator.Update());
    while (!sc2::PollKeyPress());
}

following is the output and the error I am getting:

Launched SC2 (C:\Games\StarCraft II\Versions\Base59587\SC2_x64.exe), PID: 3212
Waiting for connection....
Connected to 127.0.0.1:8167
Replay is from a different version. Relaunching client into the correct version...
Launched SC2 (C:\Games\StarCraft II\Versions\Base55958\SC2_x64.exe), PID: 12652
Waiting for connection..
Connected to 127.0.0.1:8168
map_name: 奥德赛 - 天梯版`
WaitForReplay: start replay contains an error: 7
WaitForReplay: error details: The launch of this game makes reference to mod or map dependencies which are no longer available.
map_name: Abyssal Reef LE
WaitForReplay: start replay contains an error: 7
WaitForReplay: error details: The launch of this game makes reference to mod or map dependencies which are no longer available.

I have the replay and map files in their respective folders in the root of my StarCraft II installation directory. Moreover, the code works fine on Linux.

I tried to debug the issue and I fond out that the ReplayInfo objects for each replay have a seemingly random sequence of characters for their map_name attributes, i.e.: 奥德赛 - 天梯版 Even though some replays have correct map_name in their ReplayInfo: Abyssal Reef LE the error is still the same for those as well.

Tommy544 avatar Dec 08 '17 18:12 Tommy544

I had a similar issue when doing something like this recently and never resolved it. I investigated a bit but never had time to write up an issue because it was for an assignment due relatively soon after.

I believe you're launching the wrong version of the game for the replay. Test this out by seeing which version of the binary is launched when you open it manually and which version is launched when you run your observer. You can see this by using the task manager and doing "go to process" > "show in explorer" or something similar.

If they differ, try moving all of your versions except the one you need elsewhere temporarily and rerunning your observer. In my experience it would launch the correct version but tell me my install was broken and offer me the opportunity to repair it.

Let me know if you have the same experience.

kuzi117 avatar Dec 12 '17 03:12 kuzi117

@kuzi117 thanks for the answer. The Coordinator initially starts the wrong version of the game, but when it reads the replay and checks the version of the game the replay was created on, it then reloads StarCraft into the correct version of the replay. I tried removing StarCraft executables of wrong versions and only keeping the correct one in the StarCraft installation directory. That however doesn't work as it seems I can't directly start an older version of Starcraft. I can't do it manually nor through setting Coordinator to launch the older version directly by using SetProcessPath method. The game just crashes without any error messages immediately after starting it.

During this process, I however started Blizzard launcher and let it download the latest executable of StarCraft (Base60321). When using this version of the game, the code I pasted here in the original post works.

It would still be very useful for me if I were able to start the older version directly though as I have some issues connected to switching the versions of the game.

Tommy544 avatar Dec 17 '17 21:12 Tommy544

If you want to force it to launch the older version immediately, you need to call SetDataVersion as well as SetProcessPath (See the comments above SetDataVersion). (More details can be found here)

When running an old version of the game, it doesn't have access to some BattleNet services which can prevent it from downloading missing map data required to play old replays. You may need to manually install the BattleNet cache files required for the replay.

If you are using one of the replay packs from the s2client-proto page, it should be included in the zip. If you are using other replays, you can generate it yourself with these steps.

I recall seeing korean replays having unicode characters in the map name. That may be one reason it could print as random looking characters?

KevinCalderone avatar Jan 04 '18 02:01 KevinCalderone