Infinite Maze API - Multi-segment Mazes

This document describes how to implement multi-segment generators (MGs) for the infinite maze.

Middleware-to-MG request

When requesting a maze segment from an MG, the middleware will send data in the HTML packet about the location of the new segment and nearby free space in the maze. The data will be a JSON in this form:

{ 
    "main": [0, 0],
    "free": [-1, 0, 0, 1, 1, 0, 0, -1, ...]
}

In Flask, this data can be accessed with request.json.

MG-to-Middleware response

The MG can respond with data for multiple segments in this format:

{
  "geom": [...],
  "extern": {
    "-1_0": { "geom": [...] },
    "0_1": { "geom": [...] }
  }
}

The MG does not have to provide a segment for all free spaces. In this example, (1, 0) and (0, -1) were also free but the MG did not choose to fill them in.