Starter bot for StarCraft II with integrated cpp-sc2.
Table of Contents
Feel free to post questions on the unofficial StarCraft II AI Discord server. Invite Link
🚧 This project requires a compiler with C++17 support.
-
Before proceeding further download the actual map pack.
-
Put the downloaded maps into the
Maps
folder (create it if the folder doesn't exist):- Windows:
C:\Program Files\StarCraft II\Maps
- OS X:
/Applications/StarCraft II/Maps
- Linux: anywhere.
- Windows:
For building for Windows under WSL2, see WSL2 Support.
-
Install CMake.
-
Download and install Visual Studio (2017 or newer).
-
Get the project.
git clone git@github.com:cpp-sc2/blank-bot.git
-
Enter the working directory.
cd blank-bot
-
Create Visual Studio project files in the directory "build". E.g. for Visual Studio 2022:
cmake -B build -G "Visual Studio 17 2022"
-
Build the project using Visual Studio.
start build\BlankBot.sln
-
Launch the bot with the specified path to a SC2 map, e.g:
build\bin\Debug\BlankBot.exe Ladder2019Season3/AcropolisLE.SC2Map
-
Install CMake.
-
Install XCode.
-
Install XCode command-line tools.
-
Clone the project.
git clone git@github.com:cpp-sc2/blank-bot.git && cd blank-bot
-
Generate CMake build tree.
cmake -B build
-
Build the project.
cmake --build build --parallel $(nproc)
-
Launch the bot with the specified absolute path to a SC2 map, e.g.:
./build/bin/BlankBot "/home/alkurbatov/Ladder2019Season3/AcropolisLE.SC2Map"
-
Install CMake.
-
Install
gcc-c++
. -
Install the
make
utility. -
Get the project.
git clone git@github.com:cpp-sc2/blank-bot.git && cd blank-bot
-
Generate CMake build tree.
cmake -B build
-
Build the project.
cmake --build build --parallel $(nproc)
-
Launch the bot with the specified absolute path to a SC2 map, e.g.:
./build/bin/BlankBot "/home/alkurbatov/Ladder2019Season3/AcropolisLE.SC2Map"
Cross compiling for Windows under WSL2 is supported through cpp-sc2
. See the cpp-sc2
documentation for build requirements. The build flag remains the same, setting -DWSL2_CROSS_COMPILE=ON
.
By default, the API assumes the latest version of the game client. The assumed version can be found in cmake's output, e.g.:
$ cmake -B build grep 'SC2 version'
Target SC2 version: 5.0.5
...
However, sometimes one may need to compile with an older version of the game, e.g. to play with a Linux build which is always behind the Windows version. It is possible by specifying the game version manually, e.g.:
cmake -B build -DSC2_VERSION=4.10.0
To compile a bot capable to play on the AIArena ladder, configure the project in the following way:
cmake -B build -DBUILD_FOR_LADDER=ON -DSC2_VERSION=4.10.0
BlankBot
uses the CMake FetchContent
module to manage and collect dependencies. To use a version of cpp-sc2
outside of the pinned commit, modify the GIT_REPOSITORY
and/or the GIT_TAG
in cmake/cpp_sc2.cmake
:
...
FetchContent_Declare(
cpp_sc2
GIT_REPOSITORY <target-cpp-sc2-git-rep>
GIT_TAG <git-commit-hash>
)
FetchContent_MakeAvailable(cpp_sc2)
...
With the updated configuration, re-run the build configuration and the dependency will be updated to the new configuration:
cmake -B build
If you see that some of cmake options don't take effect
(e.g. project was configured with cmake -B build -DBUILD_FOR_LADDER=ON
and a bit later with cmake -B build
)
remove the build
folder or the CMakeCache.txt
file, or explicitly re-specify the desired default behavior (e.g. cmake -B build -DBUILD_FOR_LADDER=OFF
).
If project compilation freezes, decrease nproc to 1 or more, e.g.:
cmake --build build --parallel $(nproc --ignore=1)
Copyright (c) 2021-2024 Alexander Kurbatov
Licensed under the MIT license.