Kyle1993 / gym-starcraft-modified

5 stars 1 forks source link

Modification

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

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.

Installation

  1. Install OpenAI Gym and its dependencies.

  2. Install TorchCraft and its dependencies. You can skip the torch client part.

  3. install /TorchCraft/py.

    cd /torchcraft/py
    pip install -e .
  4. Install the package itself:

    git clone https://github.com/Kyle1993/gym-starcraft-modified.git
    cd gym-starcraft-modified
    pip install -e .

Usage

  1. Start StarCraft server with BWAPI by Chaoslauncher.

  2. 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.

Some Tips

  1. It's no need to install torchcraft-py

  2. Chose BWAPI v4.12, don't forget install BroodWar patch.

  3. Replace the map folder $StarCraft\maps\BroodWar\micro with the same name folder in my project

  4. 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 and enemy_num is equal to the content of your map(number of the units you control and number of units computer control)

  5. 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]}

  6. 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]