Skip to content

fix: set water elevation during map generation to prevent depth issues#1348

Merged
braedonsaunders merged 3 commits into
mainfrom
claude/fix-water-rendering-e5q9n
Feb 4, 2026
Merged

fix: set water elevation during map generation to prevent depth issues#1348
braedonsaunders merged 3 commits into
mainfrom
claude/fix-water-rendering-e5q9n

Conversation

@braedonsaunders

Copy link
Copy Markdown
Owner

Root cause: Water cells were inheriting elevation from the underlying terrain grid, causing water to render at varying heights instead of at a consistent water surface level.

Fix:

  • Add ELEVATION.WATER (20) constant for water surface level
  • Both deep AND shallow water use the same surface elevation (deep vs shallow refers to depth BELOW the surface, not surface height)
  • Modify paintFeatureCircle() and paintFeatureRect() to set water cells to ELEVATION.WATER

Water surface is always level - that's how water works.

https://claude.ai/code/session_01CEq99bYXB2fmcaLE6H46Sz

Root cause: Water cells were inheriting elevation from the underlying
terrain grid, causing water to render at varying heights instead of
at a consistent water surface level.

Fix:
- Add ELEVATION.WATER (20) constant for water surface level
- Both deep AND shallow water use the same surface elevation
  (deep vs shallow refers to depth BELOW the surface, not surface height)
- Modify paintFeatureCircle() and paintFeatureRect() to set water
  cells to ELEVATION.WATER

Water surface is always level - that's how water works.

https://claude.ai/code/session_01CEq99bYXB2fmcaLE6H46Sz

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 426236f3bd

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +223 to +226
// Set water elevation - water surface is always level
if (isWater) {
grid.elevation[y][x] = ELEVATION.WATER;
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Avoid shoreline cliffs from fixed water elevation

Setting water cells to ELEVATION.WATER (20) makes the elevation difference to normal ground (ELEVATION.LOW = 60) exactly CLIFF_THRESHOLD (40 in src/data/pathfinding.config.ts). Because isCliffCell flags any diff ≥ threshold, any land (or shallow-water) cell adjacent to water now becomes a cliff and therefore unwalkable. This makes shores impassable on maps where water meets low ground, which is a regression from the previous behavior where water inherited the surrounding elevation. Consider excluding water neighbors from cliff checks or choosing a water elevation that doesn’t trip the threshold.

Useful? React with 👍 / 👎.

@braedonsaunders braedonsaunders force-pushed the claude/fix-water-rendering-e5q9n branch from 426236f to f34b462 Compare February 4, 2026 02:51
…hallow

AI water generation improvements:
- Enhanced system prompt with detailed water layering instructions
- Water bodies should be created in layers: shallow first (larger), deep on top (smaller)
- This creates natural shorelines where shallow water surrounds deep water
- Added concrete examples for lakes and rivers
- Updated user prompt with step-by-step water creation guidance

Rendering fix:
- Remove 0.02 height offset between deep and shallow water
- All water now renders at the exact same height (water surface is level)
- This eliminates the visible gap/seam between deep and shallow regions

https://claude.ai/code/session_01CEq99bYXB2fmcaLE6H46Sz
ELEVATION.WATER was 20, making the difference from LOW (60) exactly
equal to CLIFF_THRESHOLD (40). This caused all shorelines to be
detected as cliffs, making them unwalkable.

Changed ELEVATION.WATER from 20 to 25:
- Difference from LOW is now 35, which is < CLIFF_THRESHOLD (40)
- Shorelines are no longer flagged as cliffs
- Water still renders below ground level as expected

https://claude.ai/code/session_01CEq99bYXB2fmcaLE6H46Sz
@braedonsaunders braedonsaunders merged commit a7bc35d into main Feb 4, 2026
4 checks passed
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.

2 participants