diff --git a/README.md b/README.md index cc8d01c..f37d7ed 100644 --- a/README.md +++ b/README.md @@ -1,8 +1,4 @@ -# SC2MapAnalysis - - -* ![build](https://github.com/eladyaniv01/SC2MapAnalysis/workflows/Build/badge.svg?branch=master) - [master](https://github.com/eladyaniv01/SC2MapAnalysis/tree/master) +# SC2MapAnalysis * ![](https://img.shields.io/github/package-json/v/eladyaniv01/SC2MapAnalysis?color=blue&logo=EladYaniv01&style=plastic) [Changelog](https://github.com/eladyaniv01/SC2MapAnalysis/blob/master/CHANGELOG.md) @@ -33,7 +29,7 @@ Check out his work More Examples reside in the [Documentation](https://eladyaniv01.github.io/SC2MapAnalysis/) -See [here](./examples/MassReaper/README.md) for an example reaper bot showing pathing and influence in action. +See [here](./examples/MassReaper/README.md) for an example `MapAnalyzer` reaper bot showing pathing and influence in action. Example: ```python @@ -73,13 +69,19 @@ map_data.plot_map() - Tested Maps ( [AiArena](https://ai-arena.net/) ) : See `MapAnalyzer/pickle_game_info` for all tested maps. # Getting Started ## Bot Authors +If you already have a [BurnySc2](https://github.com/BurnySc2/python-sc2/) development environment setup, you're likely +equipped with all the necessary dependencies Therefore, integrating MapAnalyzer into your existing bot is a +straightforward process requiring just a few simple steps. + +If you're a new bot author, please set up a new [BurnySc2](https://github.com/BurnySc2/python-sc2/) bot development +environment before installing `MapAnalyzer`. + ### Installation 1. Clone or download this repo @@ -94,32 +96,55 @@ MyBot 3. MapAnalyzer relies on a pathing extension written in C, this can be built locally or downloaded from github actions. If you're on a debian based OS you may be able to skip this step as the repo contains a linux binary already included -in the `MapAnalyzer` folder. - -#### Method 1: Without build tools +in the `MapAnalyzer` folder.

+Method 1: Without needing C++ build tools

Check the most recent [BuildCExtension](https://github.com/spudde123/SC2MapAnalysis/actions/workflows/build_c_extension.yml) Github Action workflow. Then scroll to the bottom to download the artifact for your OS: - ![c_workflow](https://github.com/spudde123/SC2MapAnalysis/assets/63355562/65e08208-8f82-44ee-bf84-3b79d1271d76) - -Download the artifact and copy the binary to `MapAnalyzer/cext/` - -#### Method 2: Build the project locally +
+Download the artifact and copy the binary to `MyBot/MapAnalyzer/cext/`

+Method 2: Build the project locally
+If you're on Windows, make sure [Microsoft C++ Build Tools](https://visualstudio.microsoft.com/visual-cpp-build-tools/) +are installed before proceeding, then: - Install [Poetry](https://python-poetry.org/) for example: `pip install poetry` - In the root folder of this repo run the following: `poetry install` +

+If successful this will compile a binary in the build directory, for example: +`SC2MapAnalysis\build\lib.win-amd64-cpython-311\mapanalyzerext.cp311-win_amd64.pyd` +
+Copy this binary to `MyBot/MapAnalyzer/cext/mapanalyzerext.cp311-win_amd64.pyd` + +4. In your bot initiate the `MapAnalyzer` module: +```python +from MapAnalyzer import MapData +from sc2.bot_ai import BotAI -If successful this will compile a binary in the root directory, for example `SC2MapAnalysis/mapanalyzerext.cp311-win_amd64` +class MyBot(BotAI): + map_data: MapData + + async def on_start(self) -> None: + self.map_data = MapData(self) + + async def on_step(self, iteration: int): + pass +``` -Copy the binary to `MapAnalyzer/cext/` +5. Uploading to [AiArena](https://ai-arena.net/) and tournaments -
+No further setup is required, just include the `MapAnalyzer` folder in your bot zip. ## Contributors or to run examples If you're interested in contributing or would like to run tests then the full dev environment should be setup: 1. Install [Poetry](https://python-poetry.org/) for example: `pip install poetry` -2. `poetry install --with dev` -3. Check example bot: +2. `poetry install --with dev` - This will install all development dependencies, build the C extension +and create a new environment. +Useful poetry environment commands:
+`poetry env list --full-path -` - Use this to configure your IDE to recognise the environment
+`poetry env remove `
+`poetry shell` +3. Check your environment is working by running the example bot:
`poetry run examples/MassReaper/run.py` ### Run tests @@ -130,11 +155,11 @@ If you're interested in contributing or would like to run tests then the full de ### Autoformatters and linting (github workflow to check these on PR) -`black .` +`poetry run black .` -`isort .` +`poetry run isort .` -`flake8 .` +`poetry run flake8 .` ### Contributing To faciliatate automated releases, [conventional commits](https://www.conventionalcommits.org/en/v1.0.0/) guideline should be followed.