pysc2
StarCraft II Learning Environment
File Explorer
- BUILD
- BUILD.dm_env
- BUILD.dm_env_rpc
- BUILD.s2protocol
- create_external_repos.bzl
- protobuf.patch
- requirements.txt
- s2clientprotocol.patch
- setup_external_repos.bzl
- bazel.md
- converters.md
- environment.md
- maps.md
- mini_games.md
- __init__.py
- base_agent.py
- BUILD
- no_op_agent.py
- random_agent.py
- scripted_agent.py
- __init__.py
- agent.py
- agent_remote.py
- battle_net_maps.py
- benchmark_observe.py
- benchmark_replay.py
- BUILD
- check_apm.py
- compare_binaries.py
- gen_actions.py
- gen_data.py
- gen_versions.py
- map_list.py
- mem_leak_check.py
- play.py
- play_vs_agent.py
- reencode_replays.py
- replay_actions.py
- replay_info.py
- replay_version.py
- run_tests.py
- update_battle_net_cache.py
- valid_actions.py
- __init__.py
- buffs.proto
- BUILD
- units.proto
- upgrades.proto
- __init__.py
- BUILD
- uint8_lookup.cc
- uint8_lookup_test.py
- __init__.py
- BUILD
- raw_actions.cc
- raw_actions.h
- uint8_lookup.cc
- uint8_lookup.h
- visual_actions.cc
- visual_actions.h
- __init__.py
- BUILD
- converter.cc
- feature_camera_move.pbtxt
- feature_unit_command.pbtxt
- feature_unit_selection_point.pbtxt
- ui_control_group_append.pbtxt
- ui_control_group_recall.pbtxt
- tvt_trunk.pb
- __init__.py
- BUILD
- obs_data1.pbtxt
- __init__.py
- BUILD
- castops.h
- check_protos_equal.h
- convert_obs.cc
- convert_obs.h
- convert_obs_test.cc
- converter.cc
- converter.h
- converter_test.cc
- encode_image_data.h
- features.cc
- features.h
- file_util.cc
- file_util.h
- general_order_ids.cc
- general_order_ids.h
- map_util.cc
- map_util.h
- raw_actions_encoder.cc
- raw_actions_encoder.h
- raw_actions_encoder_test.cc
- raw_camera.cc
- raw_camera.h
- raw_converter.cc
- raw_converter.h
- tensor_util.cc
- tensor_util.h
- unit_lookups.cc
- unit_lookups.h
- unit_lookups_test.cc
- visual_actions.cc
- visual_actions.h
- visual_actions_test.cc
- visual_converter.cc
- visual_converter.h
- visual_converter_test.cc
- __init__.py
- BUILD
- converter.proto
- __init__.py
- BUILD
- converter.py
- converter_test.py
- derive_interface_options.py
- __init__.py
- available_actions_printer.py
- base_env_wrapper.py
- BUILD
- converted_env.py
- converted_env_test.py
- enums.py
- environment.py
- host_remote_agent.py
- lan_sc2_env.py
- mock_sc2_env.py
- mock_sc2_env_comparison_test.py
- mock_sc2_env_test.py
- remote_sc2_env.py
- run_loop.py
- sc2_env.py
- sc2_env_test.py
- replay_01.SC2Replay
- replay_01.skips.txt
- replay_02.SC2Replay
- replay_02.skips.txt
- replay_03.SC2Replay
- replay_03.skips.txt
- replay_04.SC2Replay
- replay_04.skips.txt
- replay_05.SC2Replay
- replay_05.skips.txt
- replay_06.SC2Replay
- replay_06.skips.txt
- replay_07.SC2Replay
- replay_07.skips.txt
- replay_08.SC2Replay
- replay_08.skips.txt
- replay_09.SC2Replay
- replay_09.skips.txt
- __init__.py
- BUILD
- replay_converter.py
- replay_observation_stream.py
- sc2_replay.py
- sc2_replay_test.py
- sc2_replay_utils.py
- sc2_replay_utils_test.py
- __init__.py
- actions.py
- buffs.py
- BUILD
- colors.py
- features.py
- features_test.py
- gfile.py
- image_differencer.py
- image_differencer_test.py
- memoize.py
- metrics.py
- named_array.py
- named_array_test.py
- np_util.py
- np_util_test.py
- point.py
- point_flag.py
- point_test.py
- portspicker.py
- portspicker_test.py
- proto_diff.py
- proto_diff_test.py
- protocol.py
- remote_controller.py
- renderer_ascii.py
- renderer_human.py
- replay.py
- resources.py
- run_parallel.py
- run_parallel_test.py
- sc_process.py
- static_data.py
- stopwatch.py
- stopwatch_test.py
- transform.py
- units.py
- upgrades.py
- video_writer.py
- BuildMarines.SC2Map
- CollectMineralsAndGas.SC2Map
- CollectMineralShards.SC2Map
- DefeatRoaches.SC2Map
- DefeatZerglingsAndBanelings.SC2Map
- FindAndDefeatZerglings.SC2Map
- MoveToBeacon.SC2Map
- __init__.py
- BUILD
- ladder.py
- lib.py
- melee.py
- mini_games.py
- __init__.py
- BUILD
- lib.py
- platforms.py
- __init__.py
- actions_test.py
- BUILD
- debug_test.py
- dummy_observation.py
- dummy_observation_test.py
- easy_scripted_test.py
- general_actions_test.py
- host_remote_agent_test.py
- multi_player_env_test.py
- multi_player_test.py
- obs_spec_test.py
- obs_test.py
- observer_test.py
- ping_test.py
- protocol_error_test.py
- random_agent_test.py
- render_test.py
- replay_obs_test.py
- step_mul_override_test.py
- utils.py
- versions_test.py
- __init__.py
- BUILD
- build_defs.bzl
- .gitignore
- CONTRIBUTING.md
- LICENSE
- README.md
- setup.py
- WORKSPACE
# Installation Guide
python- Python 3.8+
- StarCraft II 3.16.1+
- libsdl (Linux)
Setup Steps
pip install pysc2
Install PySC2 and dependencies using pip.
python -m pysc2.bin.agent --map Simple64
Run a default agent to test the environment.
Video Guides
DeepMind open source PySC2 toolset for Starcraft II
StarCraft II mini games for AI research
Key Commands
pip install pysc2
Install the PySC2 package and its Python dependencies.
python -m pysc2.bin.agent --map Simple64
Run an agent in the StarCraft II environment with a specified map.
python -m pysc2.bin.play --map Simple64
Launch the UI to play the game as a human or watch replays.
python -m pysc2.bin.map_list
List all configured maps available in the environment.
python -m pysc2.bin.run_tests
Run the project test suite.
# Use via CDN
jsDelivrjsDelivr serves any public GitHub repository as a CDN with zero setup. Pick a version and a file to get a ready-to-paste link and snippet.
Release Timeline
- 2022-07-13 v4.0: Add the C++ converters used by AlphaStar
- 2019-09-27 v3.0
- 2018-06-08 Version 2.0.1
- 2018-06-08 Version 2.0
- 2017-10-12 Version 1.2
- 2017-08-09 Initial release
Command Glossary
Commands referenced in this DOCs, explained below.
git clone
View Details ▼
git clone
Clone an existing repository.
git clone {{remote_repository_location}} {{path/to/directory}}
Clone an existing repository into a new directory (the default directory is the repository name):
git clone --recursive {{remote_repository_location}}
Clone an existing repository and its submodules:
git clone {{[-n|--no-checkout]}} {{remote_repository_location}}
Clone only the `.git` directory of an existing repository:
pip install
View Details ▼
pip install
Install Python packages.
pip install {{package1 package2 ...}}
Install one or more packages:
pip install {{package1 package2 ...}} {{[-U|--upgrade]}}
Upgrade all specified packages to the latest version, installing any that are not already present:
pip install {{package}}=={{version}}
Install a specific version of a package:
python
View Details ▼
python
Python language interpreter.
python
Start a REPL (interactive shell):
python {{path/to/file.py}}
Execute a specific Python file:
python -i {{path/to/file.py}}
Execute a specific Python file and start a REPL:
