PySC1 Learning Environment
pysc1-gym
StarCraft I Learning Environment
View on GitHub Download .zip Download .tar.gzPysc1-gym
Installing and managing Starcraft I learning environment can be tedious and full of errors. Here, I present to you packaged way of running a nice Starcraft I gym simulation in your laptop or some clusters.
I was using Windows 10 while making this work, so the instructions are made in reference to the Windows system.
“OpenAI Gym” like code for Starcraft I
After the Environment is set, you can access the features of Starcraft I just like in OpenAI Gym:
env = sc.SingleBattleEnv(args.ip, args.port)
env.seed(777)
agent = RandomAgent(env.action_space)
episodes = 0
while episodes < 100:
obs = env._reset()
done = False
while not done:
action = agent.act()
obs, reward, done, info = env._step(action)
episodes += 1
env.close()
prerequisites
- OpenAI Gym
- Starcraft 1.1.16
- BWAPI 4.1.2
- TorchCraft 1.0.2
- TorchCraft-py
- Gym-TorchCraft
Because of the dependencies here, Python 2.7 is used. In the future, support for Python 3.6+ would be added.
- Python 2.7
I recommend using
conda create -n "pysc1-gym" python=2.7
to manage separate packages.
Get the TorchCraft 1.0-2 from here
check to prerequisites again. For start, git clone https://github.com/openai/gym
and cd gym
and pip install -e .
for minimal install of gym.
Installation (Windows 10 with Anaconda)
The installation process is long, but it should be lot shorter than doing this from scratch. So relax and slowly follow the steps. Take a deep breath…
-
activate pysc1-gym
to activate the environment. -
Check your Starcraft Installation. The directory is called
$STARCRAFT
. -
run
pysc1-gym/bwapi/BWAPI_412_Setup.exe
and install on$BWAPI
directory and run$BWAPI/Chaoslauncher/Chaoslauncher.exe
that is inside the BWAPI installation location. -
From Settings in
Chaoslauncher
, choose the path to the Starcraft installation directory$STARCRAFT
.4.1. Full Installation
4.2. The Abyss (ICCUP) and Games Podolsk are optional
-
copy files in
pysc1-gym/torchcraft/*.dll
to$STARCRAFT
directory. -
copy files in
pysc1-gym/config/*.ini
to$STARCRAFT/bwapi-data
directory -
run
pysc1-gym/install.bat
(while still inside thepysc1-gym
environment). This will install custom dependenciestorchcraft-py
andgym-starcraft
. (Check if no existing installations are there in the pysc1-gym env.) This will take some time installing the dependencies. wait patiently… have a coffee. -
copy contents of
pysc1-gym/maps/
to$STARCRAFT/maps/
. -
run Chaoslauncher with
BWAPI 4.1.2 injector [RELEASE]
andW-mode 1.02
checked. The Starcraft window will open in waiting mode.Don’t panic if the window is not responsive. It’s supposed to be that way!
-
cd
pysc1-gym/examples
(while still inside thepysc1-gym
environment) and runpython random_agent.py --ip=localhost --port=11111
Custom Maps for Reinforcement Learning
Custom maps I created for diverse RL environments.
BroodWar/Micros
- bc12v12_c_far.scx 12 Battlecruisers against each other
- m24v24_c_far_mod.scx 24 Marines against each other
- zt12v12_j_far.scm 11 Zealots and a High Templar against each other
TODO
- support python 3.6+
- more easy installation.