Giter VIP home page Giter VIP logo

s2client-api's Introduction

s2client-api

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.

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

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.

Documentation

You can find documentation for the api in docs/html, open index.html to view it in your browser. We generate our documentation using Doxygen

To generate the documentation yourself.

  1. Download and install doxygen
  2. From the root of the project run: doxygen Doxyfile
  3. Commit and push the generated documentation files in a seperate commit that contains documentation changes only, no code changes.

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.

s2client-api's People

Contributors

anthonybrunasso avatar kuzi117 avatar tommytran93 avatar sc2automation avatar eyeplum avatar

Watchers

James Cloos avatar

Forkers

some-forks

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.