Fog of war: wider fades and a grainy edge instead of stepped lines (t17)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-10-24 12:39:13 -04:00
co-authored by Claude Opus 5.5
parent b4245871ae
commit ab61d6b904
8 changed files with 47 additions and 19 deletions
+11 -7
View File
@@ -7,26 +7,30 @@ surface start seen. Exploration never changes the simulation.
`src/sim/fog.js` keeps a `Uint8Array` at half the grain resolution (`FOG = 2`).
Values run from 0 (unseen) to 255 (seen) and only increase. `alloc` allocates it with
the other world arrays. `fogInit` reveals above `surfY` and fades eight grains below it.
the other world arrays. `fogInit` reveals above `surfY` and fades 16 grains below it.
Every four ticks, 256 rays from the bot's centre reveal up to 48 grains. The last eight
grains fade out. Solid and powder stop sight after a four-grain fade into their face;
Every four ticks, 256 rays from the bot's centre reveal up to 48 grains. The last 16
grains fade out. Solid and powder stop sight after an eight-grain fade into their face;
air, gas and liquid pass sight. Bars and machine voids do not block it.
Each look also senses the ground around the bot through rock: every fog cell within
`FOG_SENSE` (20 grains) of the bot is revealed, fully clear out to 16 grains and fading to
nothing at 20, so the player can see ore and caves next to their tunnel and choose where to dig.
`FOG_SENSE` (24 grains) of the bot is revealed, fully clear out to 12 grains and fading over
the outer 12 grains to nothing at 24, so the player can see ore and caves next to their tunnel
and choose where to dig.
## Saving
The fog buffer is saved and exported with the other typed arrays, without a save version
change. Older saves rebuild the surface, reveal a radius of 12 grains around built blocks,
machine footprints and molds, then look from the bot. Loading and generating also look
machine footprints and molds, fully clear inside six grains with a six-grain fade to the
radius edge, then look from the bot. Loading and generating also look
immediately from the bot.
## Drawing and setting
Both looks and the thermal lens sample fog bilinearly. Seen grains use the usual drawing;
Both looks and the thermal lens sample fog bilinearly. Partial values get stable per-grain
noise of about ±40, clamped to 1–255, to break up stepped edges. Unseen and fully seen
grains are unchanged. Seen grains use the usual drawing;
unseen grains use the out-of-world colour and smooth-look buffers, hiding their shapes.
Partial values dim foreground, background and trees. Bloom sources need at least 128;
bars, flyers, rain and particles need at least 64. Hover info and the cursor label say