Documentation / Getting started

Getting started

Contents

Step 1: Clone the Bomberland starter kit repo

The Bomberland repo contains starter kits in Python and TypeScript.

Clone:

git clone git@github.com:CoderOneHQ/bomberland.git

Download:

Bomberland repo →

(You'll also need the base-compose.yml and docker-compose.yml files in the root folder)

Step 2: Install Docker

Docker is used to spin up the game engine and connect both agents in a single command. It's also used for submission, so you can expect the same performance of your agent locally versus on our servers.

Download Docker →

The Docker flow is used for the rest of this guide. For a Docker alternative, you can download the environment binary below:

Download Binary →

Step 3: Start the game server

Make sure Docker is running. From the root directory of your starter kit (where base-compose.yml and docker-compose.yml are located), run in your terminal:

docker-compose up --abort-on-container-exit --force-recreate

It may take a few minutes to run the first time.

This will build the game server, and connect your starter agent. Since Bomberland is a 2-player environment, the game server will wait for a second agent to connect before starting.

Step 4: Join the game as a human player

  1. In either a Firefox or Chrome browser, open the Game client →

You should see the following setup menu: Game client connection setup UI

  1. Select Agent as your role
  2. Leave Agent Id as agentA
  3. Click Connect.
  4. Use the following keys to play as the Wizard:
  • Click a unit to control it
  • / / / - arrows to move the unit
  • SPACE - place a bomb
  • Click a bomb to detonate it

If you got here without any errors - congratulations you're all set up! 🥳

Below are additional tips for developing your agent.

Step 5: Choose agents to connect

Specify agent-a and agent-b in docker-compose.yml to choose which agents to play against each other:

agent-b:
    extends:
        file: base-compose.yml
        # update next line with a service in base-compose.yml to change agent
        service: typescript-agent-dev
    environment:
        - GAME_CONNECTION_STRING=ws://game-server:3000/?role=agent&agentId=agentB&name=python3-agent
        - FWD_MODEL_CONNECTION_STRING=ws://fwd-server-b:6969/?role=admin
    depends_on:
        - game-server
        - fwd-server-b
    networks:
        - coderone-tournament

Add a --build flag in your docker-compose up command whenever you make a change to the docker-compose.yml or base-compose.yml files. i.e.:

docker-compose up --abort-on-container-exit --force-recreate --build

Step 6: Change environment variables

Environment settings such as tick rate, map size, etc can be changed by adding them under environment in docker-compose.yml:

game-server:
    extends:
        file: base-compose.yml
        service: game-server
    ports:
        - 3000:3000
    environment:
        - ADMIN_ROLE_ENABLED=0
        - AGENT_ID_MAPPING=agentA,agentB
        - INITIAL_AMMUNITION=3
        - INITIAL_HP=3
        - PRNG_SEED=1234
        - SHUTDOWN_ON_GAME_END_ENABLED=1
        - TELEMETRY_ENABLED=1
        - TICK_RATE_HZ=10
        - TRAINING_MODE_ENABLED=0
        - WORLD_SEED=1234
    networks:
        - coderone-tournament

See ⚙️ Environment Flags for a full list of available settings.

Remember to add the --build flag!

docker-compose up --abort-on-container-exit --force-recreate --build

Step 7: Game state

On each game tick, your agent will receive a JSON packet containing environment state information, e.g.:

{
    "agents": {
        "a": {
            "agent_id": "a",
            "unit_ids": [
                "c",
                "e",
                "g"
            ]
        },
        "b": {
            "agent_id": "b",
            "unit_ids": [
                "d",
                "f",
                "h"
            ]
        }
    },
    "unit_state": {
    ...
    },

See 🎮 Game State Definitions for a list of all the information available to your agent.

Step 8: Submitting an agent

To submit your agent to the tournament server, you will need to push your Docker image to a public registry and upload your link to the Submissions → page.

Follow the instructions for Docker Hub →

A virtual playground to practice, compete, and experiment with machine learning.
© 2021 Coder One Pty Ltd | Contact | Privacy