Skip to content

v0.147.0 — Procedural maps: Revealing by sight

The eighth milestone of the procedural map generation program (M8), built before M7: fog of war uncovers what a party token can see, worked out by the server, and the Fog Edit tools gain a restore mode. The program's documents are in docs/programs/mapgen/; this milestone's tasks, decisions and test script are in docs/programs/mapgen/m8-revealing-by-sight.md.

Fog of war uncovers what a token sees

  • [x] A token reveals what it can see: the squares inside its sight (its vision range, stopped by every wall and vision-blocking shape, a secret door's wall included) that are lit or within its darkvision, which is what its player sees on screen. A dark room stays fogged until a light or darkvision sees it.
  • [x] The server works it out. The client sends a token, never a shape: POST /api/maps/:mapId/fog/reveal-by-sight reads the map's own rows (hidden doors included, which players never receive), writes one fog shape per token in one Time Machine commit and broadcasts it like any fog edit. A player can't reveal anything their token couldn't see, and can't reveal for a token they don't control (403, nothing written).
  • [x] Two settings in the map panel's Fog of War section, whenever fog of war is on: Players may reveal by sight adds Reveal what (token) sees to the context menu of tokens a player controls (the GM can always use it, on any token); Automatically reveals when a party token stops moving or its light comes on, and turning it on reveals at once. The GM's monsters and NPCs never reveal automatically.
  • [x] Auto-Reveal on Move becomes Automatically. A map that had it on gets both settings on (migration 0084), so it keeps working, now for players too. With lighting off a token reveals its whole line of sight, as before.

Fog Edit tools

  • [x] Hold Shift while drawing to restore fog inside the shape, over any reveal beneath it.
  • [x] Each tool has its own cursor, and a hint follows the cursor saying how the tool works.

Known limits

  • Light still shines through walls, on screen and in the reveal (M8-D3): only a light in the next room can light squares the token already has line of sight to. Making light stop at walls changes what everyone sees, and comes after M8 (mapgen-light-through-walls).