Starter Kit

Starter AIs are available in the Starter Kit. They can help you get started with your own AI. Do not hesitate to contribute if your language doesn't have one!

# The Goal

In this game, you have to destroy the enemy team while keeping at least one of your bots alive. If the time is up, the player who has destroyed the most bots wins.

# Rules

Your bots fight in a square arena, from which they cannot escape. Unfortunately, your bots aren't very smart and cannot provide you that much information as X, Y coordinates or their exact health. You will have to exploit the little information given to you.
But don't worry, your bots get smarter and can give you more info in the following leagues!

In this league, your bots realized they could calculate and give you 5 additional pieces of information. More details in the game input section.

A lot of the information given is distances between bots. The bots use 4 different ranges to describe those distances :

- 0 : Short range (dist ≤ 3 m)

- 1 : Medium range (3 m < dist ≤ 8 m)

- 2 : Long range (8 m < dist ≤ 15 m)

- 3 : Out of range (dist > 15 m)

A bot has 2 health bars :

- The blue one represents its shield : if a bot doesn't take any damage during 12 turns, its shield will regenerate every turn. An empty shield will take 12 turns without damage to be completely restored

- The purple one represents your health. It cannot be regenerated, but will decrease only if the bot's shield is empty

Your bots are not smart enough to give you the exact shield and health value of bots in the arena. So, they use an approximation :

- For the health they give you either 0 | 25 | 50 | 75 | 100 , 25 meaning that your life is ≥ 25% but < 50% of your max life
- For the shield, they give you either 0 | 1 | 25 | 50 | 75 | 100 , 1 meaning that the shield is > 0% and < 25% of the max shield and 0 that the shield is empty

Your bots can perform 3 different actions :

- ATTACK one enemy bot. The damage is done depending on the range your enemy is at (short, medium, long or out of range). The closer it is, the more damage you'll do. If your bot is attacking an enemy out of range, it won't deal any damage. For more details, see technical details.
- MOVE to a group of bots, which makes the bot move toward the average position of the group. If the group is an only target, the bot will move toward it.
- FLEE from a group of bots, which makes the bot move backward from the average position of the group.
- IDLE The bot waits for this turn and starts thinking about the meaning of life.
  "A bot must obey the orders given it by human beings except where such orders would conflict with the First Law."
  It's the default action if you don't send an order for a bot.

Now your bots spawn randomly on the map.
The bot spawn locations of both teams are symmetric. The symmetry can be:

- central (across the center of the arena)
- horizontal (across the horizontal line through the center of the arena).

There are 2 rules that those spawns will always respect :

- The distance between 2 bots has to be at least 2 meters
- The distance between 2 bots of different teams has to be at least 8.1 meters

Victory Conditions

- You destroyed all enemy bots.
- You have more bots alive than your opponent after 300 turns.

Defeat Conditions

- All your bots got destroyed.
- You send invalid orders to your bots, making their positronic brain explode.
  They are smart enough to tell you why you made them crash, so be sure to check the little dot in the replay.

# 🐞 Debugging tips

In this game, there are many features to help you understand what is happening in the arena:
You can activate the dynamic zoom of the camera with the CAMERA MODE toggle.
The different ranges are displayed when you hover over a bot with your mouse.
You can also see the target of the bot and its current action. The tooltip gives you more information about the bot.
You can LEFT CLICK on a bot to make the target display permanent and ALT + LEFT CLICK anywhere on the player to remove all targets.
You can enable the debug overlay with the DEBUG OVERLAY toggle to see the bot's id and current action.
Hitmarkers are displayed when a bot is hit by a bullet.

# Technical Details

After each turn, your bots execute their actions during 250 ms.
Concerning attack :

- In order to fire bullets at an opponent, a bot has to attack the same target for aim duration turns. Then it'll fire bullets per shot bullets each turn for shot duration turns.
- The moment a bullet is fired, the game engine determines if it will hit the targeted bot based on the current range of the target with a probability of precision [target range]. Note that attacking out of range has a 0% precision.
- The game is deterministic, even if there is some RNG in shots, the 2 teams have the same random seed to determine if their shot will hit. Therefore, a game between 2 identical AIs will always result in a draw... Unless the AI use the fact that the bot's IDs start at 0 for one team and 7 for the other to make its decisions.

The bullet speed is 20 m/s. You can see all bot properties per class in this table:

Bot class | Damage per bullet | Bullets per shot | Aim duration (turn) | Shot duration (turn) | Precision at short / mid / long range | Speed (m/s) | Health | Shield
--- | --- | --- | --- | --- | --- | --- | --- | ---
Assault | 300 | 3 | 4 | 2 | 95% / 55% / 15% | 1.2 | 5000 | 3000

You can check the source code of the game on its GitHub repo.

# Where does this idea come from?

This challenge is highly inspired by the game "GLADIABOTS".
It's almost a copy, but I made it with the GFX47 (the gladiabots dev) permission. So if you enjoy this challenge or need some inspiration, don't hesitate to give it a look!
I would like to thank eulerscheZahl for his precious advice when I started this project, GFX47 who agreed to let me copy many of his ideas and DamnSake and Deniw who helped me with the graphics.

# Game Input

Initialization input
Line 1: one integer botPerPlayer, the amount of bots controlled by each player at the beginning of the game.
Line 2: one integer mapSize, the arena size in meters.
Input for one game turn
First line: an integer allyBotAlive, the amount of your bots which are still alive.
Next line: an integer botCount, the amount of alive bots in the arena.
For each bot on the battlefield, your bots give 8 pieces of information : botId, botType, health, shield, action, targets , enemyRange, borderDist . The others are just 0 and will be used in the next leagues. Ranges are given as integer as follows : 0 for SHORT RANGE , 1 for MEDIUM RANGE , 2 for LONG RANGE and 3 for OUT OF RANGE.
botId is the unique bot id, stays the same for the whole game.
botType indicates the type of bot. The value can be :

- "ALLY" for one of your bots
- "ENEMY" for an enemy bot

health, shield for the approximate bot's health and shield.
action indicates the action executed by the bot last turn. The value can be "ATTACK" , "MOVE" , "FLEE" , "IDLE".
targets is the list of the targets ids targeted by the bot last turn. They are separated with ",": "id1,id2,id3..." (the target for IDLE is the bot itself).
enemyRange : the range from the closest enemy. If the bot is from the enemy team, it returns the range to its closest ally.
borderDist : the range from the closest border (among the left, right, top and bottom one).
Then all of your bots become one after the other ON AIR. An ON AIR bot gives for each bot 7 pieces of information from its perspective : botId, botType, range, distMeRank , shieldComp, healthComp, totComp . For the first iteration, it sends its own information so botType is "ON_AIR" so that you can get the ON AIR ally bot id. Then it sends information about other allies, then enemies.
botId is the unique bot id.
botType indicates the type of bot. The value can be:

- "ALLY" for one of your bots
- "ENEMY" for an enemy bot
- "ON_AIR" for the ON AIR bot

range for the range at which the bot is from your ON AIR bot.
distMeRank the rank of the bot in a ranking based on the exact distance between the bots and the ON AIR bot.
shieldComp, healthComp, totComp compare an attribute between the ON AIR bot and the other bot.
shieldComp compares the shields of the 2 bots, healthComp compares the healths of the 2 bots, totComp compares the sum of healths and shields of the 2 bots.
The comps can be either :

- -1 if the other bot has more attribute than the ON AIR bot
- 0 if the other bot has the same value for the attribute than the ON AIR bot
- 1 if the other bot has less attribute than the ON AIR bot

Output for one game turn
1 line containing all your orders separated by ";": "order1;order2;order3;...".
An order has to respect the following syntax yourBotID [ACTION] [TARGETS] and the following rules :

- ACTION has to be a valid action : ATTACK , MOVE , FLEE or IDLE.
- TARGETS has to use this syntax : targetID1,targetID2,targetID3
  It must also follow specifics rules depending on which action you try to perform:
  - If the action is ATTACK, TARGETS has to contain 1 enemy bot id, not more, not less. Don't try to attack yourself1 or your allies.
    1. "A bot must protect its own existence as long as such protection does not conflict with the First or Second Law."
  - If the action is MOVE or FLEE, TARGETS has to contain at least 1 bot id
  - If the action is IDLE, TARGETS can contain anything or just nothing, in any case it'll be ignored. it allows you to REALLY make your bots think about the meaning of life
- If you send 2 different orders concerning the same bot, you'll lose the game because your bot will suffer the same fate as R. Jander Panell dragging your entire team down with it.
- If you don't send any output, all your bots will IDLE. If you don't send any order concerning one or more of your bot, they will IDLE.

Constraints
The arena is a square with a size of 40 meters
Allotted response time to output is ≤ 50 ms.
Allotted response time to output for the first turn is ≤ 1000 ms.