StarCraft II API – Setting Up Your Bot


As you may know, Blizzard has finally released the long-awaited StarCraft II API: now you can make some nice and cute bots using an official library. Blizzard released tons of stuff, we have:

  • API Library, which is all you need to get a StarCraft bot up and running;
  • API Protocol, all the magic that makes the API work, the bridge between API and StarCraft itself;
  • PySC2: a learning environment developed by DeepMind.

In these days I’ve been playing with the API Library and I’m building simple bots to understand its capabilities and explore some AI techniques that can be applied in StarCraft. If you download or clone the Blizzard API repository from GitHub, you will see that there is some documentation and it comes with neat tutorials on how to get your hands in the code.

In this brief article I’m going to share how to create a project from scratch and set up visual studio for StarCraft Bot development, using the new API. This is pretty basic stuff, but if you are unfamiliar with Visual Studio and external libraries, or you just want to jump into the API itself, this can be handy and avoids you all the issues you may face.

1. Download precompiled libraries here and extract the files on your PC. From now on, I’ll be referring at them as StarcraftAPI folder;

2. Open Visual Studio (I used VS 2017) and create a new project -> empty project;

3. We will add some basic code that writes “Game Started” on the Bot debug window. Here’s the code we are going to use:

#include <sc2api/sc2_api.h>
#include <iostream>

using namespace sc2;

// Our bot
class MyFirstBot : public Agent
        virtual void OnGameStart() final override
            std::cout << "Game Started";

int main(int argc, char* argv[]) {
    MyFirstBot bot;

    // Init the game we are going to play using the coordinator
    Coordinator coordinator;

    coordinator.LoadSettings(argc, argv);
    CreateParticipant(sc2::Race::Terran, &bot), // us
    CreateComputer(sc2::Race::Terran) // standard SC AI

    // Start the game in the specified map

    // perform game steps (needs to be done "manually")
    while (coordinator.Update()) {}

    return 0;

4. Let’s setup our solution right-clicking on it and selecting “Properties”:

4.1 Select VC++ Directories, modify “Include Directories” and “Library Directories” to contain StarCraftAPI\include and StarCraftAPI\lib folders respectively. You should see something like this:



(of course relative paths are often better in these cases 😛 )

4.2 Now Visual Studio knows the additional directories coming from the API, let’s feed the Linker with the library names we need by clicking in Linker -> Input. Write down the ones below:



4.3 Apply our updates and close the Property window.

NOTE: be sure to modify the correct Configuration and Platform, otherwise we changed setup for something different.

5. In our code snippet we selected a map, so be sure to copy the “maps” folder inside StarCraftAPI\project\maps into your working directory (usually the one with the .sln in it).

6. That’s it: build and run your bot!


  • You may need to add -D_SCL_SECURE_NO_WARNINGS flag inside Project Properties, under c/c++ -> Command Line if you have issues similar to “std::copy::_Unchecked_iterators::_Deprecate: Call to ‘std::copy’ with parameters that may be unsafe”;
  • If you have linking problems, try checking project properties -> c/c++ -> Code Generation Runtime Library field: it should be set to Multi-threaded Debug (/MTd).

More issues? I wrote something wrong? Let me know in the comments.


Know Your Role – Game Development

It has been a lot of time since my last post! In the meanwhile a lot of things happened, but well, that’s not the point of this post.

Today I want to share a very basic knowledge of the common roles you can find in the Game Development field, just to help those people who still are not sure of what to do or what to study. Note that there is no general rule to define these roles, this is only how I see the organisation of a team in a Game Dev studio – just a pretty basic and very generic representation. We can find four main macro jobs:


People who write code. They are generally responsible for all the software that the studio builds. There are quite a few typologies for a programmer which vary according to the goal the programmer has to cope. Just to list a couple of them: we have Engine Programmers taking care of the “system” that runs the game; Gameplay Programmers, specialised in one or more area, who implement the actual game and often interact with Game Designers; Tools Programmers, building off-line software that is used by other people in the team; Technical Directors, that follow the project on a more high-level, technical view.


Game Designers have just one major tough task and, as you may imagine, is to design the game. This typically means think about what the gameplay of the game will be. This involves game mechanics, player interaction, missions, story etc. Some designers can also be more technical, modifying game data, writing high-level code (such as scripts) and working closely with Gameplay Programmers.


An artist has to do with game assets: models, animations, cinematic, concepts, audio and so on. It is a fundamental role which includes very specific jobs and, in most of the cases, their work is what the player will notice as one of the first things – from the game trailer, to the first screenshots of the game. The main categories here are the Concept Artists, who transform designer vision into a drawing used for further development; 3D modelers, making the geometry that will be used in the game such as characters, props, weapons; Animators, providing the characters smooth movements and actions that will be used in game.


Usually a producer has to do with scheduling the game milestones and taking care of the general development. Often this job has more to do with the “business” part, since a producer should take care of delivering the project in time and with as less problems as possible. Sometimes a producer can also influence the evolution and the development of the game.

I hope I have listed the major roles in a clear way and clarified any doubts.

I’m back!

Hello folks, I know that it has been a while since my last post. During this time, I was finishing my erasmus period in Vienna and I got my degree. I was really busy writing my thesis, but I enjoyed it. Then I decided to move to Dundee, Scotland, to study Games Development, for my postgraduate degree. So, now… I’m busy again! I’m trying to update my portfolio and to write an article soon, let’s hope it won’t take too much time!

Meanwhile I changed the blog theme (hope you like it) and I’ve written some drafts for some of my projects. Any feedback is appreciated.

Some pics of my updated projects:

An introduction to SHOP 2 Planning System


In these days I’ve done a seminar in artificial intelligence based on SHOP 2 planning system. I made some slides that cover an intro to the system SHOP 2 as well as an intro to Hierarchical Task Networks , I also provided some (cool) applications. Unfortunately, as far as I know, slide share does not allow animation in slides, so something has been”lost”. I’ll also put the extended version of the slides in these days!