:pink_encryptor: Frame Info Documentation

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)

  1. 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.
  2. Represents the turn number each frame is in, starting at 0.
  3. 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.

  1. Filters
  2. Encryptors
  3. Destructors
  4. Pings
  5. EMP’s
  6. Scramblers
  7. Remove’s

The arrays the units are stored in consist of four elements each:

  1. x (location on the board)
  2. y
  3. current stability of the unit
  4. 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.

  1. Current health points of the player
  2. Available cores
  3. bits
  4. 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:

  1. Unit location
  2. Array of arrays (locations): [x, y], which are all opposed firewalls in range of the self destructing unit
  3. Number: damage dealt by self destruction
  4. Unit index, see p{1 or 2}Units for reference
  5. String: unit id
  6. 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.

  1. location of breach: [x, y]
  2. Number: damage dealt to opponent’s health points
  3. Unit index, see p{1 or 2}Units for reference
  4. String: unit id
  5. player (1 / 2)

damage

Every single attack (action phase) of a unit taking damage is stored in this array as five element arrays:

  1. location of unit that took damage: [x, y]
  2. Number: damage dealt to unit
  3. Unit index, see p{1 or 2}Units for reference
  4. String: unit id
  5. player (1 / 2)

shield

All Encryptor shielding actions (action phase) of the frame are in this array, stored as seven element arrays:

  1. location of shielding Encryptor: [x, y]
  2. location of information unit receiving the shield: [x, y]
  3. Number: shield amount
  4. Unit index of Encryptor, see p{1 or 2}Units for reference
  5. String: unit id of Encryptor
  6. unit id of receiver
  7. player (1 / 2)

move

Contains all moves made in an action phase frame by all information units as arrays of six elements:

  1. initial location
  2. location after move
  3. [0, 0] (unknown)
  4. unit index
  5. id of unit
  6. player

spawn

Spawns, stored in arrays of four elements, only occur in the deploy phase, i.e. on frame 0 of each turn.

  1. spawn location
  2. unit index
  3. id
  4. 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.

  1. location
  2. unit
  3. id
  4. player
  5. "true" / "false" was a removal

attack

This is a “mirror” of damage, just that this contains the attacking units (seven elements):

  1. location of attacker
  2. location of attacked unit
  3. Number: damage dealt to unit
  4. unit (attacker)
  5. id (attacker)
  6. id (attacked)
  7. 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.

18 Likes

thank you kind sir! I was trying to find this by digging into a replay file myself, I wasn’t doing so hot