Wall and token ids #3

Closed
opened 2026-11-10 16:48:28 +01:00 by SirStone · 1 comment
Owner

Part of #2

Question

How are wall/token ids assigned so removing one does not shift the others?

  • Today moverules.nim uses array indices; removeWall deletes, which shifts the rest.
  • §8 says "dense integers" but also wants stable ids.
  • Options: (a) stable never-reused per-scene ints, gaps ok; (b) dense ints + renumber broadcast; (c) opaque ids like entities.
  • Suggested default: (a) stable monotonic per-scene ints.
Part of #2 ## Question How are wall/token ids assigned so removing one does not shift the others? - Today moverules.nim uses array indices; removeWall deletes, which shifts the rest. - §8 says "dense integers" but also wants stable ids. - Options: (a) stable never-reused per-scene ints, gaps ok; (b) dense ints + renumber broadcast; (c) opaque ids like entities. - Suggested default: (a) stable monotonic per-scene ints.
SirStone added the wayfinder:grilling label 2026-11-10 16:48:28 +01:00
SirStone added a new dependency 2026-11-10 16:49:02 +01:00
SirStone added a new dependency 2026-11-10 16:49:03 +01:00
SirStone self-assigned this 2026-11-10 16:57:43 +01:00
Author
Owner

Resolved (2026-11-10). Commit 48b7788 (docs/DESIGN.md only).

Decision:

  1. Walls: ids stable for life. Removal never renumbers; ids never reused.
  2. Walls per-scene: each scene counts from 1 and stores its own monotonic next_wall_id (never decreases, even if the newest wall is deleted). Wall identity = (scene, id) in DB, server and wire.
  3. Tokens: server-assigned random, opaque, non-guessable id (hides hidden tokens; counted ids leak through gaps). Format: 12 chars [A-Za-z0-9_-], CSPRNG, server checks collision on create.
  4. Token ids unique game-wide, so a token can later change scene keeping its id (not in M3).
  5. Doors are walls and use wall ids. Door ids leak at most about the wall count if players ever toggle doors; accepted.

Rejected:

  • Dense ids + renumber broadcast: in-flight intents would hit the wrong wall.
  • Game-wide wall counter: per-scene keeps scene copy/export stable and is easier to maintain.

DESIGN.md sections: 4.1 (state model), 4.4 (schema), 6 (door and wall.* rows), 8 (id paragraph, Wall/Door, Entity).

Resolved (2026-11-10). Commit 48b7788 (docs/DESIGN.md only). Decision: 1. Walls: ids stable for life. Removal never renumbers; ids never reused. 2. Walls per-scene: each scene counts from 1 and stores its own monotonic `next_wall_id` (never decreases, even if the newest wall is deleted). Wall identity = (scene, id) in DB, server and wire. 3. Tokens: server-assigned random, opaque, non-guessable id (hides hidden tokens; counted ids leak through gaps). Format: 12 chars [A-Za-z0-9_-], CSPRNG, server checks collision on create. 4. Token ids unique game-wide, so a token can later change scene keeping its id (not in M3). 5. Doors are walls and use wall ids. Door ids leak at most about the wall count if players ever toggle doors; accepted. Rejected: - Dense ids + renumber broadcast: in-flight intents would hit the wrong wall. - Game-wide wall counter: per-scene keeps scene copy/export stable and is easier to maintain. DESIGN.md sections: 4.1 (state model), 4.4 (schema), 6 (door and wall.* rows), 8 (id paragraph, Wall/Door, Entity).
Sign in to join this conversation.