explaingit

google-deepmind/pysc2

8,284PythonAudience · researcherComplexity · 4/5Setup · hard

TLDR

A Python library from DeepMind that turns StarCraft II into an AI research environment, letting you train reinforcement learning agents to play the game and benchmark them on focused mini-game scenarios.

Mindmap

mindmap
  root((PySC2))
    What it does
      RL research environment
      StarCraft II interface
    Environment Types
      Full game
      Mini-games
      Agent vs agent
    Agent Interface
      Structured game state
      Action commands
      Replay saving
    Setup Requirements
      StarCraft II client
      Python 3.8 plus
      Map files
    Research Use
      Benchmark agents
      Debug with human view
      Published with DeepMind paper
Click or tap to explore — scroll the page freely

Code map

Detail Auto

An interactive map of this repo's files and how they connect — its source is parsed live in your browser. Click Visualize to build it.

filefunction / class

Things people build with this

USE CASE 1

Train a reinforcement learning agent to play StarCraft II and evaluate how well it generalizes strategy.

USE CASE 2

Run focused mini-game benchmarks to test a specific AI behavior, like resource collection or unit movement, without the full game complexity.

USE CASE 3

Pit two AI agents against each other in the same environment to compare different training approaches.

USE CASE 4

Use the human debug interface to step through what an AI agent perceives at each moment and inspect its decision-making.

Tech stack

PythonStarCraft II APIpip

Getting it running

Difficulty · hard Time to first run · 1h+

Requires the StarCraft II game client (v3.16.1+) installed separately, plus mini-game map files downloaded from the releases page.

License terms not specified in the description.

In plain English

PySC2 is a Python library from DeepMind that turns the video game StarCraft II into a testing ground for artificial intelligence research. The idea is that StarCraft II is a complex strategy game with incomplete information, long-term planning requirements, and real-time decision-making, which makes it a challenging and interesting environment for training and evaluating AI agents. The library connects to the actual StarCraft II game client (which must be installed separately, though the free Starter Edition works) and exposes the game as a standard reinforcement learning environment. Reinforcement learning is a technique where an AI learns by taking actions and receiving feedback about whether those actions led to good or bad outcomes. PySC2 gives an AI agent a structured view of the game state, such as positions of units and resources, and accepts structured commands in return. Researchers can run their own AI agents against the game, watch how those agents play, save replays, and use a set of smaller training scenarios called mini-games that isolate specific skills like collecting resources or moving units. These mini-games were designed to test narrower behaviors before tackling the full game. Two agents can also be run against each other in the same environment. A human interface is included as well, primarily for debugging purposes, so a person can step through what the agent sees at each moment and understand why it made particular decisions. The project was a collaboration between DeepMind and Blizzard Entertainment and accompanied a published research paper. Installation is through pip, and it requires Python 3.8 or newer. The full game must be version 3.16.1 or later to include the API that PySC2 depends on. Map files for the mini-games are downloaded separately from the repository's releases page.

Copy-paste prompts

Prompt 1
Using PySC2, write a Python agent class that observes the game state and picks a random valid action each step, the minimal working agent to verify my setup works.
Prompt 2
I want to train an RL agent on the MoveToBeacon mini-game in PySC2. Write a Python script that sets up the environment, runs 100 episodes, and logs the score each time.
Prompt 3
Show me how to launch two PySC2 agents in the same game environment so they compete against each other, using the sc2_env.Agent setup.
Prompt 4
My PySC2 agent keeps crashing on certain game states. Write a wrapper that catches exceptions and saves the observation to a file for later debugging.
Open on GitHub → Explain another repo

← google-deepmind on gitmyhub — every repo by this author, as a profile.

Verify against the repo before relying on details.