Introduction
This post contains no opinion because it is a wiki post. If you see something that does not look right, you can change it.
This is inspired by an older post and describes the format used to send information to your algo every turn and to save replay data.
Each turn contains multiple “frames”, which are divided into several phases: “restore”, “deploy” & “action”.
All of the following elements are part of a parent object (JSON). In replay files, an array of these is used to represent the course of the match.
All Elements
turnInfo (array of numbers)
- The state (phase) of the frame:
-
0
: Equal to the “deploy” phase, where both algos need to build firewalls & deploy units (or send empty lists). This will always occur on frame-1
(3rd element in this array). -
1
: Comprises both “restore” and “action” phase. This state will occur for all frames>= 0
. -
2
: This is sent when the game is over.
-
- Represents the turn number each frame is in, starting at
0
. - The frame numbers start at
-1
each turn, which means that no firewalls or information units have been deployed yet.
p{1 or 2}Units (array of arrays of arrays)
Parent: array containing arrays, which store all units (which are stored in arrays) of a certain type a player has on the board.
- Filters
- Encryptors
- Destructors
- Pings
- EMP’s
- Scramblers
- Remove’s
The arrays the units are stored in consist of four elements each:
- x (location on the board)
- y
- current stability of the unit
- String (above 3 are numbers): unique id of each unique, starting at “0”
p{1 or 2}Stats (array of numbers)
The array consists of four elements.
- Current health points of the player
- Available cores
- bits
- computing time of previous turn in milliseconds
events (object)
The object contains nine arrays (of arrays), some of which only occur in certain phases.
All Events
selfDestruct
This will occur in the “action” phase when information units self destruct because there is no open path to the opponent’s edge.
The arrays stored contains five elements:
- Unit location
- Array of arrays (locations):
[x, y]
, which are all opposed firewalls in range of the self destructing unit - Number: damage dealt by self destruction
-
Unit index, see
p{1 or 2}Units
for reference - String: unit id
-
player (
1
/2
), i.e. unit owner
breach
All information units that breach the opponent’s edge (action phase) on each frame are stored in an array containing five elements.
-
location of breach:
[x, y]
- Number: damage dealt to opponent’s health points
-
Unit index, see
p{1 or 2}Units
for reference - String: unit id
-
player (
1
/2
)
damage
Every single attack (action phase) of a unit taking damage is stored in this array as five element arrays:
-
location of unit that took damage:
[x, y]
- Number: damage dealt to unit
-
Unit index, see
p{1 or 2}Units
for reference - String: unit id
-
player (
1
/2
)
shield
All Encryptor shielding actions (action phase) of the frame are in this array, stored as seven element arrays:
-
location of shielding Encryptor:
[x, y]
-
location of information unit receiving the shield:
[x, y]
- Number: shield amount
-
Unit index of Encryptor, see
p{1 or 2}Units
for reference - String: unit id of Encryptor
- unit id of receiver
-
player (
1
/2
)
move
Contains all moves made in an action phase frame by all information units as arrays of six elements:
- initial location
- location after move
-
[0, 0]
(unknown) - unit index
- id of unit
- player
spawn
Spawns, stored in arrays of four elements, only occur in the deploy phase, i.e. on frame 0
of each turn.
- spawn location
- unit index
- id
- player
death
Death can happen in the action (due to information units attacking and firewalls defending) & restore phase (as removals happen then). They are stored as arrays of five.
- location
- unit
- id
- player
-
"true"
/"false"
was a removal
attack
This is a “mirror” of damage, just that this contains the attacking units (seven elements):
- location of attacker
- location of attacked unit
- Number: damage dealt to unit
- unit (attacker)
- id (attacker)
- id (attacked)
- player
melee (unused)
The Restore phase leads to frame -1
and is made up of removals & income (bits & cores). This frame is sent to both algos in order for them to deploy their units.
Deploy leads to frame 0
of each turn and consists of spawns only (firewalls & information).
Action is all frames starting at 0
, i.e. spawned units interacting.