Giter Club home page Giter Club logo

di-star's Introduction

DI-star

This project is reimplementation of Alphastar (Only Zerg vs Zerg) based on OpenDILab, which contains:

  • Play with trained agent

  • Supervised Learning

  • Reinforcement Learning

Usage

Installation

1.Install StarCraftII

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 is C:\Program Files (x86)\StarCraft II or /Applications/StarCraft II):

    • On MacOS or Linux, input this in terminal:

      export SC2PATH=<sc2/installation/path>
    • On Windows:

      1. Right-click the Computer icon and choose Properties, or in Windows Control Panel, choose System.
      2. Choose Advanced system settings.
      3. On the Advanced tab, click Environment Variables.
      4. Click New to create a new environment variable, set SC2PATH as the sc2 installation location.
      5. After creating or modifying the environment variable, click Apply and then OK to have the change take effect.

2.Install distar:

git clone https://github.com/opendilab/DI-star.git
cd DI-star
pip install -e .

3.Install pytorch:

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.

Play

1. Download models:

python -m distar.bin.download_model --rl

Note: Specify --rl or --sl to download reinforcement learning model or supervised model.

2. Agent test

With the given model, we provide multiple tests with our agent.

Play against 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.
Agent vs Agent
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>

Agent vs Bot
python -m distar.bin.play --game_type agent_vs_bot

RL agent plays against built-in elite bot.

Citation

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

License

DI-star released under the Apache 2.0 license.

di-star's People

Contributors

liuyuisanai avatar rangilyu avatar upia99 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.