feat: render only ground the player can currently see - #7
Closed
JJiang28 wants to merge 1 commit into
Closed
Conversation
Terrain arrived unfiltered, so the client drew the entire world and merely desaturated what lay outside vision. The server now sends only the ground a player can actually see, and sends the whole visible set again whenever it moves. Vision is ephemeral: it lasts while a city or army is watching and no longer. Applying an update therefore clears the planes before writing the new set — without that, ground would stay lit after the army that revealed it walked away, and the client would slowly accumulate a map it is not entitled to. Fog is now a single source of truth. The client used to recompute Chebyshev distance from owned cities to decide what was fogged, which no longer agrees with the server: armies grant vision too, and the client does not track their radius. Both the shroud and the vision-edge glow now read the server's set instead. Also surfaces terrain and any special resource on the selected tile, and replaces "Beyond visibility range" with wording that matches the mechanic, since a tile is dark because nothing of yours is watching it rather than because it is far away. Co-Authored-By: Claude Opus 5 (1M context) <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
Applying an update clears the planes before writing the new set. Vision is ephemeral — it lasts only while a city or army is watching — so ground must actually go dark when the army that revealed it walks away. Merging updates instead of replacing would leave tiles lit forever and let the client slowly accumulate a map it is not entitled to.
The empty-tile message changed from "Beyond visibility range" to wording about nothing of yours watching, because that is now the actual mechanic: a tile is dark because it is unwatched, not because it is far away.
Known follow-up
The renderer still tears down and rebuilds every visible tile on each stream tick and never frees tiles panned past. That predates this work, but visibility changes now trigger redraws too, so it is worth doing before watchtowers make vision move more often. Restructure (pooling, real culling, diff updates, texture atlas) is the intended next change.
proto/still mirrors only the terrain and vision additions; the army protos from backend #12 are not yet mirrored into this repo.Test plan
yarn checkandyarn buildcleanyarn generatereproduces the committed generated code