pybrood

Broodwar API binding


Keywords
bwapi, starcraft, broodwar, ai, binding, python
License
MIT
Install
pip install pybrood==0.9.2

Documentation

Pybrood

docs

Binding made as from-scratch code generator, outputting msvc project.

Precompiled installation

Requirements:

  • Windows 7 32 bit (just exactly SSCAIT requirement) NOTE: I couldn't successfully run BWAPI injector under Wine, although recently I've been told it's possible.
  • Python 3.5
  • Installed BWAPI and SC
pip install pybrood

Documentation

Read the docs

Compiling from source

Additional requirements:

Building BWAPI.lib and BWAPIClient.lib

You may experience "access denied" errors while working directly in "program files/BWAPI". Better use separately cloned git repo of BWAPI where you have full access.

For msbuild invocation use special VC++ related cmd shell from Launch menu. Otherwise you can use usual cmd shell.

  1. Make some changes in bwapi source files first:

    • disable mass file copying in bwapi/BWAPILIB/BWAPILIB.vcxproj:

      • line 64: <PreLinkEvent> → <!-- PreLinkEvent>
      • line 94: </PreLinkEvent> → </PreLinkEvent -->
    • create file bwapi/svnrev.h:

      Figure out revision number:

      cd bwapi
      echo $(( $(git rev-list HEAD --count) + 2383 ))
      static const int SVN_REV = 4708;
      #include "starcraftver.h"

      This prevents "Client and Server are not compatible" error.

  2. Build BWAPI.lib:

    cd bwapi\BWAPILIB\
    msbuild /p:PlatformToolset=v140 /p:Configuration=Release /p:Platform=Win32
    

    Output file is bwapi/lib/BWAPI.lib.

  3. Build BWAPIClient.lib:

    cd bwapi\BWAPIClient\
    msbuild /p:PlatformToolset=v140 /p:Configuration=Release /p:Platform=Win32
    

    Output file is bwapi/lib/BWAPIClient.lib.

Building Pybrood

  1. pip install -r generator/requirements.txt
  2. Setup paths in generator/config.py.
  3. Run the generator python3.5 -m generator.
  4. cd to freshly generated output folder and run build.bat (it's just the same msbuild command).
  5. Copy/symlink output/Release/inner.pyd into pybrood directory. inner.pyd is a required submodule of pybrood.
  6. Now you should be able to import pybrood.
  7. Optionally you can build your local copy of documentation:
    cd output/docs/
    sphinx-build . -b html _build/html