oyeb / phoenix

The AI Challenge backend for Anokha 2017
MIT License
3 stars 4 forks source link

Phoenix (AI Challenge backend for Anokha 2017)

saber shall be reborn as phoenix this year :wink:.

Games are configured by a single JSON file and are run inside the environment of an arena. Here's a description of what is to be contained in each directory:

├──api
│  └── The APIs, one in each folder.
├──errorlogs
│  └── Unique error logs for each game (DB stores filename alone)
├──debuglogs
│  └── Unique debug logs for each game (DB stores filename alone)
├──replays
│  └── Unique replays for each game (DB stores filename alone)
├──maps
│  └── The maps
├──bots
│  └── The bots submitted by users. They implement `__main__.py`
├──sample_bots
│  └── The bots created by us. They implement `__main__.py`
└──arena
   └── temp folder(s)

Prepare your environment

  1. Create the following directories (write a shell script for this?)

    mkdir -p out/errorlogs
    mkdir out/debuglogs
    mkdir out/movelogs
    mkdir out/replays
  2. Move the Bot APIs to /api. So this is how your /api dir should look:

    api
    ├── python2
    │   └── src
    │       ├── botapi.py
    │       └── __init__.py
    └── python3
    └── src
        ├── botapi.py
        └── __init__.py

You can see that this folder lacks __main__.py.

  1. Copy the __main__.py of the bots into /bots

    bots
    ├── py2_bot.py
    └── py3_bot.py
  2. Create atleast 1 arena folder, this is where bot codes are copied, and logs are generated. gameloop.commit moves them to the /out folders.

    mkdir arena_a

Instructions for running the Game locally:

NEW

OLD

Dependencies

TODO

Architecture

Game <---> Engine <-.
                    |
                    +--> Bot
                    |
                    +--> Bot
                    |
                    .
                    .

Hence we require 2 APIs

So,

Whatever be the Game, we can start work on the APIs and the Engine. We already know what the responsibilities of the Engine are.

Engine

Responsibilities

Bots

Security

We can protect our system by running bot process in chroot jails or containers (LXD, LXC or Docker) which help in minimising damages when scripts attempt privilege escalation or arbit code injection.

How do we make sure processes cannot open any kind of file descriptors? Be it for IPC or network sockets?