• Stars
    star
    1,657
  • Rank 28,218 (Top 0.6 %)
  • Language
    C++
  • License
    MIT License
  • Created over 7 years ago
  • Updated almost 5 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

StarCraft II Client - C++ library supported on Windows, Linux and Mac designed for building scripted bots and research using the SC2API.

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.

More Repositories

1

s2client-proto

StarCraft II Client - protocol definitions used to communicate with StarCraft II.
Python
3,777
star
2

node-rdkafka

Node.js bindings for librdkafka
JavaScript
2,106
star
3

s2protocol

Python library to decode StarCraft II replay protocols
Python
608
star
4

api-wow-docs

Documentation for the World of Warcraft web APIs.
519
star
5

heroprotocol

Python library to decode Heroes of the Storm replays
Python
398
star
6

d3-api-docs

API Documentation for the D3 Web API.
HTML
341
star
7

passport-bnet

Passport Strategy for Battle.net Login
JavaScript
196
star
8

FailoverQueue

A thread-safe queue wrapper that can spill over to on-disk files for later processing.
C++
71
star
9

api-sc2-docs

API Documentation for the Sc2 Web API.
64
star
10

omniauth-bnet

Omniauth Strategy for Battle.net Login
Ruby
60
star
11

s2client-docker

Supporting files for building the API and running the Linux build of StarCraft II
Shell
52
star
12

node-signature-generator

A sample OAuth2 Client Credentials flow application using Blizzard Battle.net APIs in Node.js.
JavaScript
28
star
13

premake-blizzard

The blizzard module for premake
Lua
24
star
14

qt

Blizzard's additions/modifications to Qt5
22
star
15

qtbase

Qt5 qtbase submodule with Blizzard's changes
C++
15
star
16

premake-consoles

Lua
14
star
17

java-signature-generator

A sample OAuth2 Client Credentials flow application using Blizzard Battle.net APIs in Java.
12
star
18

katana-assets

Documentation and information on creating Asset API plugins for Foundry's Katana
9
star
19

clang

Fork of official clang git repository located at http://llvm.org/git/clang
C++
8
star
20

premake-autoconf

AutoConf tools for Premake
Lua
6
star
21

ruby-signature-generator

A sample OAuth2 Client Credentials flow application using Blizzard Battle.net APIs in Ruby.
Ruby
5
star
22

oauth-client-sample

Java
5
star
23

qtdeclarative

Qt5 qtdeclarative submodule with Blizzard's changes
C++
4
star
24

premake-packagemanager

Lua
3
star
25

qtmultimedia

Qt5 qtmultimedia submodule with Blizzard's changes
C++
2
star