Clients and servers communicate WebSockets (https://developer.mozilla.org/en-US/docs/Web/API/WebSockets_API).
All actions for bots are sent in an actions message. If several actions for one round or one bot is provided only the latest in the round will be taken in account.
After connecting to server, client needs to send join message
{
"type": "join",
"teamName": <name of your team>
}Actions are sent with an actions-message. An action for each bot is set in actions-array. If there are several actions for one bot, only the latest is resolved. Similarly if multiple actions-messages are sent during a round only the last one will be resolved.
{
"type": "actions",
"roundId": <the id of the round>
"actions": <array of actions>
}A bot's action can be one of the following: move, radar or cannon.
{
"type": "move",
"botId": <id of bot to move>>
"pos": {
"x": <target hex x-coordinate>,
"y": <target hex y-coordinate>
}
}{
"type": "radar",
"botId": <id of bot to move>>
"pos": {
"x": <target hex x-coordinate>,
"y": <target hex y-coordinate>
}
}{
"type": "cannon",
"botId": <id of bot to move>>
"pos": {
"x": <target hex x-coordinate>,
"y": <target hex y-coordinate>
}
}-
connectedSend after a client connects to server{ "type": "connected", "teamId" <id of the team>, "config": <configurations as an object> } -
startInitial data of the game. This will be received after all teams have joined and the game is started.{ "type": "start", "you": { "name": <name of your team>, "teamId": <id of your team>, "bots": [<array of bots>] }, "config": <configurations as an object> "otherTeams": [<array of opponent teams>] -
eventsAll bots receive events after each turn has been played. This message will tell you what happened after your move.{ "type": "events", "roundId": <the id of round>, "config": <configuration object>, "you": <team information>, "otherTeams": [<array of other teams>], "events": <array of events> }All possible events:
hitBot has been hit. This might mean that you have been hit, or you hit another bot.{ "event": "hit", "botId": <the id of bot that was hit>, "source": <the id of bot that shot the hit>" }dieBot has died. This might mean that you died, or that you killed another bot.{ "event": "die", "botId": <the id of bot that died> }seeResults seeing bots. You will never be included in this event.{ "event": "see", "source": <the id of bot that saw the target>" "botId": <the id of bot that was seen>, "pos": { "x": <x-coordinate of target>, "y": <y-coordinate of target> } }radarEchoResults of radaring bots. You will never be included in this event.{ "event": "radarEcho", "pos": { "x": <x-coordinate of target that was detected>, "y": <y-coordinate of target that was detected> } }detectedYou will be notified that you have been seen or radared.{ "event": "detected", "botId": <the id of bot that was detected> }damagedYour bot was damaged{ "event": "damaged", "botId": <the id of bot that was damaged>, "damage" <amount of damage> }moveOne of your team's bots new position after a move action. Cannot move out of the map.{ "event": "move", "botId": <id of bot that moved>, "pos": { "x": <new x-coordinate of bot>, "y": <new y-coordinate of bot> } }noactionBot performed no actions.{ "event": "noaction", "botId": <the id of bot that missed turn> }
-
endGame has ended. Game ends when there are less than two bots alive.{ "type": "end", "winnerTeamId": <winner team id or -1 if a tie>, "you": <your team information> }
-
configurations{ "bots": <number of bots>, "fieldRadius": <size of the hex grid>, "move": <the maximum movement amount, inclusive> "startHp": <starting hit points>, "cannon": <cannon radius, direct damage is radius + 1, damage decay linearly as function of distance>, "radar": <radar radius, inclusive>, "see": <sight radius, inclusive>, "maxCount": <game length in rounds>, "asteroids": <asteroids>, "loopTime": <delay between rounds>, "noWait": <start next round if all players have registered their actions> } -
Team specifications{ "name": <name of the team>, "teamId": <the id of the team>, "bots": <array of bots. If an opponent, bots don't show hitpoints nor position> } -
BotIn general if a bot message is about an enemy bot, both current hitpoints and positions is omitted.{ "botId": <id of bot>, "name": <name of the bot>, "teamId": <id of the team of the bot>, "hp": <current hit points>, "alive": <true if bot is alive, false if destroyed>, "pos": { "x": <x-coordinate of bot>, "y": <y-coordinate of bot> } }