Skip to content

feat: render only ground the player can currently see - #7

Closed
JJiang28 wants to merge 1 commit into
feat/terrain-renderingfrom
feat/ephemeral-vision
Closed

feat: render only ground the player can currently see#7
JJiang28 wants to merge 1 commit into
feat/terrain-renderingfrom
feat/ephemeral-vision

Conversation

@JJiang28

@JJiang28 JJiang28 commented Aug 3, 2026

Copy link
Copy Markdown
Contributor

Summary

  • The server now sends only the ground a player can currently see, so the client renders that and draws shroud everywhere else, instead of drawing the whole world desaturated.
  • Makes fog 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 now that armies also grant vision. Both the shroud and the vision-edge glow read the server's set.
  • Surfaces terrain and any special resource on the selected tile.

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 check and yarn build clean
  • yarn generate reproduces the committed generated code
  • Verified against a local backend: only the ground around the player's city renders, the rest is shroud, and no console errors
  • Selected tile reports terrain correctly (e.g. "51, 11 · Grassland")
  • City card, building card, construction overlay and territory borders all still render inside the visible area

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>
@JJiang28 JJiang28 closed this Aug 4, 2026
@JJiang28
JJiang28 deleted the feat/ephemeral-vision branch August 4, 2026 00:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant