Blizzard / s2client-api

StarCraft II Client - C++ library supported on Windows, Linux and Mac designed for building scripted bots and research using the SC2API.
MIT License
1.66k stars 281 forks source link

Any way to run the simulation at normal game speed? #179

Closed edwinsaunders closed 7 years ago

edwinsaunders commented 7 years ago

I tried using coordinator.SetStepSize(), but it only takes int values, and the default value of 1 is already much faster than a normal game.

alkurbatov commented 7 years ago

I used the following workaround:

    while (coordinator.Update()) {
        // Slow down game speed for better look & feel while making experiments.
        sc2::SleepFor(15);
    }

It seems that we have no other way.

KevinCalderone commented 7 years ago

Another option is:

coordinator.SetRealtime(true);

However this also has the effect where a variable number of GameLoops may pass between calls to your OnStep depending on how slow your logic is. If this is undesirable I suggest alkurbatov's solution.

herodrigues commented 7 years ago

@KevinCalderone, @alkurbatov's solution works, but keep in mind that you have to include manage_process header.

#include <sc2utils/sc2_manage_process.h>