
A tool meant to allow for quick data extraction from StarCraft 2 replay files ".SC2Replay".
Example Usage (Docker)
[!NOTE]
This steps assumes that you have Docker installed on your machine and working.
Additionally, you will either need to pull the docker image from DockerHub or build it locally as described in Build Docker Images.
The easiest way to run this tool is to use the provided Docker image release. Please note that the dependencies directory can be mounted to see what dependency files are downloaded, and what dependency files were pre-seeded with the Docker Image. Other command line options are described in CLI Options.
Commands below showcases the exampe usage of the tool.
Steps:
- Pull the Docker image from DockerHub or Build Docker Images:
docker pull kaszanas/sc2infoextractorgo:latest
- Place your
.SC2Replay files in the directory which you want to mount as the input directory. The default directory for replays within the container is /app/replays/input.
- Pick one of the following commands.
- Run the docker container and mount the entire directory:
docker run -it --rm \
-v </path/to/your/directory>:/app \
sc2infoextractorgo:latest --help
- Run the Docker container and mount specific paths.
Replace the
<path> with the appropriate paths on your system:
docker run -it --rm \
-v </path/to/your/replays>:/app/replays/input \
-v </path/to/your/output>:/app/replays/output \
-v </path/to/your/logs>:/app/logs \
-v </path/to/your/dependencies>:/app/dependencies \
sc2infoextractorgo:latest process json_zip
- When you execute the processing command, please note that you need to pass the appropriate paths to the tool that are withing the container. The default paths are:
- Input directory:
/app/replays/input
- Output directory:
/app/replays/output
- Logs directory:
/app/logs
- Dependency directory:
/app/dependencies
- Additionally the tool outputs some auxiliary files that can be used for debugging purposes. These are created in the main directory of the container
/app/.
[!NOTE]
If you wish to see other files that are generated by the tool, you will have to mount the appropriate directories. The tool generates logs in the logs directory.
Install via Nix
[!NOTE]
Requires Nix with flakes enabled (experimental-features = nix-command flakes).
- Try it / one-off run:
nix run github:Kaszanas/SC2InfoExtractorGo -- process json_zip --input ./replays/input --output ./replays/output
- Imperative install (single user):
nix profile install github:Kaszanas/SC2InfoExtractorGo
- Declarative — flake-based NixOS
configuration.nix: add as a flake input and reference the package in environment.systemPackages:
# flake.nix
inputs.sc2infoextractorgo.url = "github:Kaszanas/SC2InfoExtractorGo";
# configuration.nix
environment.systemPackages = [ inputs.sc2infoextractorgo.packages.${pkgs.system}.default ];
- Declarative — home-manager: same input, referenced from
home.packages:
home.packages = [ inputs.sc2infoextractorgo.packages.${pkgs.system}.default ];
- Non-flake NixOS (
nix-channel-based configs):
environment.systemPackages = [
(builtins.getFlake "github:Kaszanas/SC2InfoExtractorGo").packages.${builtins.currentSystem}.default
];
Example Usage (Local)
[!NOTE]
These steps assume that you downloaded the release binary or you will have to compile the tool from source.
- Place
.SC2Replay files in ./replays/input
- Run
SC2InfoExtractorGo.exe as follows:
SC2InfoExtractorGo.exe process json_zip --input ./replays/input --output ./replays/output
- Verify the output in
./replays/output
- If The output packages do not contain any processed replays, proceed to verify
./logs/.
CLI Commands
The tool is organised into commands. Every command has its own help:
SC2InfoExtractorGo.exe --help
SC2InfoExtractorGo.exe process --help
SC2InfoExtractorGo.exe process json_zip --help
SC2InfoExtractorGo
├── download_deps Download the dependencies (maps) of the input replays without processing them.
├── process Process replays into one of the output formats:
│ ├── json one .json file per replay
│ ├── json_zip .json files inside zip packages, with a summary per package
│ └── single_json all replays in a single all_replays.json array
├── process_replay Process a single replay into JSON, printed to stdout or written to --output.
└── completion Generate a shell autocompletion script.
Flags go after the command. They use two dashes and snake_case (--log_level); the kebab-case spelling (--log-level) is accepted too.
Available to every command:
| Flag |
Default |
Description |
--input |
./replays/input |
Input directory where .SC2Replay files are held. |
--dependency_directory |
./dependencies/ |
Directory where the replay dependencies are downloaded to and read from. |
--max_procs |
number of CPU cores |
Number of logical processor cores used for processing. |
--log_dir |
./logs/ |
Directory which will hold the logging information. |
--log_level |
3 |
Log level from 0-6: Panic - 0, Fatal - 1, Error - 2, Warn - 3, Info - 4, Debug - 5, Trace - 6. |
--with_cpu_profiler |
|
Path to the file where the pprof CPU profile will be saved. If empty, no profiling is performed. |
Available to every process format:
| Flag |
Default |
Description |
--output |
./replays/output |
Output directory for the processed replays. |
--skip_dependency_download |
false |
Skip downloading the replay dependencies, use only what is already in --dependency_directory. |
--perform_integrity_checks |
false |
Run the hardcoded integrity checks on the replays. |
--perform_validity_checks |
false |
Check that replay values are within 'common sense' ranges. |
--perform_cleanup |
false |
Run the cleaning functions of the processing pipeline. |
--perform_player_anonymization |
false |
Anonymize players. Requires a running anonymization server: https://doi.org/10.5281/zenodo.5138313 |
--perform_chat_anonymization |
false |
Anonymize chat messages. |
--perform_filtering |
false |
Filter replays by game mode (see --game_mode_filter). If not set, no filtering is performed. |
--game_mode_filter |
0b11111111 |
Game modes to include, as a binary flag. All game modes: 0b11111111. |
Only for process json_zip:
| Flag |
Default |
Description |
--number_of_packages |
1 |
Number of zip packages to create. Must not exceed the number of input files. |
Processing a single replay
process_replay processes one replay file into one JSON document, for applications that read the output directly.
By default the JSON is printed to stdout, so it can be piped; progress and status messages go to stderr and the log file.
SC2InfoExtractorGo.exe process_replay ./replays/input/game.SC2Replay > game.json
SC2InfoExtractorGo.exe process_replay ./replays/input/game.SC2Replay --output ./replays/output/game.json
| Flag |
Default |
Description |
<file.SC2Replay> (argument) |
|
The replay to process. |
--output |
- (stdout) |
A file path, an existing directory (writes <dir>/<replay name>.json), or - for stdout. |
It accepts the same processing flags as process (--skip_dependency_download, --perform_*, --game_mode_filter) and
the flags available to every command, except --input. If the replay can't be processed, the command exits with a
non-zero code, prints the reason on stderr, and writes no output.
Migrating from 2.x
Version 3 replaced the single flag-driven command with the commands above:
| 2.x |
3.x |
-input ./in -output ./out |
process json_zip --input ./in --output ./out |
-number_of_packages 4 |
process json_zip --number_of_packages 4 |
-number_of_packages 0 |
process json |
-single_json_output |
process single_json |
-only_dependency_download |
download_deps |
-help |
--help (on any command) |
All other flags keep their names but take two dashes, e.g. -log_level 4 becomes --log_level 4.
Dataset Preparation
If You have a pack of replays with nested directories and You would like to automatically flatten the directory structure, We have published a tool that can be used for that, please see SC2DatasetPreparator: https://doi.org/10.5281/zenodo.5296664
Anonymization (Optional)
In order to anonymize the replays please make sure to download and run our open-source implementation of an anonymization server the SC2AnonServerPy: https://doi.org/10.5281/zenodo.5138313
This is required because of the multiprocessing nature of our code that needs to perform synchronization with an existing database of unique toons (player IDs) that are mapped to arbitrary incrementing integer.
Map Translation Support
Existing implementation downloads the maps from the Blizzard servers. This is to normalize the map names to English language. When there is no internet connection available, our tool should fallback to reading the map names from the files placed in the ./dependencies directory.
Filtering Capabilities
Currently the software supports some game mode filtering capabilities which can be used with -game_mode flag.
The flag itself is a binary flag where 0b11111111 is all game modes which is the default.
Other ways to set the flag:
0b00000001: 1v1 Ranked Games
0b00000010: 2v2 Ranked Games
0b00000100: 3v3 Ranked Games
0b00001000: 4v4 Ranked Games
0b00010000: 1v1 Custom Games
0b00100000: 2v2 Custom Games
0b01000000: 3v3 Custom Games
0b10000000: 4v4 Custom Games
License / Dual Licensing
This repository is licensed under GNU GPL v3 license. If You would like to acquire a different license please contact me directly.
Cite Us!
Article
@article{Bialecki2026,
title = {SC2Tools: StarCraft II Toolset and Dataset API},
author = {Białecki, Andrzej
and Białecki, Piotr
and Sowiński, Piotr
and Budziak, Mateusz
and Gajewski, Jan},
doi = {10.21105/joss.08889},
url = {https://doi.org/10.21105/joss.08889},
year = {2026},
publisher = {The Open Journal},
volume = {11},
number = {118},
pages = {8889},
journal = {Journal of Open Source Software}
}
Software
@software{BialeckiExtractor2021,
author = {Białecki, Andrzej and
Białecki, Piotr and
Krupiński, Leszek},
title = {{Kaszanas/SC2InfoExtractorGo: 2.1.3
SC2InfoExtractorGo Release}},
month = {jun},
year = {2022},
publisher = {Zenodo},
version = {2.1.3},
doi = {10.5281/zenodo.5296788},
url = {https://doi.org/10.5281/zenodo.5296788}
}