Package: cython-extensions-sc2
cython-extensions-sc2API Documentation- for a full list of included functions.cython-extensions-sc2is a library designed for thepython-sc2API.
Its purpose is to offer optimized Cython alternatives for commonly used functions,
along with additional useful custom functions.Note: This library is included forares-sc2users by default, no further setup is required.For bot authors who have a working development environment forpython-sc2orsharpy-sc2,
there are no additional requirements. Simply check out the releases, download the appropriate zip for your system,
and place the cython_extensions
folder in your bot's root directory. Each release includes a binary that is compatible with the ai-arena
ladder, making it ready for deployment.Example speedups, results may vary depending on machine and exact scenario.
This is by no means a list of all functionality offered.functionspeedupunits.closest_to6.85 - 13x speedup depending on scenariodistance_to3 to 7x speedup depending on scenarioposition.center2x speedupalready_pendingfor units6.62x speedupunits.in_attack_range2.05x speedupunits.sorted_by_distance_to8.62x speedupunit.is_facing9.1x speedupPoint2.towards14.29x speedupTip: usecy_distance_to_squaredwhere possible for extra 1.3x speedup.Getting startedNote: currently only python 3.11 is supported unless you clone the project and compile it yourself, more
versions will be supported in the future.To quickly get up and running locally, install with:pip install cython-extensions-sc2But when shipping to ladder, grabubuntu-latest_python3.11.zipfrom releases in this repo
and extractcython_extensionsdirectory within the zip to the root of your bot's directory.Bot developerIf you already have apython-sc2, orsharpy-sc2development environment setup,
thencython-extensionsshould work out the box with your bot. Simply check out the releases on this
repo and download the correctzipfor your system.For example a Windows user should downloadwindows-latest_python3.11.zip.Inside this zip you will find acython_extensionsdirectory, this should be placed in your bot's root directory
like so:MyBot
└───cython_extensions
│   └───cython-extensions library files
└───your bot files and directoriesFor ease of use all cython functions are importable via the main module, for example:fromcython_extensionsimportcy_distance_to,cy_attack_ready,cy_closest_tonote: in this project all library functions have acy_prefix to prevent confusion with python alternatives.Contributor / Cloning the projectInstallpoetryRunpoetry installThis will set up a new environment, install all required dependencies and compile the cython code for your system.If you modify the cython code, runpoetry buildto compile it.ContributingContributors are very welcome! There are many missing alternativepython-sc2functions, and if you're
into optimization, the existing functions could likely be improved.Please useconventional commitsif you choose to contribute,
it helps the automatic releases detect
a new version and generates an accurate changelog.Example git messages:feat: add new cython functionfix: fixed buggy functiontest: add new testci: update github workflowdocs: add new docschore: add dependency