Skip to content

TeamJumpstart/InformatiCup2021

Repository files navigation

InformatiCup2021

Tests Passes

Team Jumpstart

This project is the contribution of Team Jumpstart to the InformatiCup2021 challenge provided by the German Informatics Society (GI). We offer our own AI agent that is able to competitively play the game spe_ed.

The accompanying paper documents our approach.

The challenge lies in both finding a strategy that ensures the own agent's survival, and at the same time anticipating the other player's future movements. With up to six players concurrently playing, there is a multitude of variables to consider, as well as added complexity with varying speed and the ability to jump. To address these issues, we propose depth-limited heuristic search and Monte-Carlo based heuristic search algorithms. We approximate the board state via heuristics to choose actions within a limited search horizon and incorporate an early-out mechanism to meet critical deadlines. The agent will explore potential future actions based on different heuristics, while simultaneously predicting the probability of opponent movements to choose the best immediate action.

Animations of several heuristics and our video submission for the final are shown on the project website.

Usage

Clone the repo and build the docker image:

docker build -t spe_ed .

Run the docker image in the default mode, i.e. seeking a connection with a provided websocket server:

docker run -e URL="wss://msoll.de/spe_ed" -e KEY="your_key" -e TIME_URL="https://msoll.de/spe_ed_time" spe_ed

This will start a websocket client, that connects to the server and selects an action, whenever a new state is transmitted by the server.

usage: main.py [-h] [--show] [--render-file RENDER_FILE] [--sim] [--log-file LOG_FILE] [--log-dir LOG_DIR] [--t-config T_CONFIG] [--upload] [--fps FPS] [--cores CORES]
               [{play,replay,render_logdir,plot,tournament,tournament-plot}]

spe_ed

positional arguments:
  {play,replay,render_logdir,plot,tournament,tournament-plot}

optional arguments:
  -h, --help            show this help message and exit
  --show                Display games using an updating matplotlib plot.
  --render-file RENDER_FILE
                        File to render to. Should end with .mp4
  --sim                 The simulator environment runs a local simulation of Spe_ed instead of using the webserver.
  --log-file LOG_FILE   Path to a log file, used to load and replay games.
  --log-dir LOG_DIR     Directory for storing or retrieving logs.
  --t-config T_CONFIG   Path of the tournament config file containing which settings to run.
  --upload              Upload generated log to cloud server.
  --fps FPS             FPS for rendering.
  --cores CORES         Number of cores for multiprocessing, default uses all.

Extensions

Can be build with the same docker image. Other modes than the default "play on websocket server" can be selected.

Simulator: play in a simulator environment instead of the server and view the played game in a matplotlib plot.

docker run -d --name=spe_ed spe_ed --sim --show
Simulator

Renderer: render games from log files to video format.

docker run -d --name=spe_ed spe_ed render_logdir --log-dir=logs/
Renderer

Plot mode: create plots for logged games from the webserver. This is intended to observe player behavior as it gives an overview over all tracked games.

docker run -d --name=spe_ed spe_ed plot --log-dir=logs/
Opponents Scatterplot

Tournament mode: run a tournament of multiple policies, where each game has different policy and parameter combinations. The chosen policies and parameter options like grid size can be configured in a separate tournament config file (tournament/tournament_config.py).

docker run -d --name=spe_ed spe_ed tournament --log-dir tournament/logs

Tournament plot mode: create plots and matchup statistics for a played tournament given by its logs.

docker run -d --name=spe_ed spe_ed tournament-plot --log-dir tournament/logs
Matchup Results