Skip to content

Commit

Permalink
Merge pull request #11 from aiarena/feature/upgrade_to_latest_aiarena…
Browse files Browse the repository at this point in the history
…_infrastructure

Upgrade to latest aiarena infrastructure
  • Loading branch information
lladdy authored Jul 20, 2023
2 parents b369984 + f57f523 commit 0693cf9
Show file tree
Hide file tree
Showing 9 changed files with 106 additions and 235 deletions.
35 changes: 19 additions & 16 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# local-play-bootstrap

## What is this?
This repo intends to be a pain-free method for SC2 AI bot authors to quickly setup and run local bot matches on their system.
This repo intends to be a pain-free method for SC2 AI bot authors to quickly setup and run local bot matches on their system, using the same set of docker images that the [SC2 AI Arena ladder](https://sc2ai.net) runs on.

## Prerequisites

Expand All @@ -11,33 +11,36 @@ This bootstrap requires Docker Compose to run.
If you've installed Docker on Windows or MacOS then Docker Compose is already installed.
For other systems: [How to install Docker Compose](https://docs.docker.com/compose/install/)

If you're on Linux and don't wish to install docker compose, refer to the [linux-run.sh](./linux-run.sh) file for how to trigger running of matches.

## Getting started

### Download this repo
![Download this repo](img/download.png)

We recommend against cloning this repo unless you intend to contribute changes.

### Validating your setup

A test match between 2 included test bots is preconfigured to run in the `matches` file.
A test match between 2 included test bots along with the map BerlingradAIE is preconfigured to run in the `matches` file.

Before running the test match, first:
1. Download the [latest ladder maps](https://sc2ai.net//wiki/maps/#wiki-toc-current-map-pool) and place them in your system's StarCraft II maps folder.
If you don't have Starcraft II installed, create a maps folder somewhere to place them in.
2. Check that the SC2 Maps Path setting in the docker-compose.yml file correctly points to the folder you placed the maps in.

Now you can run the test match using `docker-compose up`.
You can run the test match by executing `docker-compose up` in the base folder of this repo.

## Running your own matches

1. Put your bots in the `bots` folder.
1. Put your bots in the `./bots` folder.
2. Download the [latest ladder maps](https://sc2ai.net//wiki/maps/#wiki-toc-current-map-pool) and place them in this repo's local `./maps` folder.
See [Use an alternative maps folder location](#use-an-alternative-maps-folder-location) if you want to use a different maps folder.
2. Add the relevant entries for matches you wish to play to the `matches` file.
3. Start the run script to run a match.
4. View results in the `results` file and replays in the `replays` folder.
5. For troubleshooting, check the `logs` folder for bot logs or the `client.log` file.
3. Run `docker compose up` to run the matches.
4. View results in the `results.json` file and replays in the `replays` folder.

## Troubleshooting
All container and bot logs can be found in the `logs` folder.

Docker container output can also be seen after running the `docker compose up` command.
You can also revisit the container output of previous runs by running `docker compose logs`.

## Use an alternative maps folder location
It can sometimes be handy to have your maps in another location e.g. if you want to use the same maps folder as your StarCraft II installation.

To do this, update the SC2 Maps Path setting in the docker-compose.yml file to point to your maps folder.

## Contribute
If you notice issues with setup, or have ideas that might help other bot authors, please feel free to contribute via a pull request.
Expand Down
27 changes: 0 additions & 27 deletions config.py

This file was deleted.

41 changes: 41 additions & 0 deletions config.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
ARENA_CLIENT_ID = "aiarenaclient_local" # ID of arenaclient. Used for AiArena
ROUNDS_PER_RUN = -1 # Set to -1 to ignore this
BASE_WEBSITE_URL = ""
DEBUG_MODE = true # Enables debug mode for more logging
PYTHON = "python" # Which python version to use
RUN_TYPE = "local" # Run on AiArena, locally or test (options: "test", "local", "aiarena")
# Secure mode will ignore the BOTS_DIRECTORY configuration setting and instead run each bot in their home directory.
SECURE_MODE = false

# LOGGING
LOGGING_LEVEL = "debug" #info,debug,error,trace
LOG_ROOT = "/logs"

# Directories
REPLAYS_DIRECTORY = "/replays"
BOTS_DIRECTORY = "/bots" # Ignored when SECURE_MODE == True

# STARCRAFT
MAX_GAME_TIME = 80640
MAX_REAL_TIME = 7200 # 2 hours in seconds
MAX_FRAME_TIME = 40 # milliseconds
STRIKES = 10
REALTIME = false
VISUALIZE = false

# MATCHES
DISABLE_DEBUG = true
VALIDATE_RACE = false


# Local
MATCHES_FILE="matches"
RESULTS_FILE="results.json"

# Controllers
BOT_CONT_1_HOST="127.0.0.1"
BOT_CONT_1_PORT=8081
BOT_CONT_2_HOST="127.0.0.1"
BOT_CONT_2_PORT=8082
SC2_CONT_HOST="127.0.0.1"
SC2_CONT_PORT=8083
46 changes: 40 additions & 6 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,46 @@
version: "3.9"
services:
arena-client:
sc2_controller:
image: aiarena/arenaclient-sc2:v0.4.3
environment:
- "ACSC2_PORT=8083"
- "ACSC2_PROXY_HOST=proxy_controller"
volumes:
- ./config.py:/root/aiarena-client/config.py
- ./:/root/aiarena-client/host
- "./logs/sc2_controller:/logs" # a sc2_controller folder will be created in the logs folder
# SC2 Maps Path
# Set this as "- PATH_TO_YOUR_MAPS_FOLDER:/root/StarCraftII/maps"
- C:\Program Files (x86)\StarCraft II\Maps:/root/StarCraftII/maps # Standard windows SC2 maps path
# - ./maps:/root/StarCraftII/maps # Local maps folder
# - C:\Program Files (x86)\StarCraft II\Maps:/root/StarCraftII/maps # Standard windows SC2 maps path
- ./maps:/root/StarCraftII/maps # Local maps folder
# - ~/StarCraftII/maps:/root/StarCraftII/maps # Relatively standard linux SC2 maps path
image: aiarena/arenaclient

bot_controller1:
image: aiarena/arenaclient-bot:v0.4.3
volumes:
- "./bots:/bots"
- "./logs/bot_controller1:/logs"
environment:
- "ACBOT_PORT=8081"
- "ACBOT_PROXY_HOST=proxy_controller"

bot_controller2:
image: aiarena/arenaclient-bot:v0.4.3
volumes:
- "./bots:/bots"
- "./logs/bot_controller2:/logs"
environment:
- "ACBOT_PORT=8082"
- "ACBOT_PROXY_HOST=proxy_controller"

proxy_controller:
image: aiarena/arenaclient-proxy:v0.4.3
environment:
- "ACPROXY_PORT=8080"
- "ACPROXY_BOT_CONT_1_HOST=bot_controller1"
- "ACPROXY_BOT_CONT_2_HOST=bot_controller2"
- "ACPROXY_SC2_CONT_HOST=sc2_controller"
volumes:
- "./matches:/app/matches"
- "./config.toml:/app/config.toml"
- "./results.json:/app/results.json"
- "./replays:/replays"
- "./logs:/logs" # a proxy_controller folder will be created in the logs folder
10 changes: 0 additions & 10 deletions linux-run.sh

This file was deleted.

Binary file added maps/BerlingradAIE.SC2Map
Binary file not shown.
4 changes: 2 additions & 2 deletions matches
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
# Bot1 name, Bot1 race, Bot1 type, Bot2 name, Bot2 race, Bot2 type, Map
basic_bot,T,python,loser_bot,T,python,BerlingradAIE.SC2Map
# Bot1 ID, Bot1 name, Bot1 race, Bot1 type, Bot2 ID, Bot2 name, Bot2 race, Bot2 type, Map
1,basic_bot,T,python,2,loser_bot,T,python,BerlingradAIE
174 changes: 0 additions & 174 deletions multithread-run-example.py

This file was deleted.

4 changes: 4 additions & 0 deletions results.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"results": [
]
}

0 comments on commit 0693cf9

Please sign in to comment.