C++ C Lua CMake Python Shell Other
Clone or download
jgehring Merge pull request #263 from TorchCraft/fix-zstd-windows
Add definition for ssize_t when compiled with MSVC
Latest commit ca34a17 May 15, 2018
Permalink
Failed to load latest commit information.
BWEnv Merge pull request #243 from TorchCraft/sscait-support Jan 2, 2018
client Re-re-re-named FrameUpdate to StateUpdate Nov 30, 2017
config Use 11111 as default port Jan 18, 2017
docker 4.1.2 -> 4.2.0 in dockerfiles and docs Aug 15, 2017
docs Nits + removing Python README since it's merged with the main README Nov 2, 2017
examples Merge pull request #216 from TorchCraft/repo_restructure Nov 2, 2017
include Merge pull request #243 from TorchCraft/sscait-support Jan 2, 2018
lua Merge pull request #226 from TorchCraft/update-flatbuffers Nov 21, 2017
maps Added creep map Jun 15, 2017
py Remove torch from python, fix some compile errors Dec 8, 2017
replayer Add definition for ssize_t when compiled with MSVC May 15, 2018
test Reverted required C++ version to 11 from 14 Nov 29, 2017
.clang-format Edited .clang-format to remove macOS-specific setting Nov 29, 2017
.gitignore Updated BWEnv controller to handle FlatBuffer-serialized frames. Adde… Nov 21, 2017
.gitmodules Use zmq C++ wrapper instead of czmq Oct 17, 2017
CMakeLists.txt Auto: Update version files to v1.4-0 Jan 11, 2018
CONTRIBUTING.md initial commit Dec 3, 2016
LICENSE initial commit Dec 3, 2016
PATENTS initial commit Dec 3, 2016
README.md Nits + removing Python README since it's merged with the main README Nov 2, 2017
quick_setup.sh Auto: Update version files to v1.4-0 Jan 11, 2018
setup.py Auto: Update version files to v1.4-0 Jan 11, 2018
torchcraft-1.4-0.rockspec Auto: Update version files to v1.4-0 Jan 11, 2018

README.md

TorchCraft

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.

Installation

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:

Running TorchCraft

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.

StarCraft Server

Do whichever was installed:

Windows / WINE

  1. Open bwapi.ini and set ai = PATH\TO\BWEnv.dll (or copy ours from config/bwapi.in)
  2. Start ChaosLauncher, enable BWAPI DLL Injector [Release].
  3. Press Start.

WINE

  1. Open bwapi.ini and set ai = PATH\TO\BWEnv.dll (or copy
  2. wine bwheadless.exe -e $STARCRAFT/StarCraft.exe -l $STARCRAFT/bwapi-data/BWAPI.dll --headful as detailed in the WINE docs

OpenBW

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

TorchCraft Client

$ cd examples
$ th lua/simple_dll.lua -t $server_ip
$ python py/example.py -t $server_ip

Other Documentation

Citation

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}
}

Contributing

See Contributing

Also check out the code structure and PR process