Replay Files

Overview

A Halite replay file is a JSON object which describes what occurred during the game. Halite replay files are easy to parse and reasonably compact (and extremely compact when compressed), making them ideal for both using machine learning on Halite as well as sharing interesting games. The extension .hlt is used to distinguish Halite replay files.

Detailed Specification

A Halite replay file contains only a single JSON object. This object has the following attributes:

  • version - Describes the version of the replay file. The present version is 11, which is expected to be stable for a while.
  • width - A positive integer representing the width of the map.
  • height - A positive integer representing the height of the map.
  • num_players - A positive integer of at least 2 representing the number of players taking part in the game.
  • num_frames - The number of frames encoded in this replay.
  • player_names - An array of strings which correspond to the names of the players, starting with the player with tag 1 and ending with the player with tag num_players.
  • productions - A 2D array of integers which represent the productions of the tiles on the map. These integers fill in the map from row 1 (i.e. the top) to row height and within a row from column 1 to column width and are all guaranteed to be positive and less than 255.
  • frames - A 4D arrays of integers. This is the most complex piece of the file specification, so here it is step by step:
    • The outermost array has length num_frames, and it contains individual frames.
    • The next array inwards has length height, and it contains individual rows of the frame. The first element is the first (top) row and the last is the bottom row.
    • The following array has length width, and it contains individual sites of the frame. The first element is the first (leftmost) column and the last is the rightmost row.
    • The innermost array has length 2 and contains integers. Its contents represent the attributes of a given site. The first element is always the owner of the site and the second element is the strength of the site.
  • moves - A 3D arrays of integers. The outermost array has length num_frames - 1 and contains the moves for an individual frame. Each element is a 2D array of integers which represent the directions chosen to move for every site on the map. As always, the outer layer of the 2D array fills in the rows from top to bottom and the inside layer fills in individual rows from left to right. The integer values for each site are: STILL = 0, NORTH = 1, EAST = 2, SOUTH = 3, and WEST = 4. Sites not owned by any player are assigned the value of 0.


Terms of Service | Privacy Policy