Skip to content

v4.0: Add the C++ converters used by AlphaStar

Latest
Compare
Choose a tag to compare
@tewalds tewalds released this 13 Jul 12:08
· 11 commits to master since this release

Add C++ environment converters which handle the conversion between the protos used by SC2 environment for actions, observations and specs to a more neural network friendly dictionary of Numpy arrays, with accompanying environment specs. Converters are built as a translation of relevant pieces from sc2_env.py from Python to C++ for speed.

New features include the following

  • 'Raw' and 'visual' modes are supported explicitly.
  • Actions are represented as simple dicts and have a delay member which specifies how many game loops to wait until the next observation is retrieved.
  • The following new observations are available (parameterised by a config proto, see the converter documentation for more detail):
    • Action chosen (for supervised).
    • Own race requested
    • Unit counts and upgrades.
    • Camera, position and size (for raw, indicates where the camera is and when active also hides unit data outside the camera bounds).
    • Opponent race requested (and observed, once a unit has been seen)
    • Player stats vector, unit counts and upgrades.
    • MMR
  • Minimap and screen features have an observation per plane rather than being stacked.
  • Converters can be used both with Python and C++. The C++ code is wrapped using pybind11 facilitating Python use.
  • Converters have been used in this recent work on StarCraftII Unplugged.
  • Support building with Bazel as converters built on C++ requires compilation for any changes made to them.
    • With converters, PySC2 is a mixed Python and C++ repository.
    • Using setup.py will install the Python only components of the package.
    • Converters require either building with Bazel or can be pulled from pypi. Only Linux is supported at present.
  • Drop Python 2 support, bump minimum version to Python 3.8+
    • Remove references to six, future, whichcraft.which.
    • Fix lint errors arising from py2-> py3 transformation.
  • Fix fickle tests that fail because of obsolete code, proto dependencies, timeout or unavailable maps.
  • Update PySC2 master documentation in line with these changes.
  • Remove unnecessary patches that have been fixed in upstream repos.