Get data from hlt


#1

Hi i want to know how can we get data from the .hlt game file for example the number of ship, the number of dropoff, the directions in which the ships moved during the game etc.I need this data to pass it to my machine learning model.Please help


#2

hlt is simply json encrypted with zstd


#3

However, the format of the JSON is a little surprising :slight_smile: Here are my notes on what’s in it:

The interesting bits of the structure are:

{
  "production_map": 
  {
    "width": 64
    "height": 64
    "grid": 
    [
      [ 
        {
          "energy": 819
        },...
      ],
    ...
    ]
  }
  "full_frames": 
  [
    { "cells": 
      [
        {
          "x": 42
          "production": 139
          "y": 20
        },
		...
      ],
      "entities": 
      {
        "1":  {
          "3": {
            "is_inspired": False
            "y": 21
            "x": 42
            "energy": 0
          }
        },
		...
      },
      "energy":  {
        "1": 3000,
       ...
      },
      "moves": 
      {
        "1":  [  
          {
            "direction": n
            "type": m
            "id": 3
          },
          {
            "type": g
          },
        ],
		...
      },
      "deposited":  {
        "1": 0
        "2": 0
        "3": 0
        "0": 0
      },
      "events": [
        {
          "id": 4,
          "type": spawn,
          "location":  {
            "y": 42
            "x": 42
          },
          "energy": 0,
          "owner_id": 3
        },
      ]
    },
  ]
}

}  

So, the “production_map” entry is an array of arrays, with the initial halite for each square. The “full_frames” entry is an array, with each entry corresponding to a turn. Going into more detail on that array:

  • Weirdly, the first entry is from “before turn 0” - it contains no useful information.
  • After that, the entries are:
    • moves: the commands given on that turn by each player.
    • entities: the ships of each player before the execution of these commands, with halite, inspiration status and position.
    • deposited: the total halite deposited by each player after the execution of these commands.
    • energy: the halite of each player after the execution of these commands.
    • cells: the cells whose halite amounts change after the execution of these commands.
    • events: events for spawn, construct [a dropoff], shipwreck (aka collision), which happen on the execution of these commands

How to use replay files to make a CNN for my bot