Git Product home page Git Product logo

anglerbot's Introduction

Useful Links

ares-sc2 framework repo
ares-sc2 documentation


Installation

If you're looking to build your own StarCraft II bot, starting with the ares-sc2-bot-template let's you get up and running quickly. This template uses the Ares-sc2 framework which builds upon the python-sc2 framework, enhancing its capabilities for bot development in StarCraft II. You can find it here.

Prerequisites

Before proceeding, ensure the following prerequisites are installed:

Additional:

Linux: can either download the SC2 Linux package here  from Blizzard or, alternatively, set up Battle.net via WINE using this lutris script.

 PyCharm IDE - This tutorial will demonstrate how to set up a bot development environment using PyCharm but you can use any IDE.

The maps must be copied into the root of the Starcraft 2 maps folder - default location: C:\Program Files (x86)\StarCraft II\Maps.

Environment Setup for Linux (Lutris)

If you've installed StarCraft II using Lutris on Linux, you'll need to set some environment variables so that the ares-sc2 library can correctly interact with the game.

Setting Environment Variables Temporarily

Open a terminal and enter the following commands, replacing (username) with your actual Linux username and (version of wine) with the version of Wine that Lutris is using:

export SC2PF=WineLinux
export SC2PATH="/home/`(username)`/Games/battlenet/drive_c/Program Files (x86)/StarCraft II/"
export WINE="/home/`(username)`/.local/share/lutris/runners/wine/`(version of wine)`/bin/wine" 

Creating Your Bot

  • Visit the starter-bot repo and click the Use this template button to create your own repository based on this template. The repository can be either public or private.

  • Next, clone the repository locally to your system, ensuring you include the --recursive flag:

git clone --recursive <your_git_repo_home_url_here>
  • Open a terminal or console window.

  • Navigate to the root of your bot's directory:

cd <bot_folder>
  • Install dependencies, compile Cython, and create a new isolated virtual environment:
poetry install

Testing Your Bot:

If you have a non-standard StarCraft 2 installation or are using Linux, please adjust MAPS_PATH in run.py.

Optionally set your bot name and race in config.yml

poetry run python run.py

Start Developing Your Bot

If everything has worked thus far, open up bot/main.py and delve into the excitement of bot development!

An ares-sc2 bot is a python-sc2 bot by default, meaning any examples or documentation from that repository equally relevant here.

Uploading to AiArena

Included in the repository is a convenient script named scripts/create_ladder_zip.py. However, it is important to note that the AIarena ladder infrastructure operates specifically on Linux-based systems. Due to the dependency of ares-sc2 on cython, it is necessary to execute this script on a Linux environment in order to generate Linux binaries.

To streamline this process, a GitHub workflow has been integrated into this repository when pushing to main on your GitHub repository (if you previously created a template from the starter-bot). Upon each push to the main branch, the create_ladder_zip.py script is automatically executed on a Debian-based system. As a result, a compressed artifact named ladder-zip.zip is generated, facilitating the subsequent upload to AIarena. To access the generated file, navigate to the Actions tab, click on an Action and refer to the Artifacts section. Please note this may take a few minutes after pusing to the main branch.


Additional

PyCharm

Adding poetry environment

Find the path of the environment poetry created in the installation step previously, copy and paste or save this path somewhere.

poetry env list --full-path

Open this project in PyCharm and navigate to:

File | Settings | Project: | Python Interpreter

  • Click Add Interpreter, then Add Local Interpreter

Alt text

  • Select Poetry Environment, and choose Existing Environment
  • Navigate to the path of the poetry environment from the terminal earlier, and select Scripts/python.exe

Alt text

Now when opening terminal in PyCharm, the environment will already be active. New run configurations can be setup, and they will already be configured to use this environment.

Marking sources root

For PyCharm intellisense to work correctly: - Right-click ares-sc2/src -> Mark Directory as -> Sources Root

Alt text

Installing Poetry on Linux

To get Poetry to run on some Linux distros you may need to perform the following

python3 --version

to check your version of python, it should show 3.10.12 then

curl -sSL https://install.python-poetry.org | python3 -

to install poetry

poetry --version

to verify you have poetry installed

Update ares-sc2

This may take a minute or two

python scripts/update_ares.py

Format code

black .

isort .

FAQ

I got the Following Error Directory .../ares-sc2-bot-template/ares-sc2 for ares-sc2 does not seem to be a Python package

a: This means you're missing the ares-sc2 sub module

git submodule update --init
git submodule update --init --recursive --remote

Interested in contributing to ares-sc2? Take a look at setting up a local dev environment here instead.

anglerbot's People

Contributors

drekksama avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.