Skip to content

fix: add water_treatment to simulation coverage loop#442

Open
flaviocarmo wants to merge 1 commit into
amilich:mainfrom
flaviocarmo:main
Open

fix: add water_treatment to simulation coverage loop#442
flaviocarmo wants to merge 1 commit into
amilich:mainfrom
flaviocarmo:main

Conversation

@flaviocarmo

@flaviocarmo flaviocarmo commented Mar 1, 2026

Copy link
Copy Markdown

Water Treatment plants (water_treatment) do not provide any water coverage to buildings. The watered property on all buildings is always
false, regardless of how many Water Treatment plants are placed or their upgrade level. This means building efficiency is permanently
capped at 50% (powered only), halving population and job output.

Steps to Reproduce

  1. Start a new game or load a city
  2. Place multiple Water Treatment plants (I tested with 24, all upgraded to level 5)
  3. Open the Water System overlay
  4. Observe: the entire map is shown as uncovered (red/dark tint on all tiles)
  5. Inspect any building's state: building.watered === false

Expected Behavior

Water Treatment plants should provide radius-based water coverage to nearby buildings (similar to how Power Plants provide power
coverage). Buildings within range should have watered: true, which would increase their efficiency from 0.5 to 1.0, doubling population
and job output per the formula:

efficiency = 0.5 * (powered ? 1 : 0) + 0.5 * (watered ? 1 : 0)
actual_pop = maxPop * level * efficiency * 0.8

Actual Behavior

  • The Water System overlay shows zero coverage across the entire map (see screenshot)
  • All buildings have watered: false even when directly adjacent to a Water Treatment plant
  • The game engine actively recalculates watered back to false on every state update/tick — setting it to true via state manipulation is immediately overwritten
  • By contrast, Power Plants work correctly: their overlay shows radius circles and buildings within range have powered: true

How This Was Discovered

While automating city management via React state access (__reactFiber), I noticed:

  1. Placed 24 Water Treatment plants (level 5) spread evenly across a 100x100 grid
  2. Queried all buildings: watered === false on every single one (0 out of 4,285 buildings watered)
  3. Force-set watered: true on all buildings via dispatch() — the game recalculated it back to false on the next tick
  4. Confirmed Power Plants work correctly: powered updates dynamically based on proximity
  5. The Water System overlay visually confirms zero coverage (entire map dark/red)

Impact

This effectively halves all building output:

  • house_small at level 5: gives 12 pop instead of 24
  • shop_medium at level 5: gives 56 jobs instead of 112
  • A 50K city could be 100K if water worked

Environment

  • Browser: Chromium (latest)
  • Game URL: https://iso-city.com
  • Grid tested: 100x100 with 24 water_treatment plants at level 5

Note

Low Risk
Small, localized change to service coverage logic; main risk is gameplay/balance impact from newly-enabled water coverage radius and upgrades for water_treatment.

Overview
Fixes a simulation bug where water_treatment buildings were ignored when computing water utility coverage.

water_treatment is now treated as a water-providing service building (added to SERVICE_CONFIG/SERVICE_BUILDING_TYPES) and included in the coverage loop so nearby tiles correctly get services.water set to true.

Written by Cursor Bugbot for commit c7850c7. This will update automatically on new commits. Configure here.

Water Treatment plants (water_treatment) do not provide any water coverage to buildings. The watered property on all buildings is always
  false, regardless of how many Water Treatment plants are placed or their upgrade level. This means building efficiency is permanently
  capped at 50% (powered only), halving population and job output.

  Steps to Reproduce

  1. Start a new game or load a city
  2. Place multiple Water Treatment plants (I tested with 24, all upgraded to level 5)
  3. Open the Water System overlay
  4. Observe: the entire map is shown as uncovered (red/dark tint on all tiles)
  5. Inspect any building's state: building.watered === false

  Expected Behavior

  Water Treatment plants should provide radius-based water coverage to nearby buildings (similar to how Power Plants provide power
  coverage). Buildings within range should have watered: true, which would increase their efficiency from 0.5 to 1.0, doubling population
  and job output per the formula:

  efficiency = 0.5 * (powered ? 1 : 0) + 0.5 * (watered ? 1 : 0)
  actual_pop = maxPop * level * efficiency * 0.8

  Actual Behavior

  - The Water System overlay shows zero coverage across the entire map (see screenshot)
  - All buildings have watered: false even when directly adjacent to a Water Treatment plant
  - The game engine actively recalculates watered back to false on every state update/tick — setting it to true via state manipulation is
  immediately overwritten
  - By contrast, Power Plants work correctly: their overlay shows radius circles and buildings within range have powered: true

  How This Was Discovered

  While automating city management via React state access (__reactFiber), I noticed:

  1. Placed 24 Water Treatment plants (level 5) spread evenly across a 100x100 grid
  2. Queried all buildings: watered === false on every single one (0 out of 4,285 buildings watered)
  3. Force-set watered: true on all buildings via dispatch() — the game recalculated it back to false on the next tick
  4. Confirmed Power Plants work correctly: powered updates dynamically based on proximity
  5. The Water System overlay visually confirms zero coverage (entire map dark/red)

  Impact

  This effectively halves all building output:
  - house_small at level 5: gives 12 pop instead of 24
  - shop_medium at level 5: gives 56 jobs instead of 112
  - A 50K city could be 100K if water worked

  Environment

  - Browser: Chromium (latest)
  - Game URL: https://iso-city.com
  - Grid tested: 100x100 with 24 water_treatment plants at level 5
@assert-app

assert-app Bot commented Mar 1, 2026

Copy link
Copy Markdown

@vercel

vercel Bot commented Mar 1, 2026

Copy link
Copy Markdown
Contributor

@flaviocarmo is attempting to deploy a commit to the andrew-4640's projects Team on Vercel.

A member of the Team first needs to authorize it.

@xkonjin xkonjin 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.

Quick review pass:

  • Main risk area here is UI state transitions, empty/error states, and interaction regressions.
  • I didn’t see targeted regression coverage in the diff; please add or point CI at a focused test for the changed path in simulation.ts.
  • Before merge, I’d smoke-test the behavior touched by simulation.ts with malformed input / retry / rollback cases, since that’s where this class of change usually breaks.

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