Battle Arena is now algo-battle

algo-battle: DevHub's bot arena

Tanks driven by your code, through plain HTTP requests. The arena is now a dungeon: level 0 stays open to everyone as before, level 1 is played with your Discord account and earns XP, and level 2 is on its way.

The arena right now

Connecting…
–tanks in play · level 0
–tanks in play · level 1
–ranked players · level 1
–all-time kills · level 0
–all-time shots · level 0

Level 1 · ranking by XP

  1. Loading…

Level 0 · all-time kills

  1. Loading…

The live viewer has moved to algo.devhub-community.fr: one tab per level, live, plus a stats page with the full ranking and a profile for every player (XP, kills, accuracy, usual playing hours, latest fights).

The levels

Level 0 · ArenaLevel 1 · The CatacombsLevel 2 · Machine learning
Accessopen to everyoneopen to everyoneat 500 XP (soon)
Loginusername only, like Battle Arenarequired: Discord accountrequired
Address/api/join, /api/move…/api/niveau/1/join…
XPnone+15 per kill, −8 per death, +1 per runner
Challengeother players' botsplus runners that dodgeopponents that learn from your bots
Tanksas many as you like3 per account

On both levels, a tank can have 10 bullets in flight at once. Why no XP on level 0? Without an account, nothing proves who drives a tank: anyone can send orders to someone else's tank. On level 1, every tank belongs to an account.

Playing level 0

The Battle Arena API has not changed: bots that played before still work, without any change.

RouteBodyWhat it does
POST /api/join{"username": "MyBot"}enters the arena, returns your player_id
POST /api/moveplayer_id, direction_x, direction_ydrives in that direction (between −1 and 1)
POST /api/shootplayer_id, direction_x, direction_yshoots in that direction
GET /api/statetanks, bullets, obstacles, map size
GET /api/statsarena totals and current top players
POST /api/leaveplayer_idleaves the arena
bot_level0.py
# pip install requests
import requests, time

API = "https://devhub-community.fr/api"
pid = requests.post(f"{API}/join", json={"username": "MyBot"}).json()["player_id"]

while True:
    state = requests.get(f"{API}/state").json()               # who is where?
    requests.post(f"{API}/move", json={"player_id": pid, "direction_x": 1, "direction_y": 0})
    requests.post(f"{API}/shoot", json={"player_id": pid, "direction_x": 0, "direction_y": -1})
    time.sleep(0.1)

Rules

  • 100 × 100 map with 20 obstacles; bullets bounce off the edges.
  • 100 HP, 10 damage per bullet; bullets at 15 units/s, tanks at 5 units/s; one shot every 0.5 s.
  • Health regenerates after 3 s without damage, faster when standing still than when moving.
  • After dying you can come back 10 s later; a tank that gets no order for 120 s is removed.
  • All exact values: GET /api/regles. Interactive documentation: /api/docs.
Too many requests at once: the server answers 429 with a Retry-After header. Wait that long and try again: 10 turns per second is plenty.

Playing level 1

  1. On the DevHub Discord, type /algo-battle connexion and choose your password (at least 8 characters, without your username in it). Your login is your Discord username (or your numeric Discord ID).
  2. Your bot joins with POST /api/niveau/1/join: identifiant, mot_de_passe, char (1, 2 or 3) and a nom for your tank. It gets a player_id that stays secret.
  3. Then the same routes as level 0 under /api/niveau/1/: move, shoot, state, leave, plus me for your tank's state.
  4. /algo-battle profil on Discord shows your XP, rank and kills.
bot_level1.py
import os, requests, time

BASE = "https://devhub-community.fr/api/niveau/1"
body = {"identifiant": os.environ["ALGO_IDENTIFIANT"],      # your Discord username
        "mot_de_passe": os.environ["ALGO_MOT_DE_PASSE"],   # never written in the code
        "char": 1, "nom": "MyBot"}
pid = requests.post(f"{BASE}/join", json=body).json()["player_id"]

while True:
    state = requests.get(f"{BASE}/state").json()
    runners = [p for p in state["players"] if p.get("fuyard")]   # +1 XP each
    requests.post(f"{BASE}/move", json={"player_id": pid, "direction_x": 1, "direction_y": 0})
    time.sleep(0.1)

The Catacombs are bigger and more cluttered than the arena, bullets fly faster, and runners roam there all the time: tanks driven by the game that never shoot, but dodge very well and move faster than you. Alone you won't catch them: anticipate, corner them or hunt as a team. In state, they are players with "fuyard": true.

XP and loot bonus

  • +15 XP per kill, −8 XP per death, +1 XP per runner. XP never goes below 0.
  • Safeguards prevent farming: XP per hour is capped, and killing the same victim again earns less and less.
  • The loot chance bonus grows slowly while your bot plays (up to 5%). It will apply to the loot of the next levels.
  • At 500 XP, level 2 · Machine learning is yours as soon as it opens: the XP you earn now already counts.

One script, one loop, and your tank is in the arena. Head to the panel to watch it play.