Files
lilygo-t-deck/cyberspace-demo/README.md
T
Dejvino cebfed96a8 cyberspace-demo: Real first-person fly-through of the Net
Replace the spinning-cube placeholder with a proper System Shock
Cyberspace fly-through (shodan.fandom.com/wiki/Cyberspace):

- Camera dragged along a gently curving data-current spline with
  banking roll and weightless bob; look direction blended toward
  straight-ahead so the vanishing point stays centered
- Octagonal tunnel rings + longitudinal ribs with depth fade and
  near-plane segment clipping; radius swells between four named
  zones (military spur / research grotto / data cistern / security
  grid) via smoothstep blends
- Wiki-canon objects recycled around a 256-unit loop: data object
  (purple cube), data fragment (yellow square + orange diamonds),
  infonode signpost, security mine, integrity restorative, ICE
  pyramid growths, and SHODAN's diamond core with Bezier tentacles
  + rotating shield ring once per loop
- NetDeck-style HUD: 3x5 bitmap font, crosshair, LNK/TRACE meters,
  zone banners, DIST/VEL/NODE readouts; Space = freeze convention
- 3x3 view matrix built per frame from the path tangent; Bresenham
  lines against the direct framebuffer, dimc() depth fading

Verified: clean build (0 warnings), 240-frame smoke, 5000-frame
soak, frame dumps inspected at five flight points.
2026-11-16 21:02:10 +01:00

99 lines
4.2 KiB
Markdown

# T-Deck Cyberspace Demo
A first-person wireframe fly-through of Cyberspace, inspired by
[System Shock's Cyberspace](https://shodan.fandom.com/wiki/Cyberspace)
from the Shodan Fandom wiki. The camera is dragged along a "river of data"
through immense rooms of glowing wireframe, populated with the classic
Cyberspace objects — a vibe study for the NetDeck game's jack-in view.
## Overview
Everything renders as glowing wireframe on a 320x240 framebuffer, exactly
like the wiki describes: *"important programs manifest as floating geometric
shapes in immense rooms of glowing wireframe. Hallways between rooms
represent rivers of data between nodes, which drag the user along in
digital currents."*
- **Data current** — the camera follows a gently curving spline path,
banking into curves and bobbing weightlessly; the tunnel of octagonal
rings swells between narrow hallways and vast rooms (zones) with
smoothstep radius blends.
- **Cyberspace objects** (per the wiki's Objects list), recycled around a
256-unit loop so the flight never ends:
| Object | Wiki appearance | In the demo |
|---|---|---|
| Data Object | spinning purple cube | two nested counter-rotating wireframe cubes |
| Data Fragment | yellow square + 4 orange diamonds | spinning square with octahedra on the diagonals |
| Infonode | geometric signpost | green pylon + octahedron head + orbiting spark |
| Security Mine | blue sphere | pulsing billboard circles + orange prime blink |
| Integrity Restorative | red cross | three-axis red wireframe cross |
| I.C.E. Barrier | geometric growths | cluster of magenta pyramids, shimmering |
| SHODAN's core | vertical diamond ending in four curved tentacles | Bézier tentacles + rotating shield ring, once per loop |
- **Void stars** — distant fixed points for orientation (rotation-only
parallax, translation-free, infinity-depth).
- **NetDeck-style HUD chrome** — crosshair, LNK/TRACE meters, zone banner
(MILITARY SPUR / RESEARCH GROTTO / DATA CISTERN / SECURITY GRID), DIST /
VEL / NODE readouts in a 3x5 bitmap font.
## Controls
- **SPACE** — freeze / resume the current (NetDeck `Space` freeze convention)
- **f / s** — faster / slower current
- **h** — toggle HUD
- **ESC** — quit
## Building & Running
```bash
# Build and run the cyberflythrough demo
make run APP=Cyberflythrough
# Headless smoke test (240 frames, dump BMP)
make smoke APP=Cyberflythrough
# Clean built binary
make clean
```
## File Structure
```
cyberspace-demo/
├── README.md # This file
├── Makefile # Build configuration
├── shim.h # Arduino API shim (millis, random, etc.)
├── src/
│ └── main.cpp # SDL3 host loop — window, framebuffer, setup()/loop()
└── examples/
└── Cyberflythrough/
└── Cyberflythrough.cpp # Cyberspace fly-through sketch
```
## How It Works
The sketch implements the standard emulator contract:
- `setup()` — called once at launch, seeds the object/streak/star fields
- `loop()` — called once per frame (~60 fps)
- consumes keys from `emu::keyboard` (freeze, speed, HUD)
- advances the camera along the data-current spline (`pathX/pathY`),
banks the roll into curves, simulates streaks and object recycling
- transforms world → view space with one 3x3 matrix per frame
(yaw/pitch from the path tangent, blended toward straight-ahead) and
perspective-projects
- draws octagonal tunnel rings + longitudinal ribs with depth fade,
near-plane segment clipping, and the object wireframes
- draws HUD chrome and sets `emuGfx::dirty = true`
Geometry notes:
- All lines are Bresenham's algorithm against the direct framebuffer.
- Depth fade multiplies each color by a per-segment brightness using
`dimc()`, giving the glowing-wireframe-into-the-distance look without
a z-buffer.
- Segments are clipped against the near plane in view space so objects
sweeping past the camera don't smear across the screen.
Potential next steps toward NetDeck integration: replace the scripted
camera with trackball-steered flight, pin the tunnel zones to actual
network nodes (AIRLK/JUNC/HIVE), and let data-object pickups arm the
daemon keys (`1` FRENZY.EXE / `2` BLIND).