Skip to main content

Fork Notice

This project is a fork of the original PySC2. The original PySC2 project seems to be no longer actively maintained. The goal of this project is to modernize PySC2 as PySC2_Evolved and to add new features and improvements over the original project. Please note that the changes may be heavily opinionated, but nonetheless, the aim is to support the original interfaces as closely as possible.

PySC2_Evolved - StarCraft II Learning Environment

It exposes Blizzard Entertainment's StarCraft II Machine Learning API as a Python RL Environment. This is a collaboration between DeepMind and Blizzard to develop StarCraft II into a rich environment for RL research. PySC2 provides an interface for RL agents to interact with StarCraft 2, getting observations and sending actions.

We have published an accompanying blogpost and paper, which outlines our motivation for using StarCraft II for DeepRL research, and some initial research results using the environment.

Quick Start Guide

Get PySC2_Evolved

PyPI

The easiest way to get PySC2_Evolved is to use pip:

$ pip install pysc2_evolved

That will install the pysc2_evolved package along with all the required dependencies. virtualenv can help manage your dependencies. You may also need to upgrade pip: pip install --upgrade pip for the pysc2_evolved install to work. If you're running on an older system you may need to install libsdl libraries for the pygame dependency.

Pip will install a few of the binaries to your bin directory. pysc2_play can be used as a shortcut to python -m pysc2_evolved.bin.play.

From Source

Alternatively you can install latest PySC2_Evolved codebase from git master branch:

$ pip install --upgrade https://github.com/Kaszanas/pysc2_evolved/archive/master.zip

or from a local clone of the git repo:

$ git clone https://github.com/Kaszanas/pysc2_evolved.git
$ pip install --upgrade pysc2_evolved/

Get StarCraft II

PySC2_Evolved depends on the full StarCraft II game and only works with versions that include the API, which is 3.16.1 and above.

Linux

Follow Blizzard's documentation to get the linux version. By default, PySC2_Evolved expects the game to live in ~/StarCraftII/. You can override this path by setting the SC2PATH environment variable or creating your own run_config.

Windows/MacOS

Install of the game as normal from Battle.net. Even the Starter Edition will work. If you used the default install location PySC2_Evolved should find the latest binary. If you changed the install location, you might need to set the SC2PATH environment variable with the correct location.

PySC2_Evolved should work on MacOS and Windows systems running Python 3.8+, but has only been thoroughly tested on Linux. We welcome suggestions and patches for better compatibility with other systems.

Get the maps

PySC2_Evolved has many maps pre-configured, but they need to be downloaded into the SC2 Maps directory before they can be played.

Download the ladder maps and the mini games and extract them to your StarCraftII/Maps/ directory.

Run an agent

You can run an agent to test the environment. The UI shows you the actions of the agent and is helpful for debugging and visualization purposes.

$ python -m pysc2_evolved.bin.agent --map_name Simple64

It runs a random agent by default, but you can specify others if you'd like, including your own.

$ python -m pysc2_evolved.bin.agent --map_name CollectMineralShards --agent pysc2_evolved.agents.scripted_agent.CollectMineralShards

You can also run two agents against each other.

$ python -m pysc2_evolved.bin.agent --map_name Simple64 --agent2 pysc2_evolved.agents.random_agent.RandomAgent

To specify the agent's race, the opponent's difficulty, and more, you can pass additional flags. Run with --help to see what you can change.

Play the game as a human

There is a human agent interface which is mainly used for debugging, but it can also be used to play the game. The UI is fairly simple and incomplete, but it's enough to understand the basics of the game. Also, it runs on Linux.

$ python -m pysc2_evolved.bin.play --map_name Simple64

In the UI, hit ? for a list of the hotkeys. The most basic ones are: F4 to quit, F5 to restart, F8 to save a replay, and Pgup/Pgdn to control the speed of the game. Otherwise use the mouse for selection and keyboard for commands listed on the left.

The left side is a basic rendering. The right side is the feature layers that the agent receives, with some coloring to make it more useful to us. You can enable or disable RGB or feature layer rendering and their resolutions with command-line flags.

Watch a replay

Running an agent and playing as a human save a replay by default. You can watch that replay by running:

$ python -m pysc2_evolved.bin.play --replay <path-to-replay>

This works for any replay as long as the map can be found by the game.

The same controls work as for playing the game, so F4 to exit, pgup/pgdn to control the speed, etc.

You can save a video of the replay with the --video flag.

List the maps

Maps need to be configured before they're known to the environment. You can see the list of known maps by running:

$ python -m pysc2_evolved.bin.map_list

Run the tests

If you want to submit a pull request, please make sure the tests pass.

Python tests

Requires a StarCraft II installation (set SC2PATH if non-default):

$ python -m pysc2_evolved.bin.run_tests

Individual test files can be run directly with pytest:

$ python -m pytest src/pysc2_evolved/lib/point_test.py

C++ converter tests

The C++ converter (env/converter/) is built and tested via Bazel. Bazelisk is required — it reads .bazelversion and downloads the correct Bazel binary automatically.

Docker-based (no local Bazelisk required):

Build the dev image once, then run tests or the build inside the container:

$ make docker_build_dev
$ make bazel_test_converter        # runs C++ tests inside the container
$ make bazel_build_converter       # builds converter.so inside the container

Install Bazelisk (one-time, for local builds):

$ curl -Lo /usr/local/bin/bazelisk \
    https://github.com/bazelbuild/bazelisk/releases/latest/download/bazelisk-linux-amd64
$ chmod +x /usr/local/bin/bazelisk

Run all C++ unit tests:

$ make bazel_test_converter_local
# or directly:
$ bazelisk test //src/pysc2_evolved/env/converter/cc:all --test_output=errors

Build the converter .so extension only:

$ make bazel_build_converter_local
# or directly:
$ bazelisk build //src/pysc2_evolved/env/converter/cc/python:converter

The compiled extension is written to bazel-bin/src/pysc2_evolved/env/converter/cc/python/converter.so.


# Environment Details

For a full description of the specifics of how the environment is configured,
the observations and action spaces work read the
[environment documentation](docs/environment.md).

Note that an alternative to this environment is now available which provides
an enriched action and observation format using the C++ wrappers developed
for AlphaStar. See [the converter documentation](docs/converters.md) for more
information.

# Mini-game maps

The mini-game map files referenced in the paper are stored under `pysc2_evolved/maps/`
but must be installed in `$SC2PATH/Maps`. Make sure to follow the download
instructions above.

Maps are configured in the Python files in `pysc2_evolved/maps/`. The configs can set
player and time limits, whether to use the game outcome or curriculum score, and
a handful of other things. For more information about the maps, and how to
configure your own, read the [maps documentation](docs/maps.md).

# Replays

A replay lets you review what happened during a game. You can see the actions
and observations that each player made as they played.

Blizzard is releasing a large number of anonymized 1v1 replays played on the
ladder. You can find instructions for how to get the
[replay files](https://github.com/Blizzard/s2client-proto#downloads) on their
site. You can also review your own replays.

Replays can be played back to get the observations and actions made during that
game. The observations are rendered at the resolution you request, so may differ
from what the human actually saw. Similarly the actions specify a point, which
could reflect a different pixel on the human's screen, so may not have an exact
match in our observations, though they should be fairly similar.

Replays are version dependent, so a 3.16 replay will fail in a 3.16.1 or 3.17
binary.

You can visualize the replays with the full game, or with `pysc2_evolved.bin.play`.
Alternatively you can run `pysc2_evolved.bin.replay_actions` to process many replays
in parallel.

Metadata

Release files for pysc2-evolved 1.1.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pysc2-evolved 1.1.1
File Size Uploaded Provenance Actions
pysc2_evolved-1.1.1.tar.gz 1.2 MB With provenance Details for pysc2_evolved-1.1.1.tar.gz

Built distributions (wheels)

Table of built distributions (wheels) for pysc2-evolved 1.1.1
File Actions
pysc2_evolved-1.1.1-cp313-cp313-win_amd64.whl CPython 3.13 CPython 3.13 Windows x86-64 Details for pysc2_evolved-1.1.1-cp313-cp313-win_amd64.whl
pysc2_evolved-1.1.1-cp313-cp313-manylinux_2_39_x86_64.whl CPython 3.13 CPython 3.13 Linux glibc 2.39+ x86-64 Details for pysc2_evolved-1.1.1-cp313-cp313-manylinux_2_39_x86_64.whl
pysc2_evolved-1.1.1-cp312-cp312-win_amd64.whl CPython 3.12 CPython 3.12 Windows x86-64 Details for pysc2_evolved-1.1.1-cp312-cp312-win_amd64.whl
pysc2_evolved-1.1.1-cp312-cp312-manylinux_2_39_x86_64.whl CPython 3.12 CPython 3.12 Linux glibc 2.39+ x86-64 Details for pysc2_evolved-1.1.1-cp312-cp312-manylinux_2_39_x86_64.whl
pysc2_evolved-1.1.1-cp311-cp311-win_amd64.whl CPython 3.11 CPython 3.11 Windows x86-64 Details for pysc2_evolved-1.1.1-cp311-cp311-win_amd64.whl
pysc2_evolved-1.1.1-cp311-cp311-manylinux_2_39_x86_64.whl CPython 3.11 CPython 3.11 Linux glibc 2.39+ x86-64 Details for pysc2_evolved-1.1.1-cp311-cp311-manylinux_2_39_x86_64.whl

Total release size: 33.1 MB

Release files / pysc2_evolved-1.1.1.tar.gz

Download URL pysc2_evolved-1.1.1.tar.gz
Size 1.2 MB
Tags Source
SHA-256 checksum
How to use checksums
181aafdd2ffcf72e245cf317c48f4c57eb4b3b0ad80e8d1310d9244b9ec3579a
BLAKE2b-256 checksum
How to use checksums
aed93a54955555c3719c47c4158025417cac37e953de6b1e5320e079253b98db
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Apr 17, 2026.

Transparency log

Release files / pysc2_evolved-1.1.1-cp313-cp313-win_amd64.whl

Download URL pysc2_evolved-1.1.1-cp313-cp313-win_amd64.whl
Size 4.2 MB
Tags CPython 3.13 Windows x86-64
SHA-256 checksum
How to use checksums
ca8adc010980052d6df5de31f668ed68b480b50e038a05de83316deab630503b
BLAKE2b-256 checksum
How to use checksums
596c636d5d11226701e896939a3f5f5cc87963d0974ea7fbaf4d34318e870a16
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Apr 17, 2026.

Transparency log

Release files / pysc2_evolved-1.1.1-cp313-cp313-manylinux_2_39_x86_64.whl

Download URL pysc2_evolved-1.1.1-cp313-cp313-manylinux_2_39_x86_64.whl
Size 6.5 MB
Tags CPython 3.13 Linux glibc 2.39+ x86-64
SHA-256 checksum
How to use checksums
912c709577a5797ba9781238a3deb0f7cc55aaa567b3362fea7944a893485263
BLAKE2b-256 checksum
How to use checksums
053ee5d095e0a6e6efbc924f250c40186e862f0b5082e5fbc3af9d611ca04a35
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Apr 17, 2026.

Transparency log

Release files / pysc2_evolved-1.1.1-cp312-cp312-win_amd64.whl

Download URL pysc2_evolved-1.1.1-cp312-cp312-win_amd64.whl
Size 4.2 MB
Tags CPython 3.12 Windows x86-64
SHA-256 checksum
How to use checksums
14a310a7cfcad646b9078e5bb4a8b839ac951fca73794cbb65095cf9dd234e5e
BLAKE2b-256 checksum
How to use checksums
d248afced9c270bd54f39d8778d6d052514a1f3029f03d036a7a99720e8fd6e4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Apr 17, 2026.

Transparency log

Release files / pysc2_evolved-1.1.1-cp312-cp312-manylinux_2_39_x86_64.whl

Download URL pysc2_evolved-1.1.1-cp312-cp312-manylinux_2_39_x86_64.whl
Size 6.5 MB
Tags CPython 3.12 Linux glibc 2.39+ x86-64
SHA-256 checksum
How to use checksums
3052fc513e6fcc9ef30599f03af6711110c518856ec27288697c1d67dcf457c6
BLAKE2b-256 checksum
How to use checksums
131090019b0f0d00b6152ac9d729c12f79c32d741e9e0d5bd527f70b1c3c91b1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Apr 17, 2026.

Transparency log

Release files / pysc2_evolved-1.1.1-cp311-cp311-win_amd64.whl

Download URL pysc2_evolved-1.1.1-cp311-cp311-win_amd64.whl
Size 4.2 MB
Tags CPython 3.11 Windows x86-64
SHA-256 checksum
How to use checksums
9c70e76aef476f51aabec34c4403755eb1082122d46477adf88adc717983f336
BLAKE2b-256 checksum
How to use checksums
446c4cb7e505c6937a877174e9a90193ef7a22cc6a086655d2778025337d3560
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Apr 17, 2026.

Transparency log

Release files / pysc2_evolved-1.1.1-cp311-cp311-manylinux_2_39_x86_64.whl

Download URL pysc2_evolved-1.1.1-cp311-cp311-manylinux_2_39_x86_64.whl
Size 6.5 MB
Tags CPython 3.11 Linux glibc 2.39+ x86-64
SHA-256 checksum
How to use checksums
3089097d88b03425d97ad539e276a24558f39b3b5b6f4d63d285c739df9f481e
BLAKE2b-256 checksum
How to use checksums
3bc428187ff544e3ef697382b06ff33617c64a1a4af9a8500b428f321b5ac490
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Apr 17, 2026.

Transparency log

Security for pysc2-evolved 1.1.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

All 7 files in this release have been uploaded with provenance metadata.

Select from 7 files

Attestation for pysc2_evolved-1.1.1.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Apr 17, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page