Skip to main content

PyPI Build Status Coverage Status Crates.io

Starcraft 2 Scenario Simulator

About

This package's purpose to enable an interface for multiple players with various Starcraft 2 agents to play a variety of pre-built or generated scenarios. The uses of this package are diverse, including AI agent training.

Editor Screenshots

editor -- roach is having a bad day reapers vs lurkers big choke battle

Example simulator gameplay

(Reserved)

Status

This package is in beta testing. Reference the defined issues to get a better idea of what is and is not working. If something is discovered to not be working, kindly do submit a new issue!

Rationale: Why Create this Repository?

While a variety of situations can be encountered over the course of many, many melee games, there are several problems with this approach. Specific situations occur infrequently, possibly once in the course of a match (which normally elapses ~20 minutes, up to over an hour at realtime speed) and may not occur even once in many hundreds of matches. This makes training difficult, slow and require significantly more data.

By allowing situations to be created artificially, the user may test their agent's functionality against it. A specific battery of tests can be created to compare performance of implementations against each other. It also allows for a specific type of situation to be created and tested quickly with slight variations to enhance the player's learing speed.

Functionality

Brief Overview

  1. The simulator is invoked with specific options.

    • The scenario mini-editor: if the editor is invoked using --editor, a mini-editor appears to create or modify a scenario for play. Unless the option is selected to also play the specified scenario, the editor closes.

    • Regression testing: when specifying --regression, a predefined battery of test scenarios is run using same functionality as custom games except scenario selection criteria are ignored in favor of each predefined scenario setup.

    • Custom Scenarios: The --custom option allows a player to set up a specific scenario to test, including the opponent's setup. Each agent joins an existing scenario by using the --join option.

    • Join: The --join option allows a player to specify at most its own agent and optionally its required opponent. All other parameters of the scenario are determined by the scenario creator.

  2. Each player connects to the game automatically via the sc2gameLobby package. This occurs by default over Versentiedge's public matchmaking ladder server.

  3. Once in-game, the scenario is setup.

    • if upgrades are specified, each player's client controller creates the tech producing units and (with cheats enabled) automatically researches the scenario-specified upgrades. This will elapse at most an additional 21 seconds on top of the specified scenario duration. (This is required due to behavior in Blizzard's API protocol.)

    • The host removes existing units and then creates the units as specified by the scenario.

  4. gameplay continues for as long as is specified using the --duration option.

  5. the scenario can be repeated multiple times as specified using the --loops option. Steps 2-4 are repeated for each loop of the same scenario.

  6. A replay is saved locally by each player for each scenario iteration.

Example Commands

python -m sc2simulator --editor --mapname=parasite

python -m sc2simulator --custom --unitsMax=7 --ground --players=defaulthuman,blizzbot5_hard --ladder=True

python -m sc2simulator --race=zerg --enemyrace=terran --defense=3 --year=2018 --season=3 --players=defaulthuman,blizzbot5_hard

python -m sc2simulator --cases=<yourScenarioName> --mapname=MechDepot --players=test,blizzbot5_hard

NOTE: selecting player 'test' or 'defaulthuman' will allow you to play as a human. Playing with your own custom agent requires additional player setup to define the agents setup and execution/callback functions.

Cautions

  • If your installed Starcraft 2 Maps directory (e.g. C:\Program Files (x86)\Starcraft II\Maps), these maps can be deleted by the editor. Maps of the same name in subfolders beneath Maps... are safe.

  • Including tech upgrades and some features (such as balancing on mineral cost, unit dps, etc.) are only available if you have also access to the sc2techTree package. If interested, petition @ttinies.

  • When playing with your AI/bot, your bot may need to wait a few moments in-game before the scenario is fully setup.

Metadata

Release files for sc2simulator 0.8.2

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

Source distribution (sdist)

Source distribution for sc2simulator 0.8.2
File Size Uploaded Provenance
sc2simulator-0.8.2.tar.gz 1.3 MB Without provenance Details

Built distributions (wheels)

Table of built distributions (wheels) for sc2simulator 0.8.2
File Interpreter ABI Platform
sc2simulator-0.8.2-py3.6.egg Legacy Egg format - - Details
sc2simulator-0.8.2-py3-none-any.whl Python 3 none any Details

Total release size: 4.0 MB

Release files / sc2simulator-0.8.2.tar.gz

Download URL sc2simulator-0.8.2.tar.gz
Size 1.3 MB
Tags Source
SHA-256 checksum
How to use checksums
ef989ee9bfeaa1e77dd165aed434614ee14564b159c3f54790b153dcb4d549a6
BLAKE2b-256 checksum
How to use checksums
d18f2b6abbadf51bd7e4270e10cd9fea0ccb6798ac37d60ca978e119f88c0fcb
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.11.0 pkginfo/1.4.2 requests/2.19.1 setuptools/39.2.0 requests-toolbelt/0.8.0 tqdm/4.23.4 CPython/3.6.6

Release files / sc2simulator-0.8.2-py3.6.egg

Download URL sc2simulator-0.8.2-py3.6.egg
Size 1.4 MB
Tags Egg
SHA-256 checksum
How to use checksums
d936aa8a197a0aa3b54dda6ed32aa3ee8a034329cd6a198dd4f326cc13b12e07
BLAKE2b-256 checksum
How to use checksums
fc49d9716a6bc886446973ec12180820178268d04629bb389b1284d65c012e56
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.11.0 pkginfo/1.4.2 requests/2.19.1 setuptools/39.2.0 requests-toolbelt/0.8.0 tqdm/4.23.4 CPython/3.6.6

Release files / sc2simulator-0.8.2-py3-none-any.whl

Download URL sc2simulator-0.8.2-py3-none-any.whl
Size 1.3 MB
Tags Python 3
SHA-256 checksum
How to use checksums
d60056902c2535cd8a56ef59708c7faee552636152be4da3b0ac510b9514d71e
BLAKE2b-256 checksum
How to use checksums
068c6d4a44f864c648c30301f51f4ec429ed2e99d910478cceb9db1c6b226f3d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.11.0 pkginfo/1.4.2 requests/2.19.1 setuptools/39.2.0 requests-toolbelt/0.8.0 tqdm/4.23.4 CPython/3.6.6

Security for sc2simulator 0.8.2

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.

No provenance found

None of the files in this release were uploaded with provenance metadata.

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