Files
FFF_vtt_frozen/docs/adr/0004-opaque-random-token-ids.md
SirStone 8aaf03be04 docs: add ADRs for the durable design decisions
22 ADRs: server-authoritative sight and single egress, per-recipient views/diffs, uniform
nack, opaque ids, 32 px tile unit, wall switches/presets, see-over, thick walls, open-door
gap, typed wall columns, proto 2, build order, zoom clamp, accepted status leak, player
marker, chunked explored, slow-client policy, session/key split, closing message, character
records, global lock, synchronous choice. Each links its tickets and its spec section.
2026-11-17 23:12:04 +01:00

1.2 KiB

Tokens get random opaque ids; walls get per-scene counters

A token id is 12 characters from [A-Za-z0-9_-] drawn from the OS CSPRNG (72 bits), collision-checked at create and unique game-wide. A wall id is a per-scene counter (next_wall_id) that is monotonic and never reused. We chose different schemes because token ids reach players (as mine, encountered, vision), so a counter would leak how many hidden tokens exist through gaps, while wall ids never reach a player and a counter keeps scene copy/export stable.

Status

accepted

Alternatives

  • Dense counters for tokens: rejected, gaps leak hidden tokens.
  • Random ids for walls: rejected, ids must stay readable/stable across a scene export and import, and nothing player-facing depends on them.
  • A game-wide wall counter: rejected, per-scene ids keep a scene self-contained.

Consequences

Token creation checks collision against the loaded set; no counter column is needed. A token may later change scene and keep its id. Removing a wall never renumbers and never reuses its id, and a restart reloads next_wall_id from the scene row.

Tickets

#3 (ids), #20 (token ids).

Spec

Current §8 (ids, wall and token paragraphs), §4.4 step 3 (next_wall_id).