It has been adapted to Torchcraft v 1.3.0 and BWAPI v 4.1.2.
It doesn't need torchcraft-py anymore because Torchcraft v 1.3.0 supports python API.
Support python3
Wrap an SimpleBattleEnv for multi_units battle( need to change the game settings:bwapi.ini and add correaponding maps to /Mpas)
reference:
alibaba/gym-starcraf
NoListen/gym-starcraft
Gym StarCraft is an environment bundle for OpenAI Gym. It is based on Facebook's TorchCraft, which is a bridge between Torch and StarCraft for AI research.
-
Install OpenAI Gym and its dependencies.
-
Install TorchCraft and its dependencies. You can skip the torch client part.
-
install /TorchCraft/py.
cd /torchcraft/py pip install -e .
-
Install the package itself:
git clone https://github.com/Kyle1993/gym-starcraft-modified.git cd gym-starcraft-modified pip install -e .
-
Start StarCraft server with BWAPI by Chaoslauncher.
-
Run examples:
cd examples python random_agent.py --ip $server_ip --port $server_port
The
$server_ip
and$server_port
are the ip and port of the server running StarCraft.
-
It's no need to install torchcraft-py
-
Chose BWAPI v4.12, don't forget install BroodWar patch.
-
Replace the map folder
$StarCraft\maps\BroodWar\micro
with the same name folder in my project -
I have supplied some battle map in
\micro
folder,you can chose them by change the bwapi config file:$STARCRAFT/bwapi-data/bwapi.ini
. You can even create new battle maps , But please make sure the env parametermyself_num
andenemy_num
is equal to the content of your map(number of the units you control and number of units computer control) -
The env will return the basic observation data in each step, you should extract the state info you need in you own code.
the observation data look like this{'myself':[M_unit0, M_unit1, ... , M_unitm], 'enemy':[E_unit0, E_unit1, ... ,E_unitn]}
-
Each unit have a 3-dim action, in alibaba code, it is represented like [move_or _attack, degree, distance], I offer a alternative representation [move_or_attack, position_x, position_y]