Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feature(rjy): add smac env #171

Open
wants to merge 8 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
58 changes: 58 additions & 0 deletions zoo/smac/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
## PYSC2 Env
SMAC (StarCraft Multi-Agent Challenge) is an environment used for multi-agent reinforcement learning research based on the popular real-time strategy game StarCraft II. It provides a suite of tasks where agents need to cooperate to achieve specific objectives. This environment is widely used to benchmark the performance of multi-agent learning algorithms. LightZero use modified pysc2 env (for more maps and agent vs agent training).

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

SMAC 和 pysc2 加上超链接

### Installation

To install the modified PySC2 environment for more maps and agent vs. agent training, follow these steps:

1. **Install StarCraft II:**
```bash
# Create a conda environment
conda create -n ace python=3.8
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ace 换成 lightzero-smac ?


# Activate the environment
conda activate ace

# Download StarCraft II
wget https://blzdistsc2-a.akamaihd.net/Linux/SC2.4.10.zip

# Unzip the downloaded file
unzip SC2.4.10.zip

# Set the SC2 path
export SC2PATH="StarCraftII"
```

2. **Install dependencies:**
```bash
# Install PySC2 and Protobuf
pip install pysc2 protobuf==3.19.5
Copy link
Collaborator

@puyuan1996 puyuan1996 Jun 12, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

我的mac本地protobuf==3.20.0测试的报错少一些,你保证按照这里的方式能成功通过测试就好哈

```

### Testing the Installation

To ensure the environment is correctly installed and functional, you can run the tests provided in the LightZero repository:

1. **Navigate to the LightZero directory:**
```bash
cd LightZero/zoo/smac/envs
```

2. **Run the tests using pytest:**
```bash
pytest test_smac_env.py
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

smac


### Environment Requirements

- **Operating System:** Linux (recommended)
- **Python Version:** >=3.8
- **Dependencies:**
- StarCraft II (version 4.10)
- PySC2
- Protobuf (version 3.19.5)

Make sure your system meets these requirements before proceeding with the installation.

### DI-engine Baselines

For more information on DI-engine baselines for SMAC, refer to the following link: [DI-engine SMAC Baselines](https://github.com/opendilab/DI-engine/blob/main/dizoo/smac/README.md)
Empty file added zoo/smac/__init__.py
Empty file.
7 changes: 7 additions & 0 deletions zoo/smac/envs/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import warnings
Copy link
Collaborator

@puyuan1996 puyuan1996 Dec 22, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

增加一下SMAC 在 SEZ/EZ independent learning 上的可运行config


try:
from .smac_env_ace import SMACACEEnv
except ImportError:
warnings.warn("not found pysc2 env, please install it")
SMACEnv = None
15 changes: 15 additions & 0 deletions zoo/smac/envs/maps/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# Notes on Two Player Maps

Before starting, you need to do the following things:
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Two Player Maps具体相对SMAC_Maps的区别是什么?这个文档更新一下吧


1. copy the maps in `maps/SMAC_Maps_two_player/*.SC2Map` to the directory `StarCraft II/Maps/SMAC_Maps_two_player/`.
2. copy the maps in `maps/SMAC_Maps/*.SC2Map` to the directory `StarCraft II/Maps/SMAC_Maps/`.

A convenient bash script is:

```bash
# In linux
cp -r SMAC_Maps_two_player/ ~/StarCraftII/Maps/
cp -r SMAC_Maps/ ~/StarCraftII/Maps/
```

Binary file added zoo/smac/envs/maps/SMAC_Maps/10m_vs_11m.SC2Map
Binary file not shown.
Binary file added zoo/smac/envs/maps/SMAC_Maps/1c3s5z.SC2Map
Binary file not shown.
Binary file added zoo/smac/envs/maps/SMAC_Maps/25m.SC2Map
Binary file not shown.
Binary file added zoo/smac/envs/maps/SMAC_Maps/27m_vs_30m.SC2Map
Binary file not shown.
Binary file added zoo/smac/envs/maps/SMAC_Maps/2c_vs_64zg.SC2Map
Binary file not shown.
Binary file added zoo/smac/envs/maps/SMAC_Maps/2m_vs_1z.SC2Map
Binary file not shown.
Binary file added zoo/smac/envs/maps/SMAC_Maps/2m_vs_3m.SC2Map
Binary file not shown.
Binary file added zoo/smac/envs/maps/SMAC_Maps/2s3z.SC2Map
Binary file not shown.
Binary file added zoo/smac/envs/maps/SMAC_Maps/2s_vs_1sc.SC2Map
Binary file not shown.
Binary file added zoo/smac/envs/maps/SMAC_Maps/3m.SC2Map
Binary file not shown.
Binary file added zoo/smac/envs/maps/SMAC_Maps/3m_vs_4m.SC2Map
Binary file not shown.
Binary file added zoo/smac/envs/maps/SMAC_Maps/3s5z.SC2Map
Binary file not shown.
Binary file added zoo/smac/envs/maps/SMAC_Maps/3s5z_vs_3s6z.SC2Map
Binary file not shown.
Binary file added zoo/smac/envs/maps/SMAC_Maps/3s_vs_3z.SC2Map
Binary file not shown.
Binary file added zoo/smac/envs/maps/SMAC_Maps/3s_vs_4z.SC2Map
Binary file not shown.
Binary file added zoo/smac/envs/maps/SMAC_Maps/3s_vs_5z.SC2Map
Binary file not shown.
Binary file added zoo/smac/envs/maps/SMAC_Maps/4m_vs_5m.SC2Map
Binary file not shown.
Binary file added zoo/smac/envs/maps/SMAC_Maps/5m_vs_5m.SC2Map
Binary file not shown.
Binary file added zoo/smac/envs/maps/SMAC_Maps/5m_vs_6m.SC2Map
Binary file not shown.
Binary file added zoo/smac/envs/maps/SMAC_Maps/6h_vs_8z.SC2Map
Binary file not shown.
Binary file added zoo/smac/envs/maps/SMAC_Maps/6m_vs_7m.SC2Map
Binary file not shown.
Binary file added zoo/smac/envs/maps/SMAC_Maps/8m.SC2Map
Binary file not shown.
Binary file added zoo/smac/envs/maps/SMAC_Maps/8m_vs_9m.SC2Map
Binary file not shown.
Binary file added zoo/smac/envs/maps/SMAC_Maps/MMM.SC2Map
Binary file not shown.
Binary file added zoo/smac/envs/maps/SMAC_Maps/MMM2.SC2Map
Binary file not shown.
Empty file.
Binary file added zoo/smac/envs/maps/SMAC_Maps/bane_vs_bane.SC2Map
Binary file not shown.
Binary file added zoo/smac/envs/maps/SMAC_Maps/corridor.SC2Map
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file added zoo/smac/envs/maps/SMAC_Maps_two_player/3m.SC2Map
Binary file not shown.
Binary file not shown.
Empty file.
Empty file added zoo/smac/envs/maps/__init__.py
Empty file.
Loading