NetDeck M0: emulator sandbox + design doc

- src/netdeck: DESIGN.md (RTwP cyber-tactical ship crawler for T-Deck),
  STATUS.md milestone tracker, nd_layout.h shared constants
- examples/NetDeck: M0 sandbox — 40x24 ship floorplan and 8-node sub-net
  in one shared coordinate space (door nodes pinned to bulkhead door
  tiles); Cameras/Network view modes via P (network overlaid as dotted
  outlines vs dimmed ship + full graph); trackball cursor (edge ISRs +
  momentum); Space tactical freeze with CRT scanlines; 20 Hz fixed-step
  sim (pause-verified frame-identical); keyboard @ I2C 0x55 groundwork
  for M2-M4
- emulator: APP=NetDeck support + Tab key host mapping
- platformio.ini: NetDeck src_dir ready for firmware build
This commit is contained in:
Dejvino
2026-11-14 10:37:35 +01:00
parent d542d6ffa7
commit 2bfd6c6428
9 changed files with 1063 additions and 0 deletions
+2
View File
@@ -11,3 +11,5 @@ emulator/seq*.bmp
emulator/mc-prefs.cfg
emulator/*-emu
emulator/*-prefs.cfg
emulator/m0_*.bmp
emulator/m0_*.png
+3
View File
@@ -20,6 +20,9 @@ endif
ifeq ($(APP),CrtTerminal)
APP_TITLE := CRT Terminal
endif
ifeq ($(APP),NetDeck)
APP_TITLE := NetDeck // Breach & Board
endif
ifeq ($(APP),Lotus3)
APP_TITLE := Lotus 3
DEFS += -DEMU_APP_LOTUS3
+3
View File
@@ -141,6 +141,9 @@ int main(int argc, char **argv)
case SDLK_SPACE:
emu::keyboard.push_back(' ');
break;
case SDLK_TAB:
emu::keyboard.push_back('\t');
break;
case SDLK_BACKSPACE:
emu::keyboard.push_back(0x08);
break;
+677
View File
@@ -0,0 +1,677 @@
/**
* @file NetDeck.ino
* @brief NetDeck — Breach & Board: Milestone 0 emulator sandbox.
*
* Milestone 0 (DESIGN.md §7): the Milestone-1 hardware sandbox prepared and
* tested locally, without hardware. This sketch exercises every tech piece
* the real build needs, on the SDL2 emulator first:
*
* - shared tactical view (320x192) + HUD bar, ONE coordinate space:
* bulkhead doors and their network door nodes occupy the same spot
* - two view modes over that space (`P` to switch, `Tab` as legacy alias):
* C) Cameras — full top-down ship view, network overlaid as outlines
* N) Network — ship dimmed underneath, full network graph on top
* - fixed-timestep engine loop (20 Hz sim decoupled from ~30 fps render)
* - trackball cursor with edge-ISR counting + momentum
* - keyboard device @ I2C 0x55: Space = tactical freeze, P = view switch
* - demo floorplan tile map + demo sub-net graph with packet flow
*
* Run on the desktop: make APP=NetDeck run (from emulator/)
* Headless smoke test: make smoke APP=NetDeck
*
* Controls (emulator / device):
* Trackball move cursor (snaps to tiles in Cameras, nodes in Network)
* Enter / click trackball press / screen tap = primary action
* Space toggle tactical freeze (time-stop + CRT scanlines)
* P (or Tab) switch view: Cameras <-> Network
* 1-4 arm slotted exploit daemon (groundwork, flashes slot)
* X / R / Q / E sever link / retreat / cycle (groundwork, logged)
*/
#include <Arduino.h>
#include <SPI.h>
#include <TFT_eSPI.h>
#include <Wire.h>
#include "utilities.h"
#include "TouchDrvGT911.hpp"
#include "../../src/netdeck/nd_layout.h"
// ---------------------------------------------------------------------------
// Hardware
// ---------------------------------------------------------------------------
TFT_eSPI tft;
TouchDrvGT911 touch;
static bool touchAvail = false;
// ---------------------------------------------------------------------------
// Game state
// ---------------------------------------------------------------------------
enum GameState { ST_BOOT, ST_RUN };
static GameState gameState = ST_BOOT;
enum ViewMode { VM_CAMERAS, VM_NETWORK };
static ViewMode viewMode = VM_CAMERAS;
static uint32_t stateT0 = 0;
static bool paused = false;
static uint32_t simTick = 0; // 20 Hz deterministic ticks
static uint32_t simAcc = 0; // fixed-timestep accumulator
static uint32_t lastFrameMs = 0;
// ---------------------------------------------------------------------------
// Demo deck floorplan (40x24 tile grid; DESIGN.md §3 shared tactical view)
// '#' wall '.' floor 'o' cover crate '+' bulkhead door 'A' airlock
// Rooms: left hull (w/ Security), top-mid lab, bottom-mid hold (Power),
// right server vault (Droid Hive). Bulkhead doors are network door nodes.
// ---------------------------------------------------------------------------
static const char *const DEMO_MAP[nd::TILE_ROWS] = {
"########################################",
"#...........#.............#............#",
"#..o........#.............#...o........#",
"#...........#....o........#............#",
"#..........+.............#............#",
"#...........#.........o...#............#",
"#.......o...#.............#.........o..#",
"#...........#.............#............#",
"#...........######+#######............#",
"#...........#.............#............#",
"#.o.........#.............#............#",
"#...........#.............+............#",
"#...........#..o..........#............#",
"#...........#.............#............#",
"#........o..#.............#.o..........#",
"#...........#.............#............#",
"#...........#........o....#............#",
"#...........#.............#............#",
"#..........+.............#......o....#",
"#...o......#.............#............#",
"#...........#...........o#............#",
"#.A.........#.............#....o......#",
"#...........#.............#............#",
"########################################",
};
static const int AIRLOCK_TX = 2, AIRLOCK_TY = 21; // breach entry tile
// ---------------------------------------------------------------------------
// Demo sub-net graph — same coordinate space as the floorplan
// (tile coords; door nodes sit exactly on their bulkhead door tiles)
// ---------------------------------------------------------------------------
struct NetNode {
const char *label;
int tx, ty; // tile coords (px center = tile*8+4)
uint16_t color;
uint8_t type; // 0 junction, 1 ICE, 2 hive, 3 door controller
};
enum { NN_AIRLK, NN_SEC, NN_D1, NN_D2, NN_D3, NN_D4, NN_PWR, NN_HIVE };
static const NetNode NODES[8] = {
{ "AIRLK", 2, 21, nd::C_AIRLOCK, 0 },
{ "SEC", 6, 6, nd::C_ICE, 1 },
{ "DOOR1", 12, 4, nd::C_DOOR, 3 },
{ "DOOR2", 12, 18, nd::C_DOOR, 3 },
{ "DOOR3", 19, 8, nd::C_DOOR, 3 },
{ "DOOR4", 26, 11, nd::C_DOOR, 3 },
{ "PWR", 19, 14, nd::C_NODE, 0 },
{ "HIVE", 33, 5, nd::C_HIVE, 2 },
};
static const uint8_t LINKS[7][2] = {
{ NN_AIRLK, NN_D2 }, { NN_D2, NN_PWR }, { NN_PWR, NN_D4 },
{ NN_D4, NN_HIVE }, { NN_PWR, NN_D3 }, { NN_D3, NN_D1 }, { NN_D1, NN_SEC },
};
// packet flow path AIRLK -> DOOR2 -> PWR -> DOOR4 -> HIVE
static const uint8_t PACKET_PATH[5] = { NN_AIRLK, NN_D2, NN_PWR, NN_D4, NN_HIVE };
static int nodePx(int i) { return NODES[i].tx * nd::TILE + nd::TILE / 2; }
static int nodePy(int i) { return NODES[i].ty * nd::TILE + nd::TILE / 2; }
// ---------------------------------------------------------------------------
// Cursor (shared space; snaps to tiles in Cameras, nodes targeted in Network)
// ---------------------------------------------------------------------------
static int curX = 60, curY = 120;
// Squad priority beacon (tile coords), starts at the airlock
static int beaconTX = AIRLOCK_TX, beaconTY = AIRLOCK_TY;
// transient UI feedback
static uint32_t viewFlashUntil = 0; // frame flash after view switch
static uint32_t slotFlash = 0xFF; // daemon slot flash id + expiry pair
static uint32_t slotFlashUntil = 0;
static int nodeFlash = -1; // clicked net node highlight
static uint32_t nodeFlashUntil = 0;
// ---------------------------------------------------------------------------
// Trackball input — edge-counting ISRs + momentum model
// Quadrant pins + center click, per UnitTest's mouse mapping:
// G02 -> right, G01 -> up, G04 -> left, G03 -> down, BOOT -> click
// ---------------------------------------------------------------------------
static volatile uint32_t tbEdges[4];
static volatile uint32_t tbClicks;
static void IRAM_ATTR tbIsrRight() { tbEdges[0]++; }
static void IRAM_ATTR tbIsrUp() { tbEdges[1]++; }
static void IRAM_ATTR tbIsrLeft() { tbEdges[2]++; }
static void IRAM_ATTR tbIsrDown() { tbEdges[3]++; }
static void IRAM_ATTR tbIsrClick() { tbClicks++; }
static const int TB_FP = 8; // velocity fixed point
#ifdef EMULATOR
static const int TB_IMPULSE = 6; // emulated: rich edge rate
static const int TB_FRICTION = 12; // velocity kept per frame (of 16)
#else
static const int TB_IMPULSE = 24; // device: fewer edges to move
static const int TB_FRICTION = 15;
#endif
static const int TB_VMAX = 24 << TB_FP; // hard-flick cap
static int32_t tbVelX, tbVelY; // momentum, 1/8 px per frame
static int32_t tbRemX, tbRemY; // sub-pixel accumulators
static void attachTrackball()
{
static const uint8_t tbPins[5] = {
BOARD_TBOX_G02, BOARD_TBOX_G01, BOARD_TBOX_G04, BOARD_TBOX_G03, BOARD_BOOT_PIN
};
for (int i = 0; i < 5; i++) pinMode(tbPins[i], INPUT_PULLUP);
attachInterrupt(digitalPinToInterrupt(tbPins[0]), tbIsrRight, FALLING);
attachInterrupt(digitalPinToInterrupt(tbPins[1]), tbIsrUp, FALLING);
attachInterrupt(digitalPinToInterrupt(tbPins[2]), tbIsrLeft, FALLING);
attachInterrupt(digitalPinToInterrupt(tbPins[3]), tbIsrDown, FALLING);
attachInterrupt(digitalPinToInterrupt(tbPins[4]), tbIsrClick, FALLING);
}
static void resetTrackball()
{
for (int i = 0; i < 4; i++) tbEdges[i] = 0;
tbClicks = 0;
tbVelX = tbVelY = 0;
tbRemX = tbRemY = 0;
}
static void clampCursor()
{
if (curX < 0) curX = 0;
if (curX > nd::VIEW_W - 1) curX = nd::VIEW_W - 1;
if (curY < 0) curY = 0;
if (curY > nd::VIEW_H - 1) curY = nd::VIEW_H - 1;
}
// ---------------------------------------------------------------------------
// View mode
// ---------------------------------------------------------------------------
static void toggleView()
{
viewMode = (viewMode == VM_CAMERAS) ? VM_NETWORK : VM_CAMERAS;
viewFlashUntil = millis() + 350;
Serial.printf("[key] view -> %s\n",
viewMode == VM_CAMERAS ? "CAMERAS" : "NETWORK");
}
// ---------------------------------------------------------------------------
// Primary action (groundwork: M3 beacon placement, M2 node routing)
// ---------------------------------------------------------------------------
static void registerClick()
{
if (viewMode == VM_CAMERAS) {
int tx = curX / nd::TILE, ty = curY / nd::TILE;
char t = DEMO_MAP[ty][tx];
if (t != '#') { // beacons can't sit inside walls
beaconTX = tx;
beaconTY = ty;
Serial.printf("[click] beacon -> tile %d,%d\n", tx, ty);
} else {
Serial.println("[click] wall tile: beacon ignored");
}
} else {
// nearest demo node flash (routing groundwork for Milestone 2)
int best = -1, bestD = 1 << 30;
for (int i = 0; i < 8; i++) {
int dx = curX - nodePx(i);
int dy = curY - nodePy(i);
int d = dx * dx + dy * dy;
if (d < bestD) { bestD = d; best = i; }
}
nodeFlash = best;
nodeFlashUntil = millis() + 400;
Serial.printf("[click] node %s targeted\n", NODES[best].label);
}
}
// ---------------------------------------------------------------------------
// Keyboard device @ I2C 0x55
// ---------------------------------------------------------------------------
static void handleKey(char c)
{
switch (c) {
case ' ':
paused = !paused;
Serial.printf("[key] tactical freeze %s\n", paused ? "ON" : "OFF");
break;
case 'p': case '\t': // '\t' kept as legacy alias for the pane era
toggleView();
break;
case '1': case '2': case '3': case '4':
slotFlash = c - '1';
slotFlashUntil = millis() + 400;
Serial.printf("[key] arm daemon slot %d (M4 groundwork)\n", c - '1');
break;
case 'x':
Serial.println("[key] kill-switch sever (M2 groundwork)");
break;
case 'r':
Serial.println("[key] tactical retreat (M3 groundwork)");
beaconTX = AIRLOCK_TX;
beaconTY = AIRLOCK_TY;
break;
case 'q': case 'e':
Serial.printf("[key] cycle %s (M2 groundwork)\n", c == 'q' ? "back" : "fwd");
break;
default:
break;
}
}
static void pollKeyboard()
{
static char lastKey = 0;
Wire.requestFrom((uint8_t)0x55, (uint8_t)1);
if (Wire.available() == 0) {
lastKey = 0; // idle: arm the next press (same key can repeat)
return;
}
char k = (char)Wire.read();
if (k == 0) { lastKey = 0; return; }
if (k == lastKey) return;
lastKey = k;
handleKey((char)tolower(k));
}
// ---------------------------------------------------------------------------
// Touch (screen tap = move cursor + primary action)
// ---------------------------------------------------------------------------
static void pollTouch()
{
if (!touchAvail) return;
static bool wasDown = false;
bool down = touch.isPressed();
if (!down) { wasDown = false; return; }
if (wasDown) return; // only act on new taps
int16_t x[1], y[1];
if (touch.getPoint(x, y, 1) > 0) {
wasDown = true;
curX = x[0];
curY = y[0];
clampCursor();
registerClick();
}
}
// ---------------------------------------------------------------------------
// Trackball -> cursor (momentum, capped; cursor stays live during the freeze
// because planning happens while paused)
// ---------------------------------------------------------------------------
static void applyTrackball()
{
uint32_t e[4], clicks;
for (int i = 0; i < 4; i++) { e[i] = tbEdges[i]; tbEdges[i] = 0; }
clicks = tbClicks;
tbClicks = 0;
tbVelX += ((int32_t)e[0] - (int32_t)e[2]) * TB_IMPULSE;
tbVelY += ((int32_t)e[3] - (int32_t)e[1]) * TB_IMPULSE;
if (tbVelX > TB_VMAX) tbVelX = TB_VMAX;
if (tbVelX < -TB_VMAX) tbVelX = -TB_VMAX;
if (tbVelY > TB_VMAX) tbVelY = TB_VMAX;
if (tbVelY < -TB_VMAX) tbVelY = -TB_VMAX;
tbVelX = tbVelX * TB_FRICTION / 16;
tbVelY = tbVelY * TB_FRICTION / 16;
tbRemX += tbVelX;
tbRemY += tbVelY;
int pxX = tbRemX / TB_FP;
int pxY = tbRemY / TB_FP;
tbRemX -= pxX * TB_FP;
tbRemY -= pxY * TB_FP;
if (pxX || pxY) {
curX += pxX;
curY += pxY;
clampCursor();
}
if (clicks) registerClick();
}
// ---------------------------------------------------------------------------
// Simulation — deterministic 20 Hz ticks (grows into M2/M3 systems)
// ---------------------------------------------------------------------------
static void stepSim()
{
simTick++;
}
// ---------------------------------------------------------------------------
// Rendering
// ---------------------------------------------------------------------------
// palette color of a map tile
static uint16_t tileColor(char t)
{
switch (t) {
case '#': return nd::C_WALL;
case 'o': return nd::C_COVER;
case '+': return nd::C_DOOR;
case 'A': return nd::C_AIRLOCK;
default: return nd::C_FLOOR;
}
}
// ~35% brightness ghost of an RGB565 color (Network mode dims the ship view)
static uint16_t dim565(uint16_t c)
{
uint32_t r = (((c >> 11) & 0x1F) * 22) >> 6;
uint32_t g = (((c >> 5) & 0x3F) * 22) >> 6;
uint32_t b = ((c & 0x1F) * 22) >> 6;
return (uint16_t)((r << 11) | (g << 5) | b);
}
static void renderMap(bool dim)
{
for (int ty = 0; ty < nd::TILE_ROWS; ty++) {
const char *row = DEMO_MAP[ty];
for (int tx = 0; tx < nd::TILE_COLS; tx++) {
uint16_t c = tileColor(row[tx]);
if (dim) c = dim565(c);
tft.fillRect(tx * nd::TILE, ty * nd::TILE, nd::TILE, nd::TILE, c);
if (row[tx] == 'A') { // airlock outline pops on the floor
tft.drawRect(tx * nd::TILE, ty * nd::TILE, nd::TILE, nd::TILE,
dim ? dim565(nd::C_FLOOR) : nd::C_FLOOR);
}
}
}
}
static void renderNetwork(bool full)
{
// links: solid trace (Network) vs dotted ghost outline (Cameras)
for (auto &l : LINKS) {
int x0 = nodePx(l[0]), y0 = nodePy(l[0]);
int x1 = nodePx(l[1]), y1 = nodePy(l[1]);
if (full) {
tft.drawLine(x0, y0, x1, y1, nd::C_LINK);
} else {
// dotted line: every other pixel of a Bresenham walk
int dx = abs(x1 - x0), sx = x0 < x1 ? 1 : -1;
int dy = -abs(y1 - y0), sy = y0 < y1 ? 1 : -1;
int err = dx + dy, step = 0;
for (;;) {
if ((step++ & 1) == 0) tft.drawPixel(x0, y0, nd::C_GHOST);
if (x0 == x1 && y0 == y1) break;
int e2 = 2 * err;
if (e2 >= dy) { err += dy; x0 += sx; }
if (e2 <= dx) { err += dx; y0 += sy; }
}
}
}
// data packets flowing along the packet path (freeze with the sim)
int segs = 4, per = 36;
int tt = (int)(simTick % (uint32_t)(segs * per));
int seg = tt / per, f = tt % per;
int a = PACKET_PATH[seg], b = PACKET_PATH[seg + 1];
int px = nodePx(a) + (nodePx(b) - nodePx(a)) * f / per;
int py = nodePy(a) + (nodePy(b) - nodePy(a)) * f / per;
tft.fillCircle(px, py, full ? 2 : 1, nd::C_PACKET);
if (full) tft.drawPixel(px, py, TFT_WHITE);
// nodes: filled icons + labels (Network) vs hollow outlines (Cameras)
for (int i = 0; i < 8; i++) {
int nx = nodePx(i), ny = nodePy(i);
bool flashing = (nodeFlash == i && (int32_t)(millis() - nodeFlashUntil) < 0);
if (full) {
tft.fillCircle(nx, ny, 6, flashing ? nd::C_CURSOR : NODES[i].color);
tft.drawCircle(nx, ny, 6, TFT_BLACK);
tft.setTextDatum(TC_DATUM);
tft.setTextColor(nd::C_TEXTDIM);
tft.drawString(NODES[i].label, nx, ny + 9);
} else {
tft.drawCircle(nx, ny, 6, flashing ? nd::C_CURSOR : nd::C_GHOST);
}
}
if (full) {
tft.setTextDatum(TL_DATUM);
tft.setTextColor(nd::C_TEXTDIM);
tft.drawString("NETWORK", 4, 4);
}
}
static void renderBeacon()
{
// squad priority beacon (cyan diamond at the beacon tile center)
int bx = beaconTX * nd::TILE + nd::TILE / 2;
int by = beaconTY * nd::TILE + nd::TILE / 2;
uint16_t c = (viewMode == VM_NETWORK) ? dim565(nd::C_BEACON) : nd::C_BEACON;
tft.fillTriangle(bx, by - 3, bx + 3, by, bx, by + 3, c);
tft.fillTriangle(bx, by - 3, bx - 3, by, bx, by + 3, c);
}
static void meterBar(int x, int y, int w, int h, int pct, uint16_t c)
{
tft.drawRect(x, y, w, h, nd::C_BORDER);
int fw = (w - 2) * pct / 100;
if (fw > 0) tft.fillRect(x + 1, y + 1, fw, h - 2, c);
}
static void renderHud()
{
tft.fillRect(nd::HUD_X, nd::HUD_Y, nd::HUD_W, nd::HUD_H, nd::C_HUDBG);
tft.drawFastHLine(nd::HUD_X, nd::HUD_Y, nd::HUD_W, nd::C_BORDER);
// 4 exploit daemon slots: keycap, name, cooldown bar
static const char *const NAMES[4] = { "FRENZY", "BLIND", "OVRCLK", "PATCH" };
static const int COOL[4] = { 30, 55, 80, 45 };
for (int i = 0; i < 4; i++) {
int x = 6 + i * 58, y = nd::HUD_Y + 6;
bool flashing = (slotFlash == (uint32_t)i && (int32_t)(millis() - slotFlashUntil) < 0);
uint16_t tc = flashing ? nd::C_CURSOR : nd::C_TEXT;
tft.setTextColor(tc);
tft.setTextDatum(TL_DATUM);
tft.drawString(String("[") + char('1' + i) + "]", x, y);
tft.setTextColor(nd::C_TEXTDIM);
tft.drawString(NAMES[i], x + 18, y);
meterBar(x, y + 14, 48, 6, COOL[i], nd::C_GOOD);
}
// RAM + thermal load
tft.setTextColor(nd::C_TEXT);
tft.drawString("RAM 4/6", 246, nd::HUD_Y + 6);
meterBar(246, nd::HUD_Y + 16, 56, 7, 42, nd::C_WARN);
tft.setTextColor(nd::C_TEXTDIM);
tft.drawString("TEMP", 246, nd::HUD_Y + 25);
// pause hint / state
tft.setTextDatum(TR_DATUM);
tft.setTextColor(paused ? nd::C_FREEZE : nd::C_TEXT);
tft.drawString("SPACE", nd::HUD_X + nd::HUD_W - 6, nd::HUD_Y + 6);
tft.setTextColor(paused ? nd::C_FREEZE : nd::C_TEXTDIM);
tft.drawString(paused ? "RESUME" : "PAUSE", nd::HUD_X + nd::HUD_W - 6, nd::HUD_Y + 16);
tft.setTextDatum(TL_DATUM);
// view mode indicator
tft.setTextColor(nd::C_FREEZE);
tft.setTextDatum(TR_DATUM);
tft.drawString(viewMode == VM_CAMERAS ? "VIEW: CAMERAS [P]" : "VIEW: NETWORK [P]",
nd::HUD_X + nd::HUD_W - 6, nd::HUD_Y + 32);
tft.setTextDatum(TL_DATUM);
// squad health pips
tft.setTextColor(nd::C_TEXTDIM);
tft.drawString("SQUAD", 6, nd::HUD_Y + 30);
static const int HP[3] = { 4, 5, 2 }; // of 5 (M3 groundwork)
for (int i = 0; i < 3; i++) {
int x = 48 + i * 58;
for (int s = 0; s < 5; s++) {
uint16_t c = s < HP[i] ? nd::C_GOOD : nd::C_BORDER;
tft.fillRect(x + s * 8, nd::HUD_Y + 34, 6, 8, c);
}
tft.setTextColor(nd::C_TEXTDIM);
tft.drawString(String("M") + String(i + 1), x - 10, nd::HUD_Y + 30);
}
}
static void renderCursor()
{
uint16_t c = (viewMode == VM_NETWORK) ? nd::C_PACKET : nd::C_CURSOR;
if (viewMode == VM_CAMERAS) {
// tile snap highlight + crosshair
int tx = curX / nd::TILE, ty = curY / nd::TILE;
tft.drawRect(tx * nd::TILE, ty * nd::TILE, nd::TILE, nd::TILE, c);
tft.drawCircle(curX, curY, 3, c);
tft.drawPixel(curX, curY, c);
} else {
tft.drawCircle(curX, curY, 4, c);
tft.drawCircle(curX, curY, 1, c);
}
}
// CRT freeze tint: scanlines over the view + status text (DESIGN.md §4)
static void renderFreezeTint()
{
for (int y = 0; y < nd::VIEW_H; y += 3) {
tft.drawFastHLine(0, y, nd::VIEW_W, 0x0000);
}
tft.setTextDatum(TR_DATUM);
tft.setTextColor(nd::C_FREEZE, 0x0000);
if ((millis() / 500) & 1) {
tft.drawString("* TACTICAL FREEZE *", nd::VIEW_W - 4, 4);
}
tft.setTextDatum(TL_DATUM);
}
static void render()
{
renderMap(viewMode == VM_NETWORK);
renderNetwork(viewMode == VM_NETWORK);
renderBeacon();
renderHud();
// HUD separator (flashes when the view mode switches)
uint16_t bc = (int32_t)(millis() - viewFlashUntil) < 0 ? nd::C_CURSOR : nd::C_BORDER;
tft.drawFastHLine(nd::HUD_X, nd::HUD_Y - 1, nd::HUD_W, bc);
if ((int32_t)(millis() - viewFlashUntil) < 0) {
tft.drawRect(0, 0, nd::VIEW_W, nd::VIEW_H, nd::C_CURSOR);
}
renderCursor();
if (paused) renderFreezeTint();
}
// ---------------------------------------------------------------------------
// Boot screen
// ---------------------------------------------------------------------------
static void drawBoot()
{
tft.fillScreen(TFT_BLACK);
tft.setFreeFont(&FreeSansBold18pt7b);
tft.setTextDatum(MC_DATUM);
tft.setTextColor(nd::C_FREEZE);
tft.drawString("NETDECK", 160, 74);
tft.setTextColor(nd::C_CURSOR);
tft.drawString("BREACH & BOARD", 160, 108);
tft.setTextFont(2);
tft.setTextColor(nd::C_TEXTDIM);
tft.drawString("M0 // EMULATOR SANDBOX", 160, 136);
tft.drawString("p: cameras/network space: freeze", 160, 158);
tft.drawString("ball: cursor enter: select", 160, 174);
tft.setTextDatum(TL_DATUM);
tft.setTextFont(1);
}
// ---------------------------------------------------------------------------
// Setup / loop
// ---------------------------------------------------------------------------
static void hardwareInit()
{
Serial.begin(115200);
Serial.println("NetDeck M0 — emulator sandbox");
pinMode(BOARD_POWERON, OUTPUT); // power rail first (battery boot)
digitalWrite(BOARD_POWERON, HIGH);
// CS lines high during init
pinMode(BOARD_SDCARD_CS, OUTPUT);
pinMode(RADIO_CS_PIN, OUTPUT);
pinMode(BOARD_TFT_CS, OUTPUT);
digitalWrite(BOARD_SDCARD_CS, HIGH);
digitalWrite(RADIO_CS_PIN, HIGH);
digitalWrite(BOARD_TFT_CS, HIGH);
pinMode(BOARD_SPI_MISO, INPUT_PULLUP);
SPI.begin(BOARD_SPI_SCK, BOARD_SPI_MISO, BOARD_SPI_MOSI);
tft.begin();
tft.setRotation(1);
tft.fillScreen(TFT_BLACK);
pinMode(BOARD_BL_PIN, OUTPUT);
digitalWrite(BOARD_BL_PIN, HIGH);
Wire.begin(BOARD_I2C_SDA, BOARD_I2C_SCL);
touch.setPins(-1, BOARD_TOUCH_INT);
touchAvail = touch.begin(Wire);
if (touchAvail) {
touch.setMaxCoordinates(tft.width(), tft.height());
touch.setSwapXY(true);
touch.setMirrorXY(false, true);
}
attachTrackball();
randomSeed(esp_random());
}
void setup()
{
hardwareInit();
drawBoot();
stateT0 = millis();
lastFrameMs = stateT0;
}
void loop()
{
uint32_t now = millis();
if (gameState == ST_BOOT) {
if (now - stateT0 >= nd::BOOT_MS) {
gameState = ST_RUN;
stateT0 = now;
resetTrackball(); // swallow stale edges from floating pins
Serial.println("[boot] entering sandbox (view: cameras)");
}
delay(1);
return;
}
// frame pacing ~30 fps
static uint32_t nextFrame = 0;
if ((int32_t)(now - nextFrame) < 0) { delay(1); return; }
nextFrame = now + nd::FRAME_MS;
uint32_t dt = now - lastFrameMs;
lastFrameMs = now;
if (dt > 200) dt = 200; // clamp hiccups (debug stalls, USB pauses)
applyTrackball();
pollTouch();
pollKeyboard();
// fixed-timestep simulation (DESIGN.md §6)
if (!paused) {
simAcc += dt;
while (simAcc >= nd::SIM_TICK_MS) {
stepSim();
simAcc -= nd::SIM_TICK_MS;
}
}
render();
}
+85
View File
@@ -0,0 +1,85 @@
/**
* @file utilities.h
* @author Lewis He (lewishe@outlook.com)
* @license MIT
* @copyright Copyright (c) 2023 Shenzhen Xin Yuan Electronic Technology Co., Ltd
* @date 2023-04-11
*
*/
#pragma once
//! The board peripheral power control pin needs to be set to HIGH when using the peripheral
#define BOARD_POWERON 10
#define BOARD_I2S_WS 5
#define BOARD_I2S_BCK 7
#define BOARD_I2S_DOUT 6
#define BOARD_I2C_SDA 18
#define BOARD_I2C_SCL 8
#define BOARD_BAT_ADC 4
#define BOARD_TOUCH_INT 16
#define BOARD_KEYBOARD_INT 46
#define BOARD_SDCARD_CS 39
#define BOARD_TFT_CS 12
#define RADIO_CS_PIN 9
#define BOARD_TFT_DC 11
#define BOARD_TFT_BACKLIGHT 42
#define BOARD_SPI_MOSI 41
#define BOARD_SPI_MISO 38
#define BOARD_SPI_SCK 40
#define BOARD_TBOX_G02 2
#define BOARD_TBOX_G01 3
#define BOARD_TBOX_G04 1
#define BOARD_TBOX_G03 15
#define BOARD_ES7210_MCLK 48
#define BOARD_ES7210_LRCK 21
#define BOARD_ES7210_SCK 47
#define BOARD_ES7210_DIN 14
#define RADIO_BUSY_PIN 13
#define RADIO_RST_PIN 17
#define RADIO_DIO1_PIN 45
#define BOARD_BOOT_PIN 0
#define BOARD_BL_PIN 42
#define BOARD_GPS_TX_PIN 43
#define BOARD_GPS_RX_PIN 44
#ifndef RADIO_FREQ
#define RADIO_FREQ 868.0
#endif
#ifndef RADIO_BANDWIDTH
#define RADIO_BANDWIDTH 125.0
#endif
#ifndef RADIO_SF
#define RADIO_SF 10
#endif
#ifndef RADIO_CR
#define RADIO_CR 6
#endif
#ifndef RADIO_TX_POWER
#define RADIO_TX_POWER 22
#endif
#define DEFAULT_OPA 100
+1
View File
@@ -35,6 +35,7 @@ default_envs = T-Deck
;src_dir = examples/CrtTerminal
;src_dir = examples/NoiseSensor
; src_dir = examples/MissileCommand
; src_dir = examples/NetDeck
src_dir = examples/MiataDrive
+181
View File
@@ -0,0 +1,181 @@
# Game Design Document: NetDeck — Breach & Board
**Target Hardware:** LILYGO T-Deck / T-Deck Plus (ESP32-S3, 320x240 ST7789 IPS Display, I²C QWERTY Keyboard, Quadrature Trackball)
**Genre:** Real-Time-with-Pause (RTwP) Cyber-Tactical Ship Crawler
**Session Length:** 10–15 minutes per run (3–5 derelict decks per sector)
**Visual Style:** High-contrast 16-bit cyberpunk pixel art + crisp vector network overlays (RGB565)
---
## 1. High Concept & Core Fantasy
You are not a soldier on the ground—you are the **Tactical Netrunner** strapped into a ruggedized portable cyberdeck in the breach airlock. Your 3-person marine fireteam is breaching derelict megacorp vessels overrun by rogue security droids and hostile ship-AI subsystems.
Your marines are brave, heavily armed, and hopelessly outmatched by armored combat droids in a straight firefight. **Your T-Deck *is* the in-universe hardware.** You pause time (`Space`), route signal bridges across the ship's corrupted local network, compile offensive viruses, and inject live payloads directly into enemy droids and ship systems—turning automated turrets against their masters, blinding droid optics while your squad crosses a kill-zone, or detonating an overclocked mech inside a choke point.
---
## 2. Core Gameplay Loop
1. **Infiltrate (Sector Map — 30 sec):** Choose the next derelict ship compartment or cargo barge on a branching 4-node sector graph (e.g., *Med-Bay*, *Reactor Core*, *Server Vault*, *Command Bridge*).
2. **Breach & Plan (Tactical Freeze — `Space`):** Every encounter starts paused. Inspect the 6–8 room ship cross-section in **Cameras** view (`P` to flip to **Network** view) — both layers share one coordinate space, so the network is always overlaid exactly on the rooms it spans. Place squad waypoint beacons and queue your initial network link.
3. **Execute & Adapt (Real-Time Simulation):** Unpause. Your marines advance autonomously toward your priority beacon, taking cover and engaging targets. Simultaneously, packets flow across your network links while the enemy Ship-AI traces your intrusion and launches counter-viruses.
4. **Extract & Upgrade (1 min):** Clear all hostile droids or extract the ship's Data Core. Spend harvested **Scrap** and **Cycles** to upgrade marine gear, unlock new exploit daemons, or expand your deck's RAM/thermal capacity.
---
## 3. Screen Architecture (320x240 Pixel Budget)
The 320x240 display is partitioned into a full-width **Shared Tactical View** plus the HUD bar. Physical reality and the logical network occupy the **same coordinate space**: a bulkhead door in the ship cross-section has its network **Door Node** rendered at the exact same spot, so a signal path visually corresponds to a physical route through the ship:
```text
+-------------------------------------------------------------+
| SHARED TACTICAL VIEW (320 x 192) |
| |
| C) CAMERAS MODE N) NETWORK MODE |
| - full top-down ship view - ship view dimmed underneath |
| - Marines, Droids, - full network graph on top: |
| Turrets, doors 5 to 7 nodes, live packet |
| - network lightly flow, ICE locks & traces, |
| overlaid as outlines counter-virus waves |
| - Priority Beacon marker |
| |
+-------------------------------------------------------------+
| DECK HUD (320 x 48) |
| [1:FRENZY] [2:BLIND] [3:OVRCLK] [4:PATCH] | RAM:4/6 TEMP:42%|
| SQUAD: [M1:||||.] [M2:|||||] [3:||...] | [SPACE: PAUSE] |
+-------------------------------------------------------------+
```
* **Shared Tactical View (`320x192`) — two render modes over one 40x24 tile grid (`8x8` tiles):**
* **Cameras mode (`C` key / default):** the physical deck is fully visible — walls, blast doors, cover crates, marines, and droids rendered in muted steel-blues and industrial grays so bright neon projectiles and virus status indicators pop immediately. The network is **lightly overlaid as outlines**: nodes as hollow `12x12` icon outlines, links as thin dim traces.
* **Network mode (`N` key):** the physical view is **dimmed** (desaturated palette ghosts) and the network is drawn **fully on top**: filled `12x12` node icons, solid links pulsing with animated data packets showing bandwidth direction and trace progress, node labels.
* `P` toggles between the modes at any time, including mid-freeze while planning.
* **Bottom Bar — Cyberdeck HUD (`320x48`):** Displays your 4 slotted exploit daemons with cooldown bars, available **RAM**, **CPU Thermal Load** (overheating locks out commands for 4 seconds), your 3 marines' health/suppression pips, and the current view mode.
---
## 4. Controls & Hardware Mapping
Designed specifically around the T-Deck's dual-hand ergonomics (left thumb on QWERTY, right thumb on trackball):
| Input | Action | Context |
| --- | --- | --- |
| **`Space`** | **Toggle Tactical Freeze (Pause / Resume)** | Global (instant time-stop with CRT scanline tint) |
| **Trackball Move** | Move cursor smoothly across the view | Cursor snaps to tiles (Cameras) or nodes (Network) |
| **Trackball Click** | **Primary Action** | Cameras: Drop Squad Priority Beacon / Toggle Door<br>
<br>Network: Select Node / Route Link |
| **`P`** | **Switch View: Cameras ⇄ Network** | Flips the render mode over the shared coordinate space; `Tab` is a legacy alias |
| **`1` – `4**` | **Execute / Arm Slotted Exploit Daemon** | Injects selected virus into the currently targeted node |
| **`X`** | **Sever Link (Kill-Switch)** | Immediately cuts the highlighted network bridge to stop enemy counter-hacks |
| **`R`** | **Order Tactical Retreat** | Recalls squad toward the breach airlock |
| **`Q` / `E**` | **Cycle Target Node / Squad Focus** | Quick keyboard-only target cycling |
---
## 5. Dual-Layer Mechanics: Squad vs. Sub-Net
### A. The Boarding Squad (Autonomous Tactical AI)
You do not micromanage individual footsteps or shots. Instead, you command via **Intent**:
* **3 Marine Classes:**
1. **Breacher (Shotgun / Weld Torch):** High armor, prioritizes front-line cover, automatically welds open sealed doors when near your beacon.
2. **Gunner (Pulse Rifle):** Suppresses droids, pinning them in place and reducing their movement speed.
3. **Tech-Medic (Carbine / Nanite Kit):** Automatically heals adjacent wounded marines when out of direct line-of-fire and deploys portable signal repeaters.
* **Squad AI Behavior:** Marines pathfind toward your **Priority Beacon** using A* / BFS, automatically snapping to adjacent cover tiles when enemies enter line-of-sight.
### B. The Sub-Net & Offensive Viruses
You start connected only to the **Airlock Access Node**. To affect droids deep inside the ship, you must establish a chain of links across intermediate junctions (`Power`, `Comms`, `Security`, `Droid Hive`).
* **Node Types:**
* **Junction:** Unprotected relay; fast to bridge, zero bandwidth penalty.
* **ICE-Locked Firewall:** Requires holding a link for 3 seconds to crack before traffic passes through.
* **Droid Hive Node:** Controls all security droids in a specific room group. Once bridged, any exploit (`1-4`) you trigger injects directly into every droid linked to that hive!
* **Door / Turret Controller:** Toggling this node lets you slam blast doors shut (splitting enemy groups) or flip ceiling turrets to friendly fire.
* **Starter Exploit Daemons (Keys `1`–`4`):**
1. **`FRENZY.EXE` (2 RAM):** Corrupts droid IFF targeting for 6 seconds. Infected droids immediately shoot the nearest unit—friend or foe.
2. **`BLIND_OPTICS.SH` (1 RAM):** Floods droid visual sensors with static for 8 seconds. Accuracy drops by 80%, letting your squad rush across open corridors safely.
3. **`OVERCLOCK.BIN` (3 RAM):** Forces droid servos past thermal limits. They move and fire 50% faster for 4 seconds, then **violently explode**, dealing heavy AoE damage to adjacent tiles.
4. **`ICE_PATCH.SYS` (1 RAM):** Purges an enemy counter-virus creeping down one of your active links and cools your deck's CPU temp by 15%.
### C. Enemy Counter-Hacking (The Tension Engine)
Whenever you maintain a link to a **Droid Hive** or **Turret Node**, the Ship-AI initiates a **Trace**:
* A red pulse travels backward from the enemy node toward your Airlock Node along your active links.
* If the red trace reaches your Airlock Node, it triggers a **Feedback Spike**: your CPU Temp jumps +50%, your active links drop, and a random room near your squad vents oxygen or spawns reinforcements.
* **Counterplay:** Watch the trace pulse in real time, hit `X` to sever the link at the last millisecond before the spike hits your airlock, let things cool down, and re-engage from a different angle.
---
## 6. ESP32-S3 Technical Architecture
### Memory & Framebuffer Budget
* **Display Buffer:** `320 * 240 * 2 bytes (RGB565) = 153,600 bytes (~150 KB)`. Allocate two DMA-capable buffers in internal SRAM (`heap_caps_malloc(153600, MALLOC_CAP_DMA)`) for tear-free double-buffered SPI transfers to the ST7789 display.
* **Game State & Sprites:** Store static sprite atlases (`8x8` and `16x16` RGB565 bitmaps + 1-bit transparency masks) in Flash (`PROGMEM` / `const`), and keep active level grids, A* pathfinding cost maps, and particle pools in SRAM/PSRAM.
### Fixed-Timestep Engine Loop
Decouple rendering from simulation so real-time combat and packet traces run deterministically regardless of frame rate:
```cpp
constexpr uint32_t SIM_TICK_MS = 50; // 20 Hz deterministic logic tick
uint32_t accumulator = 0;
uint32_t last_frame_ms = millis();
void loop() {
uint32_t now = millis();
uint32_t dt = now - last_frame_ms;
last_frame_ms = now;
poll_keyboard_i2c(); // Non-blocking read from ESP32-C3 keyboard controller
poll_trackball_gpio(); // Accumulate quadrature deltas from GPIO interrupts
if (!game_state.paused) {
accumulator += dt;
while (accumulator >= SIM_TICK_MS) {
step_network_simulation(); // Advance packet flows, ICE cracks, enemy traces
step_squad_and_droid_ai(); // Line-of-sight checks, cover, gunfire, virus timers
accumulator -= SIM_TICK_MS;
}
}
render_tactical_view(back_buffer); // 320x192: ship tiles + network overlay,
// dimmed / brightened per view mode (P)
render_hud_bar(back_buffer); // Bottom 320x48: daemons, RAM, Temp, squad pips
render_cursor(back_buffer); // Cross-mode trackball cursor
swap_buffers_dma(); // Async SPI flush to ST7789
}
```
### T-Deck Hardware Gotchas to Handle Early
1. **Shared SPI Bus Contention:** The ST7789 display (`MOSI 41`, `SCLK 40`, `CS 12`, `DC 11`) shares the SPI bus with the SD card and LoRa module. Load any external map/audio assets from SD during mission load screens only—never touch the SD card or LoRa SPI lines inside the active render loop.
2. **Power Rail Initialization:** Always set `GPIO 10` (`BOARD_POWERON`) `HIGH` at the very start of `setup()` before initializing the display, trackball, or I²C keyboard (`SDA 18`, `SCL 8`, address `0x55`), or peripherals will brown out on battery power.
3. **Trackball Acceleration:** The T-Deck trackball generates raw GPIO pulses (`Up 3`, `Down 15`, `Left 1`, `Right 2`, `Click 0`). Apply a simple velocity multiplier (e.g., `1x` for single-step precision clicks, `2.5x` when >4 pulses arrive within 30 ms) so sweeping across the 320px screen feels snappy without sacrificing single-tile accuracy.
---
## 7. Minimum Viable Prototype (MVP) Milestone Plan
* **Milestone 0 — Emulator:** Milestone 1 prepared and tested locally, without HW. This is an AI-native project.
* **Milestone 1 — Hardware Sandbox:** Boot screen on ST7789 via DMA, render shared tactical view (Cameras + Network overlay) + HUD layout, verify smooth trackball cursor + `Space` pause toggle + `P` view switch.
* **Milestone 2 — Network Graph & Traces:** Build a 6-node static network in Network view, with door nodes pinned to their bulkhead tiles in the shared space. Allow clicking nodes to form links, cracking an ICE node, and triggering a red enemy trace pulse that can be severed with `X`.
* **Milestone 3 — Autonomous Squad vs. Droids:** Build a 6-room ship floorplan visible in Cameras view. Spawn 3 marines moving toward a clicked Priority Beacon and exchanging fire with 4 droids.
* **Milestone 4 — The Cyber-Physical Bridge:** Exploit the shared coordinate space. Linking to a `Droid Hive` node and pressing `1` (`FRENZY.EXE`) turns the droids in the corresponding room red and forces them to attack each other.
+37
View File
@@ -0,0 +1,37 @@
# NetDeck — Breach & Board: Milestone Status
Source of truth for gameplay/architecture: [DESIGN.md](DESIGN.md).
This file tracks milestone progress (DESIGN.md §7). Update it when a
milestone lands.
| Milestone | Scope | Status |
| --- | --- | --- |
| **M0 — Emulator** | SDL2 emulator support + M1 surface tested locally | **done** |
| M1 — Hardware Sandbox | Boot on ST7789 DMA, shared tactical view (Cameras/Network) + HUD, cursor, `Space` freeze, `P` view switch | prepared (emulator-verified, needs device bring-up) |
| M2 — Network Graph & Traces | Node graph in Network view (door nodes on bulkhead tiles), link routing, ICE crack, red trace + `X` sever | planned |
| M3 — Squad vs. Droids | Ship floorplan in Cameras view, 3 marines → beacon, 4 droids, gunfire | planned |
| M4 — Cyber-Physical Bridge | Hive link + `1` FRENZY.EXE turns droids on each other (shared coordinate space) | planned |
## M0 (this milestone)
- `src/netdeck/nd_layout.h` — shared constants: 320x192 tactical view + HUD bar
(one coordinate space), palette, fixed-timestep timings.
- `examples/NetDeck/NetDeck.ino` — sandbox app: 40x24 demo floorplan and an
8-node sub-net graph in the same coordinate space (door nodes pinned to
their bulkhead door tiles); **two view modes** — Cameras (full ship view,
network as dotted outlines) and Network (ship dimmed ~35%, full graph with
labels and packets), switched with `P` (Tab kept as legacy alias); trackball
cursor (edge-ISRs + momentum, tile snap in Cameras / node target in
Network); keyboard @ 0x55 (`Space` freeze, `1-4`/`X`/`R` groundwork);
tap-to-cursor via GT911; 20 Hz sim accumulator (pause-verified
frame-identical).
- Emulator: `make APP=NetDeck run` / `smoke` from `emulator/`; host gained `Tab`
key mapping (`emulator/src/main.cpp`).
## M1 remaining (hardware bring-up, same sketch)
- ST7789 via DMA double-buffered transfers (two 153.6 KB SRAM DMA buffers).
- Real keyboard-controller init timing + stale-byte grace on device.
- Trackball sensitivity on real hardware (`TB_IMPULSE`/`TB_FRICTION` device branch).
- Frame cost check: full 320x240 redraw must fit ~30 fps at 80 MHz SPI; move to
incremental/two-buffer rendering if not.
+74
View File
@@ -0,0 +1,74 @@
/**
* @file nd_layout.h
* @brief NetDeck — Breach & Board: shared screen partition, palette and
* engine constants. Single source of truth for the 320x240
* layout described in DESIGN.md §3 and the fixed-timestep
* engine loop from DESIGN.md §6.
*
* Header-only: included by the sketch (examples/NetDeck) from both the
* PlatformIO firmware build and the SDL2 emulator build.
*/
#pragma once
#include <cstdint>
namespace nd {
// ---------------------------------------------------------------------------
// Screen partition (320x240): shared tactical view + HUD bar
// ---------------------------------------------------------------------------
// Physical reality and the logical network render into the SAME coordinate
// space (DESIGN.md §3): a bulkhead door tile and its network Door Node sit
// at the same spot. Two render modes over one 40x24 tile grid:
// Cameras mode — full ship view, network lightly overlaid as outlines
// Network mode — ship dimmed underneath, full network graph on top
constexpr int VIEW_X = 0, VIEW_Y = 0, VIEW_W = 320, VIEW_H = 192;
constexpr int HUD_X = 0, HUD_Y = 192, HUD_W = 320, HUD_H = 48;
constexpr int TILE = 8;
constexpr int TILE_COLS = VIEW_W / TILE; // 40
constexpr int TILE_ROWS = VIEW_H / TILE; // 24
// Sub-net node icons are 12x12.
constexpr int NODE_ICON = 12;
// ---------------------------------------------------------------------------
// Fixed-timestep engine (DESIGN.md §6)
// ---------------------------------------------------------------------------
constexpr uint32_t SIM_TICK_MS = 50; // 20 Hz deterministic logic tick
constexpr uint32_t FRAME_MS = 33; // ~30 fps render pacing
// Boot banner duration (also swallows stale keyboard bytes / floating pins).
constexpr uint32_t BOOT_MS = 1400;
// ---------------------------------------------------------------------------
// Palette (RGB565) — muted steel-blues for the deck, neon for signals
// ---------------------------------------------------------------------------
// deck pane
constexpr uint16_t C_FLOOR = 0x1905; // near-black blue corridor floor
constexpr uint16_t C_WALL = 0x42CD; // steel blue-gray hull
constexpr uint16_t C_COVER = 0x6225; // industrial crate brown-gray
constexpr uint16_t C_DOOR = 0xFD45; // amber blast door
constexpr uint16_t C_AIRLOCK = 0x07FF; // cyan breach airlock marker
constexpr uint16_t C_BEACON = 0x07FF; // cyan squad priority beacon
// net pane
constexpr uint16_t C_NETBG = 0x0000; // black logic space
constexpr uint16_t C_NODE = 0x2DAA; // green junction node
constexpr uint16_t C_ICE = 0xF800; // red ICE-locked firewall node
constexpr uint16_t C_HIVE = 0xF81F; // magenta droid hive node
constexpr uint16_t C_LINK = 0x2BCF; // teal network link trace
constexpr uint16_t C_GHOST = 0x2BCF; // cameras-mode overlay outline color
constexpr uint16_t C_PACKET = 0x07BF; // cyan data packet
constexpr uint16_t C_TRACE = 0xF800; // red enemy trace pulse
// HUD bar
constexpr uint16_t C_HUDBG = 0x0841; // near-black panel
constexpr uint16_t C_BORDER = 0x42CD; // pane separator steel
constexpr uint16_t C_TEXT = 0xFFFF; // primary text
constexpr uint16_t C_TEXTDIM = 0x8410; // secondary text
constexpr uint16_t C_GOOD = 0x07E0; // green meter fill
constexpr uint16_t C_WARN = 0xFFE0; // yellow meter fill
constexpr uint16_t C_HOT = 0xF800; // red meter fill
constexpr uint16_t C_CURSOR = 0xFFE0; // cursor cross, bright amber
constexpr uint16_t C_FREEZE = 0x07FF; // tactical-freeze tint accents
} // namespace nd