StarCraft II Client - C++ library supported on Windows, Linux and Mac designed for building scripted bots and research using the SC2API.
C++ C CMake Other
Switch branches/tags
Nothing to show
Clone or download
Latest commit d9ba0a3 Jun 7, 2018
Permalink
Failed to load latest commit information.
contrib Updating to HEAD of ipv6-parse Dec 12, 2017
docs Fix broken links for tutorials Apr 3, 2018
examples Fixed issue with connection failures connecting to clients Dec 22, 2017
include Fix some compile warnings. Jun 5, 2018
maps SC2 Client API - Initial commit from Blizzard Entertainment Aug 9, 2017
project/project Updated prebuilt project to properly link SDL and its dependencies. Sep 7, 2017
protocol @ d451464 Updating submodule with updated versions.json May 2, 2018
src Fix some compile warnings. Jun 5, 2018
tests Merge branch 'master' into ipv6-base-merge Dec 12, 2017
.editorconfig SC2 Client API - Initial commit from Blizzard Entertainment Aug 9, 2017
.gitignore Updating .gitignore for any build_ type Nov 22, 2017
.gitmodules Adding underlying IPv6 support w/ cmake cleanup Nov 22, 2017
.travis.yml Converting BETA apt/addon travis instructions Nov 22, 2017
CMakeLists.txt Adding underlying IPv6 support w/ cmake cleanup Nov 22, 2017
CREDITS SC2 Client API - Initial commit from Blizzard Entertainment Aug 9, 2017
Doxyfile Fix broken links for tutorials Apr 3, 2018
LICENSE SC2 Client API - Initial commit from Blizzard Entertainment Aug 9, 2017
README.md Updating documentation for gh-pages Nov 22, 2017
cmake_gmake.sh Adding script for gmake generation Nov 22, 2017
cmake_vs2015.bat Adding underlying IPv6 support w/ cmake cleanup Nov 22, 2017
cmake_vs2017.bat Adding underlying IPv6 support w/ cmake cleanup Nov 22, 2017
generate_and_deploy_doxygen.sh Adding doxygen automation Nov 22, 2017
synchproject.bat Prebuilt projects does not need SDL includes. Sep 7, 2017

README.md

s2client-api

Build Status

The StarCraft II API provides access to in-game state observation and unit control. The API is a wrapper around protobuf defined protocol over a websocket connection.

While it's possible to write directly to the protocol, this library provides a C++ and class-based abstraction. You can see a simple example below.

#include <sc2api/sc2_api.h>

#include <iostream>

using namespace sc2;

class Bot : public Agent {
public:
    virtual void OnGameStart() final {
        std::cout << "Hello, World!" << std::endl;
    }

    virtual void OnStep() final {
        std::cout << Observation()->GetGameLoop() << std::endl;
    }
};

int main(int argc, char* argv[]) {
    Coordinator coordinator;
    coordinator.LoadSettings(argc, argv);

    Bot bot;
    coordinator.SetParticipants({
        CreateParticipant(Race::Terran, &bot),
        CreateComputer(Race::Zerg)
    });

    coordinator.LaunchStarcraft();
    coordinator.StartGame(sc2::kMapBelShirVestigeLE);

    while (coordinator.Update()) {
    }

    return 0;
}

You can find a detailed tutorial on what this code does in docs/tutorial1.md.

Documentation

You can find API in documentation on our github pages site. The documentation is generated from code automatically, using Doxygen

To editor and generate the documentation yourself.

  1. Download and install doxygen
  2. Fork the repository and clone it locally
  3. Checkout the master branch 'git checkout origin/master -b my-documentation-update
  4. Make changes to the code documentation or docs/ files
  5. From the root of the project run: doxygen Doxyfile
  6. Review your documenation changes by opening docs/html/index.html in your browser
  7. Push your changes to your fork and send us a pull request

Building

This library uses CMake to generate project files. It builds with Visual Studio on Windows and Makefiles on the other platforms. It relies on the following contrib packages.

  1. Civetweb
  2. Protobuf
  3. (optional) SDL
  4. ipv6-parse

Follow the instructions for submodules and building in docs/building.md.

Coding Standard

Coding Standard

We do our best to conform to the Google C++ Style Guide with the exception that we use four space tabs instead of two space tabs.

Additional Downloads

Maps and Replays

This repository only comes with a few maps for testing.

Additional maps and replays can be found here.

Precompiled Libs

If you are using Visual Studio 2017 and just want precompiled library files you can download the following package:

Precompiled Libs

Other Libraries

Additional community built AI libraries can be found here.

If you are new to programming, the CommandCenter framework may be a good starting point.