s2client-api help - not working

API Discussion
I was wondering if anyone can help me with the StarCraft II API (https://github.com/Blizzard/s2client-api).

I am not sure if it just something with my builds, but not all of the S2api is working.
I was walking through the tutorials provided. The first tutorial instructs you on how to set up a bot, and start a match of SC II with the bot running as an agent. That goes off without a hitch, the game starts, and "Hello World" is printed to the console.
The second tutorial is about getting a command center to auto build SCVs and have SCVs create supply depots when the player becomes supply blocked.
This is where you start to see parts of the API not working.
virtual void OnGameStart() final {
std::cout << "Hello World." << std::endl;
works as it did before.
virtual void OnStep() final {
std::cout << Observation()->GetGameLoop() << std::endl;
Prints the current frame we are on, which it should.
virtual void OnUnitCreated(const Unit* unit) final {
std::cout << "A unit was created." << std::endl;
does not output to console at all.
virtual void OnUnitIdle(const Unit* unit) final {
std::cout << "A unit went idle." << std::endl;
also does not output anything to console.

If I copy paste the tutorial "complete source code" the bot does not attempt to make any SCVs (uses OnUnitIdle() to do so), and crashes when we check to see if we are supply capped, because the game data is not returning to us having any units at all just an empty collection or a collection full of nullptr.

All the pre-built examples I have tried out of the box, do absolutely nothing, or crash at some point doing absolutely nothing.

I am not sure if things are outdated, or what.
Built using Visual Studio 2019 x64

Can anyone help me?

Join the Conversation

Return to Forum