Play games with CherryPi
Once you've compiled CherryPi (Instructions for Linux, Windows, and OSX), here's how to play against it.
(Recommended) Get trained models
If you have an NVIDIA GPU and are using CUDA, you'll want to download the trained models of the Build Order Switcher and the Building Placer.
To enable the trained models, add the command line arguments specified under "Run the client". CherryPi can play without the trained models, but will be at reduced strength.
Run CherryPi
There are several ways to play games with CherryPi.
Linux: Wine
- Install Wine
- Refer to the Windows/Wine ChaosLauncher instructions right below.
Windows/Wine ChaosLauncher
This is the recommanded way to run StarCraft. On a Mac, we recommend running a Linux or Windows VM.
- Install StarCraft 1.16.1 (in Wine if Linux)
- Install BWAPI 4.2.0
- Run
cherrypi.exe -hostname 127.0.0.1
from inside the Starcraft directory.cherrypi.exe
is created in theRelease
folder after build on Windows. - Run
ChaosLauncher.exe
. It's located in the directory where you installed BWAPI - Check
BWAPI Injector 4.2.0 [RELEASE]
- Click on
BWAPI Injector 4.2.0 [RELEASE]
and thenConfig
. This will open bwapi.ini for editing - Under the [ai] section replace
ai =
withai = [PATH\TO\BWEnv.dll]
which should be by default[CherryPi]\bin\BWEnv.dll
- Save the config, and click Start!
- In StarCraft BW, create a custom game. Play as Zerg against one computer opponent.
- To play against the bot, you'll have to launch the game again, and create games in Multiplayer Mode, or use DropLauncher
(All platforms) SC-Docker
Here, SC-Docker will only be used to run StarCraft, the opponent bot, and the TorchCraft server (BWEnv.dll
).
- Install Docker
- Install SC-Docker by cloning the GitHub repo and running
python setup.py install
manually. The version available via pip does not support the use-case described here yet. - Download this bot profile and unzip it in
~/.scbw/bots/
. FYI: this is is just a folder having the necessary DLLs: BWAPI and TorchCraft (BWEnv.dll
), and a minimal json config file. - Run a game using SC-Docker. Example:
scbw.play --bots "TorchCraft" "Steamhammer"
(that only injects the TorchCraft server). - Run the bot with
./cherrypi -hostname 127.0.0.1 [-bos_model bwapi-data/AI/bos_model.bin] [...]
. If on Mac, run the bot with-hostname localhost
.
(All platforms) OpenBW
- Install OpenBW
- Run OpenBW, with BWAPI_CONFIG_AI__AI=/PATH/TO/BWEnv.[so|dll], see TorchCraft's doc.
Set up read/write directories
Create directories for reading/writing game data:
[path-to-cherrypi]/bwapi-data/read
[path-to-cherrypi]/bwapi-data/write
[path-to-cherrypi]/bwapi-data/AI
This directory structure is used in all Brood War AI tournaments.
AI
is typically used for unchanging bot files, and is a good place to put trained Build Order Switcher/Building Placer models if you're using them.
CherryPi records a history of its games to bwapi-data/write
. In future games, to adapt to its opponents, it will attempt to read that data from bwapi-data/read
. We recommend copying the contents of write
to read
between games.
Run the client
CherryPi is a server-client architecture. BWEnv.[so|dll] only starts the server, which will hang the game at the beginning, as it waits for the CherryPi client to connect.
Run the client that you compiled:
- Linux/OSX:
cherrypi
- Windows:
.\Release\cherrypi
Optional: Run CherryPi and StarCraft on separate machines
If you want to run the CherryPi bot client on a different machine (real or virtual) than StarCraft itself:
- Linux/OSX:
cherrypi -hostname [IP ADDRESS] -port [PORT]
- Windows:
.\Release\cherrypi -hostname [IP ADDRESS] -port [PORT]
Specify the IP address of the machine hosting StarCraft, and the port used by TorchCraft (by default, 11111).
Play with trained models
Place the trained models in bwapi-data/AI
. Run CherryPi with these arguments to use the trained models:
cherrypi[.exe] -hostname 127.0.0.1 -port 11111 -bos_model bwapi-data/AI/bos_model.bin -bp_model bwapi-data/AI/bp_model.bin