This project is reimplementation of Alphastar (Only Zerg vs Zerg) based on OpenDILab, which contains:
-
Play with trained agent
-
Supervised Learning
-
Reinforcement Learning
- Download the retail version of StarCraftII: https://starcraft2.com
Note: There is no retail version on Linux, please follow the instruction here
-
Add SC2 installation path to environment variables
SC2PATH
(skip this if you use default installation path on MacOS or Windows, which isC:\Program Files (x86)\StarCraft II
or/Applications/StarCraft II
):-
On MacOS or Linux, input this in terminal:
export SC2PATH=<sc2/installation/path>
-
On Windows:
- Right-click the Computer icon and choose Properties, or in Windows Control Panel, choose System.
- Choose Advanced system settings.
- On the Advanced tab, click Environment Variables.
- Click New to create a new environment variable, set
SC2PATH
as the sc2 installation location. - After creating or modifying the environment variable, click Apply and then OK to have the change take effect.
-
git clone https://github.com/opendilab/DI-star.git
cd DI-star
pip install -e .
Pytorch Version 1.7.1 and CUDA is recommended, Follow instructions from pytorch official site
Note: GPU is neccessary for decent performance in realtime agent test, you can also use pytorch without cuda, but no performance guaranteed due to inference latency on cpu. Make sure you set SC2 at lowest picture quality before testing.
python -m distar.bin.download_model --rl
Note: Specify --rl
or --sl
to download reinforcement learning model or supervised model.
With the given model, we provide multiple tests with our agent.
python -m distar.bin.play
It runs 2 StarCraftII instances. First one is controlled by our RL agent. Human player can play on the second one with full screen like normal game.
Note:
- GPU and CUDA is required on default, add
--cpu
if you don't have these. - Download RL model first or specify other models (like supervised model) with argument
--model1 <sl_model_path>
, pass either absolute path or relative path under distar/bin/ - In race cases, 2 StarCraftII instances may lose connection and agent won't issue any action. Please restart when this happens.
python -m distar.bin.play --game_type agent_vs_agent
It runs 2 StarCraftII instances both controlled by our RL Agent, specify other model path with argument --model1 <model1_path> --model2 <model2_path>
python -m distar.bin.play --game_type agent_vs_bot
RL agent plays against built-in elite bot.
@misc{distar,
title={{DI-star: OpenDILab} Decision Intelligence in StarCraftII},
author={DI-star Contributors},
publisher = {GitHub},
howpublished = {\url{https://github.com/opendilab/DI-star}},
year={2021},
}
DI-star released under the Apache 2.0 license.