---
title: Overview
section: GT-Link
order: 1
---

# GT-Link

GT-Link (`gtl/1`) is how a physical prop talks to GridTac: a domination box, a mine, a popper target,
a countdown clock, a GPS beacon, or something we never thought of. It is open: anyone may build a
device that speaks it, sell it, and run it in any GridTac game, **without a change on our side**. Our
own reference firmware is MIT-licensed and the hardware files are CERN-OHL-P.

> **Status: frozen (2026-11-10).** `gtl/1` will not change under you: fields, kinds and vocabulary
> may be added (unknown ones are ignored on both sides), never changed or removed. A breaking change
> would be `gtl/2`, served alongside.

## The idea in five lines

1. A device is **paired** to a player or a club once ([Devices](../api/devices.md)) and gets an opaque
   id (`dev_…`) and its own key (`gt_prop_…`, or `gt_play_…` for a beacon).
2. It says **what it has** in a manifest: buttons, switches, LEDs, a siren, a display. GridTac builds
   the game master's controls from that list; there is no device registry to apply to.
3. The game master **puts it in a game** and gives its inputs a meaning for that game (Red's button,
   the arm key). The firmware never decides who owns what.
4. It sends **events** (`press`, `hold`, `tripped`, `hit`) and its own state. The server decides what
   they mean for the game (a capture, a detonation) and sends **commands** back (light red, sound the
   siren, show the countdown).
5. It **never trusts its own clock**: it counts milliseconds since boot, and the server tells it the
   game time.

## Three ways to connect

| Transport | For | How |
|---|---|---|
| **MQTT** | A device with Wi-Fi or 4G that can hold a connection: the normal case | `wss://mqtt.gridtac.com/mqtt` (MQTT over WebSocket), or `mqtts://mqtt.gridtac.com:8883` (MQTT over TLS) when your library has no WebSocket. Never plaintext. Credentials: `POST /api/v1/prop/mqtt-credentials` with the device key. |
| **HTTPS** | A sleepy or very simple device that wakes, sends and sleeps | `POST /api/v1/prop/events` with the device key: the same messages in one batch; waiting commands and the game clock come back in the answer. |
| **LoRa** (from 1.8) | A field without coverage | A gateway on the field forwards encrypted radio frames; it cannot read or forge them. See [Radio frame](radio.md). |

A GPS beacon is simpler still: it is a player, not a prop, and uses the [player API](../api/play.md)
with its own `gt_play_` key (`POST /api/v1/play/position`). Its position then outranks the player's
phone.

## Topics

All under the device's own id, which the server issued: a device cannot publish anywhere else.

| Topic | Direction | QoS | Retained | Message |
|---|---|---|---|---|
| `gridtac/dev/<id>/hello` | device → server | 1 | yes | The manifest: what the device has |
| `gridtac/dev/<id>/evt` | device → server | 1 | | One input event |
| `gridtac/dev/<id>/state` | device → server | 1 | yes | Its own state (owner, progress, mode) |
| `gridtac/dev/<id>/tele` | device → server | 0 | | Battery, signal, position, uptime |
| `gridtac/dev/<id>/ack` | device → server | 1 | | The answer to a command |
| `gridtac/dev/<id>/lwt` | device → server | 1 | yes | Set as the MQTT last will: `{ "on": false }` |
| `gridtac/dev/<id>/cmd` | server → device | 1 | | A command |
| `gridtac/dev/<id>/game` | server → device | 1 | yes | The game clock: phase, start, end, server time |

Every field of every message: [Message reference](reference.md).

## The rules a device must follow

- **Count boots and events.** Keep a boot counter in flash and add one on every start (`b`); number
  every message within a boot from 0 (`s`). GridTac drops anything it has already seen, so sending an
  event twice, or over both MQTT and HTTPS, never counts twice.
- **Send time since boot, not a clock** (`ms`). GridTac dates each event from the freshest message it
  has had from that boot. Events queued offline are back-dated by at most 15 minutes.
- **Read the game clock.** On every `game` message set `offset = srv - millis()` and draw countdowns
  from `ea - (millis() + offset)`. Not `live`: log inputs but never capture. `paused`: freeze local
  progress (a timer marked `phy`, such as a bomb, keeps running).
- **Answer every command** on `ack` with its `id`. An output, action or field you do not know is
  answered `ok: false` with `err: "unknown_output"` or `"unknown_action"`, never a crash.
- **Ignore unknown fields.** GridTac does the same, so a newer device works with an older server
  and the other way round.
- **Obey `disable`.** The game master can switch every prop of a game off at once: all outputs off,
  inputs ignored, until a `disable` with `on: false`.
- **Fetch new MQTT credentials before `expiresAt`.**

## What GridTac does with it

The game master sees each device in the game with its battery, signal and last seen, binds a box to
a zone, and can switch the whole game's props off. Which side a team button means is the game
master's choice; by default a button labelled like a side means that side, a button labelled with a
colour ("Red") means the side of that colour, and a red press never takes a zone for Blue. A box bound to a zone captures it under the zone's rules (a press, a hold, or a
hold with enough players of that side inside); every event lands in the after-action review. Nothing
a device sends can do more than the game master allowed for that game.

Next: [Build a prop](../guides/build-a-prop.md), a walkthrough from pairing to the first capture.
