islamelnabarawy / sc2gym

PySC2 OpenAI Gym Environments
Apache License 2.0
48 stars 14 forks source link
openai-gym pysc2 sc2 starcraft-ii starcraft2

PySC2 OpenAI Gym Environments

OpenAI Gym Environments for the StarCraft II PySC2 environment.

Installation:

After cloning the repository, you can use the environments in one of two ways:

  1. Add the directory where you cloned the repo to your PYTHON_PATH
  2. Install the package in development mode using pip: pip install -e .

If you use the first option, you need to manually make sure the dependencies are installed.

The second option will install the package into your pip environment as a link to the directory, so it will reflect the changes when you git pull or make any changes to the code.

Usage:

You need the following minimum code to run any environment:

Import gym and this package:

import gym
import sc2gym.envs

Import and initialize absl.flags: (this is due to pysc2 dependency)

import sys
from absl import flags
FLAGS = flags.FLAGS
FLAGS(sys.argv)

Create and initialize the specific environment as indicated in the next section.

Available environemnts:

SC2Game:

The full StarCraft II game environment. Initialize as follows:

env = gym.make('SC2Game-v0')
env.settings['map_name'] = '<desired map name>'

Versions:

Notes:

MoveToBeacon:

The MoveToBeacon mini game. Initialize as follows:

env = gym.make('SC2MoveToBeacon-v0')

Versions:

CollectMineralShards:

The CollectMineralShards mini game. Initialize as follows:

env = gym.make('SC2CollectMineralShards-v0')

Versions:

General Notes:


Copyright 2017 Islam Elnabarawy

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.