A bridge between Torch and StarCraft.
A general overview of the system (and motivations for using TorchCraft) can be found in:
Synnaeve, G., Nardelli, N., Auvolat, A., Chintala, S., Lacroix, T., Lin, Z., Richoux, F. and Usunier, N., 2016. TorchCraft: a Library for Machine Learning Research on Real-Time Strategy Games - arXiv:1611.00625.
Please follow the installation instructions.
You will need to have a license of StarCraft: Brood War.
TorchCraft is a BWAPI module that sends StarCraft data out over a ZMQ connection. This lets you parse StarCraft data and interact with BWAPI from anywhere. The TorchCraft client should be installed from C++, Python, or Lua. We provide off the shelf solutions for Python and Lua:
Requirements:
- zstd-devel 1.1.4
- zeromq 4+
Remember to init submodules: git submodule update --init --recursive
Python setup: pip install pybind11 && pip install .
Lua setup (depends on torch7): luarocks make *.rockspec
We provide an example C++ CMake project in examples/cpp/
The hardest part of installing the server is actually setting up starcraft. We detail three ways of doing this:
See examples/
for a list of scripts that you can try.
In all cases, the $server_ip
is the ip address of the machine running
StarCraft.
Do whichever was installed:
- Open
bwapi.ini
and setai = PATH\TO\BWEnv.dll
(or copy ours fromconfig/bwapi.in
) - Start ChaosLauncher, enable
BWAPI DLL Injector [Release]
. - Press
Start
.
- Open
bwapi.ini
and setai = PATH\TO\BWEnv.dll
(or copy wine bwheadless.exe -e $STARCRAFT/StarCraft.exe -l $STARCRAFT/bwapi-data/BWAPI.dll --headful
as detailed in the WINE docs
Something like:
OPENBW_ENABLE_UI=0 BWAPI_CONFIG_AI__RACE=Terran BWAPI_CONFIG_AI__AI="BWEnv/build/BWEnv.so" BWAPI_CONFIG_AUTO_MENU__AUTO_MENU="SINGLE_PLAYER" BWAPI_CONFIG_AUTO_MENU__MAP=maps/micro/m5v5_c_far.scm BWAPI_CONFIG_AUTO_MENU__GAME_TYPE="USE MAP SETTINGS" TORCHCRAFT_PORT=11111 BWAPILauncher
$ cd examples
$ th lua/simple_dll.lua -t $server_ip
$ python py/example.py -t $server_ip
Please cite the arXiv paper if you use TorchCraft in your work:
@article{synnaeve2016torchcraft,
title={TorchCraft: a Library for Machine Learning Research on Real-Time Strategy Games},
author={Synnaeve, Gabriel and Nardelli, Nantas and Auvolat, Alex and Chintala, Soumith and Lacroix, Timoth{\'e}e and Lin, Zeming and Richoux, Florian and Usunier, Nicolas},
journal={arXiv preprint arXiv:1611.00625},
year={2016}
}
See Contributing
Also check out the code structure and PR process