feat: three-state fog of war rendering - #8
Closed
JJiang28 wants to merge 2 commits into
Closed
Conversation
Terrain arrived unfiltered and the client merely desaturated whatever lay outside vision. The server now sends a proper fog model, so the map draws in three states instead of one. Unexplored ground is unknown and draws as shroud. Explored ground stays charted even when no unit is watching, and draws dimmed from memory — you remember the coastline and the mountains, but not what is on them, so no buildings render there. Only where a unit currently has eyes is a tile bright and its structures shown; the server sends entities for lit tiles alone. The world keeps two masks now: explored, which only grows, and visible, the live set that shrinks as readily as it grows. A stream update charts newly seen tiles into permanent memory and replaces the live set as a whole — an army walking away must dim the ground it was lighting even though the terrain stays known. Fog is a single source of truth again. The client used to recompute Chebyshev distance from owned cities to decide what was fogged, which no longer agrees with the server now that armies grant vision and different troops see different distances. Both the shroud and the vision-edge glow read the server's set. The tile panel reports remembered terrain for any charted tile, and its empty-tile wording now distinguishes unexplored ground from ground that is simply out of sight. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Three small readability passes on the fog. A minimap in the bottom-left paints the whole world from the same planes the map draws — shroud for unknown, dimmed for remembered, bright for lit — with owned cities as gold pips and a box for the current view. Click it to jump. The terrain layer is cached to an offscreen buffer and only repainted when vision changes, so panning just reblits it. The shroud was dark green and passed for unlit grass; it is now a cool slate fog, clearly unlike any terrain, so the edge of the charted map reads at a glance. Remembered ground was dimmed to a fairly dark cool grey; lightened so it stays legible while still obviously a step below what a unit is currently watching. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Notes for reviewers
explored(only grows) andvisible(the live set, shrinks as well as grows). A streamMapVisibilitycharts newly-seen tiles into permanent memory (applyVisibilitywrites the reveal planes and never clears them) and replaces the live set wholesale — an army walking away must dim the ground it was lighting even though the terrain stays known.visible, which is automatically consistent: the server sends entities for lit tiles alone, so there's no building data on a dimmed tile to draw.Verification
The dim (remembered) state only arises once a unit charts ground and leaves, which needs an army — so beyond the live check below, I confirmed the render path by temporarily flipping half the visible set to unwatched in the browser: those tiles correctly dropped to the dim tint and lost their buildings while staying drawn, then reload restored the real state.
Depends on the backend fog PR — merge and deploy that first, or
GetTerrainreturns the old shape.Test plan
yarn checkandyarn buildclean;yarn generatereproduces committed output