Git Product home page Git Product logo

s2client-api's Introduction

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.

s2client-api's People

Contributors

anthonybrunasso avatar blizzaphex avatar ccarterc avatar chazix avatar confessore avatar cryptyc avatar donthompson avatar drivehappy avatar eyeplum avatar herodrigues avatar hjax avatar iangallacher avatar irperson avatar jashunk avatar jrepp avatar kuzi117 avatar lordblackhawk avatar michaelnew avatar nikibobi avatar richardapowell avatar sc2automation avatar sheikyabooti avatar skarlso avatar t-jin avatar tewalds avatar tommytran93 avatar tunabrain avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

s2client-api's Issues

How to build the api ?

Hi,
After following the building.md tutorial in docs folder i run cmake as it is explained but i got this error
I have added the paths of the binaries to environement variable PATH for cmake and msbuild as well
Thank you

cmd_2017-08-14_22-33-49

Cmake not found files

three day i have a problem ,when i cmake install the erros :
CMake Error at contrib/civetweb/src/cmake_install.cmake:50 (file):
file INSTALL cannot find
"/home/sihuaiwei/ๆกŒ้ข/git/s2client-api/build/bin/civetweb".
Call Stack (most recent call first):
contrib/civetweb/cmake_install.cmake:37 (include)
cmake_install.cmake:37 (include)

Expose unit prerequisites

eg. A Barracks requires a supply depot. An infestor requires an infestation pit.

There may be cases where something requires an upgrade?

In the short term, possible hard code a map of all these dependencies.

SC2 Client - Remote desktop connection

Dear all,

Due to the flexible scaling possibilities of amazon web services I had decided to use one of their instances for testing. Unfortunately it seems that access to SC2 is impossible. I tried running the CommandCenter bot of davechurchill and the game itself, with no good outcome.
The error is as follows, "Running StarCraft II through a Remote Desktop connection is not supported. Exiting program." I am relatively new to most of this, so I wonder whether this can be circumvented?

Regards,

Michael

Nicer way of getting building type placement width / height

Currently the only way to obtain a building type's placement width / height is to query the ability and then get its radius and multiply it by 2. Might be a nice QOL improvement if the unit type data had width / height instead of simply radius

'None' values for various types

It would be quite nice if there were 'None' values for various types such as Race, UnitTypeID, etc, whose internal int is 0. This is very useful for 'error return' cases, such as not currently knowing what race the enemy is, or for returning a 'None' type for a prerequisite when a unit doesn't have one, etc.

sc2::UNIT_TYPEID::None
sc2::Race::None

connect to existing server

I think it would be reasonable to allow connecting to an existing server. For example, the cli args could take a host/port to connect to, instead of starting a new server process. This is particularly useful if the sc2 server is running on a remote host

Cmake error for OSX

โžœ  build cmake ../ -G Xcode
-- The C compiler identification is AppleClang 8.1.0.8020042
-- The CXX compiler identification is AppleClang 8.1.0.8020042
-- Check for working C compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang
-- Check for working C compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang++
-- Check for working CXX compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
CMake Error at contrib/civetweb/cmake/DetermineTargetArchitecture.cmake:30 (execute_process):
  execute_process attempted to output into a file: into a source directory.
Call Stack (most recent call first):
  contrib/civetweb/CMakeLists.txt:37 (determine_target_architecture)


-- Configuring incomplete, errors occurred!
See also "/Users/lin/s2client-api/CMakeFiles/CMakeOutput.log".
See also "/Users/lin/s2client-api/CMakeFiles/CMakeError.log".

UnitData supply cost missing?

Is there anywhere to determine the supply cost of a given UnitTypeID? I only see cargo_size in UnitData, is that equivalent?

PowerSource definition seems out of place

The definition for PowerSource is located in include/sc2api/sc2_gametypes.h. This seems terribly out of place. Why would I want to include info about gametypes when I want the definition of a PowerSource and vice versa?

I would pull request this but I haven't had a chance to look deeply enough to figure out the best place to move it yet. Tonight, if I have a chance.

error when installing

I run into the following error when I install s2client-api
screenshot_20170819_235120
How can I get rid of this problem. Thx

Common Unit Types / Helper Functions

When writing a bot, several unit types of a race are often required. It would be nice if the Race namespace had the following functions:

sc2::Race::GetTownHall(race) -> returns the UnitTypeID of Nexus if race == Protoss, for example
sc2::Race::GetSupplyProvider(race)
sc2::Race::GetWorker(race)
sc2::Race::GetRefinery(race)

It would also be quite nice to have something like an sc2::UnitType namespace, in which the following functions existed:

sc2::UnitType::IsTownHall(id)
sc2::UnitType::IsSupplyProvider(id)
sc2::UnitType::IsWorker(id)
sc2::UnitType::IsRefinery(id)
sc2::UnitType::IsGeyser(id)
sc2::UnitType::IsMineral(id)
sc2::UnitType::IsBuilding(id) -> whether the given type is a building
sc2::UnitType::WhatBuilds(id) -> id = barracks returns SCV, id = marine returns barracks, etc

Unit land/air status (colossus?)

At the moment I can't find any information on what units occupy what layers. I see the bool is_flying in the sc2::Unit class, but there is no way (as far as I can tell) see that a marauder and a flying viking can hit a colossus without specifying that yourself. Am I missing something or is this intentional?

Viewport Scroll Unuseably Fast

When I use the arrow keys or the mouse to scroll the screen during a bot game, it moves way too fast for me to be able to use it with any accuracy, so I am reduced to clicking on the minimap to see what's going on

Is there any way to decouple the viewport scroll speed from the game speed / step size?

Expose player race

It is in ResponseGameInfo but is missing from sc2::GameInfo.

For Random enemy players, make sure it is not giving away their race.

Examples CMakeLists file missing a dependancy?

Had an issue building the feature_layer example due to a missing dependency.

When I edited the following code at line 45:
target_link_libraries(feature_layers sc2api sc2utils sc2renderer) to target_link_libraries(feature_layers sc2api sc2utils sc2renderer libvcruntime)

It resolved the issue.

Add a NULL value to the type enums.

Unit and Ability already have 0 reserved as NULL, but there is no enum entry for it.

We forgot to reserve 0 for Upgrade/Buff. We should change the id mapping for 0 and then also add a NULL entry to those enums.

Maps could not be loaded from simple relative path.

Function ControlImp::ResolveMap searches for maps in relative path ..\..\..\maps relative to executable/library. In case of any sort of non-standard configuration this relative path loses its meaning and becomes unusable. However just by changing working directory it's easy to make any other path working, so it'd be nice if maps could be loaded simply from working directory without any ..

missing headers

I get the following error when compiling
screenshot_20170818_221003
I know the missing headers can be generated from proto files of s2client-proto project. but where should I put them?

Allow build command on position of geyser

Right now you can only build a refinery based on the unit tag of the geyser, not the position of the geyser itself. Would be nice if the build command on a position also allowed the construction.

Compiling error sc2api.pb.h not found

I cloned the repository and started with the docs. After the first tutorial I wanted to compile the code using the gcc compiler on windows:
gcc -Wall -c -I../include/ tutorial.cc -std=c++11
When I use this command the gcc has a fatal error:
In file included from ../include/sc2api/sc2_unit.h:6:0, from ../include/sc2api/sc2_interfaces.h:13, from ../include/sc2api/sc2_api.h:3, from tutorial.cc:1: ../include/sc2api/sc2_proto_interface.h:5:23: fatal error: sc2api.pb.h: No such file or directory compilation terminated.
The sc2_proto_interface.h file includes the sc2api.pb.h file, that is not in the repository. Is the file in the SC2 dir? If so how should I change my command for compile my code.

EDIT:
found this https://us.battle.net/forums/en/sc2/topic/20758537485 and they found a solution for using the make command on linux. What can I do on windows?

AbilityData name field missing

AbilityData has no 'name' field like UpgradeData, UnitTypeData, and BuffData do, is link_name the proper value? If so, is there a reason it is named differently than the others?

Update to VisualStudio 2017?

When I open the VS files created by cmake, Visual Studio 2017 asks me if I want to update those files to 2017, since by default they are versioned to VS 2015. Luckily, 2017 can open and compile 2015 projects, but this may confuse people who are using the 2017 version, and I'm not sure what the consequences of clicking yes to that request are. This also means that my bot needs to be 2015 versioned.

Is there any plan to update those generated project / solution files to 2017? It would be great to hit the ground running with the newest version of VS

CMake install

I've started looking at creating an install target for the api. The main problem right now is that civetweb always tries to install its executable along with it's library component. You currently disable building the executable using the EXCLUDE_FROM_ALL property, but that doesn't disable it from trying to install when we run make (and generates a warning like you mention a few lines above it). As far as I can tell, this is the only real barrier to creating a decent install target.

I see a couple of options, though, one which involves installing into the cmake binary dir and then we reinstall the header and library file from our cmake; another that was switching the add_subdirectory call to ExternalProject_Add and disabling the install step, then again installing the generated library and header ourselves; finally, which I think is the most reasonable approach that I can think of, so far, is to add a flag to disable the executable install. I have a patch prepared to add that to the blizzard fork civetweb master.

After applying that change to my local files I'm investigating a problem from protobuf:

CMake Error at contrib/protobuf/cmake/cmake_install.cmake:571 (file):
  file INSTALL cannot find
  "/home/braedy/dev/cpp/s2client-api/build/lib/cmake/protobuf".
Call Stack (most recent call first):
  cmake_install.cmake:38 (include)

Will update if I find something.

Segfault on Mac when an example ends

me@seeks:build$ ./bin/all_tests 
Running test: sc2::TestAbilityRemap
Launched SC2 (/Applications/StarCraft II/Versions/Base55958/SC2.app/Contents/MacOS/SC2), PID: 75685
NSWindowEdgeResizing is off!
Waiting for connection............
Connected to 127.0.0.1:8167
Waiting for the JoinGame response.
WaitJoinGame finished successfully.
libc++abi.dylib: terminating with uncaught exception of type std::__1::system_error: mutex lock failed: Invalid argument
Abort trap: 6

The error is same for at least ./bin/annoying_helper too. The example itself runs fine, and this error is only thrown after the game window closes.

Running on OS X El Capitan 10.11.6.

Compiled using:

git clone --recursive https://github.com/Blizzard/s2client-api
cd s2client-api/
make
mkdir build
cd build/
cmake ../
make

(also, compiler weirdness:)

[ 96%] Building CXX object tests/CMakeFiles/all_tests.dir/test_observation_interface.cc.o
/Users/Hannes/Desktop/s2client-api/tests/test_observation_interface.cc:99:90: warning: adding 'int32_t' (aka 'int') to a string does not append to the string [-Wstring-plus-int]
            ReportError("Supply cap is Incorrect the supply is reporting 16 instead of " + obs->GetFoodCap());
                        ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~
/Users/Hannes/Desktop/s2client-api/tests/test_observation_interface.cc:99:90: note: use array indexing to silence this warning
            ReportError("Supply cap is Incorrect the supply is reporting 16 instead of " + obs->GetFoodCap());
                                                                                         ^
                        &                                                                [                  ]
/Users/Hannes/Desktop/s2client-api/tests/test_observation_interface.cc:249:117: warning: adding 'uint32_t' (aka 'unsigned int') to a string does not append to the string
      [-Wstring-plus-int]
                std::string errorStr = "UnitTypeData is reporting an incorrect cargo value. Expected : 0 Result : " + stalker_data.cargo_size;
                                       ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~
/Users/Hannes/Desktop/s2client-api/tests/test_observation_interface.cc:249:117: note: use array indexing to silence this warning
                std::string errorStr = "UnitTypeData is reporting an incorrect cargo value. Expected : 0 Result : " + stalker_data.cargo_size;
                                                                                                                    ^
                                       &                                                                            [                        ]
/Users/Hannes/Desktop/s2client-api/tests/test_observation_interface.cc:253:126: warning: adding 'int' to a string does not append to the string [-Wstring-plus-int]
                std::string errorStr = "UnitTypeData is reporting an incorrect mineral cost value. Expected : 125 Result : " + stalker_data.mineral_cost;
                                       ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~
/Users/Hannes/Desktop/s2client-api/tests/test_observation_interface.cc:253:126: note: use array indexing to silence this warning
                std::string errorStr = "UnitTypeData is reporting an incorrect mineral cost value. Expected : 125 Result : " + stalker_data.mineral_cost;
                                                                                                                             ^
                                       &                                                                                     [                          ]
/Users/Hannes/Desktop/s2client-api/tests/test_observation_interface.cc:257:120: warning: adding 'int' to a string does not append to the string [-Wstring-plus-int]
                std::string errorStr = "UnitTypeData is reporting an incorrect vespene value. Expected : 50 Result : " + stalker_data.vespene_cost;
                                       ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~
/Users/Hannes/Desktop/s2client-api/tests/test_observation_interface.cc:257:120: note: use array indexing to silence this warning
                std::string errorStr = "UnitTypeData is reporting an incorrect vespene value. Expected : 50 Result : " + stalker_data.vespene_cost;
                                                                                                                       ^
                                       &                                                                               [                          ]
/Users/Hannes/Desktop/s2client-api/tests/test_observation_interface.cc:265:116: warning: adding 'uint32_t' (aka 'unsigned int') to a string does not append to the string
      [-Wstring-plus-int]
                std::string errorStr = "UnitTypeData is reporting an incorrect unittypeID Expected : 74 Result : " + stalker_data.unit_type_id;
                                       ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~
/Users/Hannes/Desktop/s2client-api/tests/test_observation_interface.cc:265:116: note: use array indexing to silence this warning
                std::string errorStr = "UnitTypeData is reporting an incorrect unittypeID Expected : 74 Result : " + stalker_data.unit_type_id;
                                                                                                                   ^
                                       &                                                                           [                          ]
5 warnings generated.

Shields damage

Some attacks (like widow mines afaik) do extra damage vs shields. As far as I can tell, that is not a unit attribute in the api, and the damage bonus can therefore not be parsed from the weapon.

The deprecation occurs at building time on macOS v10.12.6

OS: macOS Sierra Version 10.12.6
Xcode: Version 8.3.3 (8E3004b)

I follow the official document to compile the repo and it occurs the following messages.

/Users/gapry/Workspace/s2client-api/contrib/protobuf/src/google/protobuf/stubs/atomicops_internals_macosx.h:47:9: 'OSAtomicCompareAndSwap32' is deprecated: first deprecated in macOS 10.12 - Use std::atomic_compare_exchange_strong_explicit(std::memory_order_relaxed) from <atomic> instead
/Users/gapry/Workspace/s2client-api/contrib/protobuf/src/google/protobuf/stubs/atomicops_internals_macosx.h:61:13: 'OSAtomicCompareAndSwap32' is deprecated: first deprecated in macOS 10.12 - Use std::atomic_compare_exchange_strong_explicit(std::memory_order_relaxed) from <atomic> instead
/Users/gapry/Workspace/s2client-api/contrib/protobuf/src/google/protobuf/stubs/atomicops_internals_macosx.h:68:10: 'OSAtomicAdd32' is deprecated: first deprecated in macOS 10.12 - Use std::atomic_fetch_add_explicit(std::memory_order_relaxed) from <atomic> instead
/Users/gapry/Workspace/s2client-api/contrib/protobuf/src/google/protobuf/stubs/atomicops_internals_macosx.h:73:10: 'OSAtomicAdd32Barrier' is deprecated: first deprecated in macOS 10.12 - Use std::atomic_fetch_add() from <atomic> instead
/Users/gapry/Workspace/s2client-api/contrib/protobuf/src/google/protobuf/stubs/atomicops_internals_macosx.h:77:3: 'OSMemoryBarrier' is deprecated: first deprecated in macOS 10.12 - Use std::atomic_thread_fence() from <atomic> instead
/Users/gapry/Workspace/s2client-api/contrib/protobuf/src/google/protobuf/stubs/atomicops_internals_macosx.h:85:9: 'OSAtomicCompareAndSwap32Barrier' is deprecated: first deprecated in macOS 10.12 - Use std::atomic_compare_exchange_strong() from <atomic> instead
/Users/gapry/Workspace/s2client-api/contrib/protobuf/src/google/protobuf/stubs/atomicops_internals_macosx.h:138:9: 'OSAtomicCompareAndSwap64' is deprecated: first deprecated in macOS 10.12 - Use std::atomic_compare_exchange_strong_explicit(std::memory_order_relaxed) from <atomic> instead
/Users/gapry/Workspace/s2client-api/contrib/protobuf/src/google/protobuf/stubs/atomicops_internals_macosx.h:152:13: 'OSAtomicCompareAndSwap64' is deprecated: first deprecated in macOS 10.12 - Use std::atomic_compare_exchange_strong_explicit(std::memory_order_relaxed) from <atomic> instead
/Users/gapry/Workspace/s2client-api/contrib/protobuf/src/google/protobuf/stubs/atomicops_internals_macosx.h:159:10: 'OSAtomicAdd64' is deprecated: first deprecated in macOS 10.12 - Use std::atomic_fetch_add_explicit(std::memory_order_relaxed) from <atomic> instead
/Users/gapry/Workspace/s2client-api/contrib/protobuf/src/google/protobuf/stubs/atomicops_internals_macosx.h:164:10: 'OSAtomicAdd64Barrier' is deprecated: first deprecated in macOS 10.12 - Use std::atomic_fetch_add() from <atomic> instead
/Users/gapry/Workspace/s2client-api/contrib/protobuf/src/google/protobuf/stubs/atomicops_internals_macosx.h:173:9: 'OSAtomicCompareAndSwap64Barrier' is deprecated: first deprecated in macOS 10.12 - Use std::atomic_compare_exchange_strong() from <atomic> instead
/Users/gapry/Workspace/s2client-api/contrib/protobuf/src/google/protobuf/stubs/atomicops_internals_macosx.h:47:9: 'OSAtomicCompareAndSwap32' is deprecated: first deprecated in macOS 10.12 - Use std::atomic_compare_exchange_strong_explicit(std::memory_order_relaxed) from <atomic> instead
/Users/gapry/Workspace/s2client-api/contrib/protobuf/src/google/protobuf/stubs/atomicops_internals_macosx.h:61:13: 'OSAtomicCompareAndSwap32' is deprecated: first deprecated in macOS 10.12 - Use std::atomic_compare_exchange_strong_explicit(std::memory_order_relaxed) from <atomic> instead
/Users/gapry/Workspace/s2client-api/contrib/protobuf/src/google/protobuf/stubs/atomicops_internals_macosx.h:68:10: 'OSAtomicAdd32' is deprecated: first deprecated in macOS 10.12 - Use std::atomic_fetch_add_explicit(std::memory_order_relaxed) from <atomic> instead
/Users/gapry/Workspace/s2client-api/contrib/protobuf/src/google/protobuf/stubs/atomicops_internals_macosx.h:73:10: 'OSAtomicAdd32Barrier' is deprecated: first deprecated in macOS 10.12 - Use std::atomic_fetch_add() from <atomic> instead
/Users/gapry/Workspace/s2client-api/contrib/protobuf/src/google/protobuf/stubs/atomicops_internals_macosx.h:77:3: 'OSMemoryBarrier' is deprecated: first deprecated in macOS 10.12 - Use std::atomic_thread_fence() from <atomic> instead
/Users/gapry/Workspace/s2client-api/contrib/protobuf/src/google/protobuf/stubs/atomicops_internals_macosx.h:85:9: 'OSAtomicCompareAndSwap32Barrier' is deprecated: first deprecated in macOS 10.12 - Use std::atomic_compare_exchange_strong() from <atomic> instead
/Users/gapry/Workspace/s2client-api/contrib/protobuf/src/google/protobuf/stubs/atomicops_internals_macosx.h:138:9: 'OSAtomicCompareAndSwap64' is deprecated: first deprecated in macOS 10.12 - Use std::atomic_compare_exchange_strong_explicit(std::memory_order_relaxed) from <atomic> instead
/Users/gapry/Workspace/s2client-api/contrib/protobuf/src/google/protobuf/stubs/atomicops_internals_macosx.h:152:13: 'OSAtomicCompareAndSwap64' is deprecated: first deprecated in macOS 10.12 - Use std::atomic_compare_exchange_strong_explicit(std::memory_order_relaxed) from <atomic> instead
/Users/gapry/Workspace/s2client-api/contrib/protobuf/src/google/protobuf/stubs/atomicops_internals_macosx.h:159:10: 'OSAtomicAdd64' is deprecated: first deprecated in macOS 10.12 - Use std::atomic_fetch_add_explicit(std::memory_order_relaxed) from <atomic> instead
/Users/gapry/Workspace/s2client-api/contrib/protobuf/src/google/protobuf/stubs/atomicops_internals_macosx.h:164:10: 'OSAtomicAdd64Barrier' is deprecated: first deprecated in macOS 10.12 - Use std::atomic_fetch_add() from <atomic> instead
/Users/gapry/Workspace/s2client-api/contrib/protobuf/src/google/protobuf/stubs/atomicops_internals_macosx.h:173:9: 'OSAtomicCompareAndSwap64Barrier' is deprecated: first deprecated in macOS 10.12 - Use std::atomic_compare_exchange_strong() from <atomic> instead

I found this problem is one of issue of google protobuf. According the repo structure, it seems to have its own branch of protobuf, not just use official Google branch directly but I am not sure.

Finally, I have tried to use brew to install protobuf, here is my reference step but I still fail.

Include sc2api.pg.h error (in my bot's project file) / precompiled libs rename

In my bot's solution/project file, I am using the precompiled libs download to include and link against

So I am pointing my solution to the "include" folder for the includes, and the "lib" folder for the libs

The error I am getting is from line 5 of sc2_proto_interface.h, which attempts to include sc2api.pb.h, however that file is in another folder so it throws an error on compile

There are two ways to fix this:

  • I could point the compiler at the include/sc2protocol/ directory as well (kind of annoying)
  • Just change that line to #include "../sc2protocol/sc2api.pb.h" which breaks nothing and fixes my problem

I strongly suggest this change, as it removes the need to include multiple header folders

Fetch the map hash

It'd be helpful to get the hash (or whatever unique id) of the current map in the gameinfo data.
Of course, the map is loaded based on what I supply as an argument to the game/API, but it'd feel much less flimsy and be more future-proof to get the actual hash of the map that the game ended up loading.

In my case I'd want this for caching: I spend something like 10 seconds generating all kinds of stuff from the terrain and unit information on game start, which I'd like to cache for next sessions by the map ID.
Especially important in realtime use, since that 10 seconds is subtracted from active play time.

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.