Skip to content

Blockilization: line of sight as Civ V has it, and Indirect Fire - #45

Merged
Potrock merged 1 commit into
mainfrom
claude/project-thread-ughtuw
Oct 26, 2026
Merged

Potrock merged 1 commit into
mainfrom
claude/project-thread-ughtuw

Conversation

@Potrock

@Potrock Potrock commented Oct 26, 2026 •

Copy link
Copy Markdown
Owner

Requested by Patrick · project thread

What this is

A fix to ranged combat. Before this, Artillery couldn't shoot two tiles past a forest. I compared the game's line of sight with Civ V's own targeting code (CvTargeting.cpp and CvPlot::canSeePlot from the Brave New World SDK) and fixed where they differ:

  1. Indirect Fire was missing. In Civ V, Artillery, Rocket Artillery and the Battleship fire over whatever is in the way, at any tile their side can see. They now do here too. Ranged, siege and naval ranged units can take it as a promotion after Accuracy III or Barrage III. To allow that, promotions can now need one of several others (needsOne). Units that already have it aren't offered it.
  2. Firing round a tile at two range. When a shot two tiles out runs between two tiles (half of all the tiles at range 2), Civ V stops it only when both tiles block. This game's line always took one side, so a forest on that side blocked the shot even when the other side was open. This is likely why forests felt so aggressive.
  3. Range 3 and more. Civ V is stricter here: every tile the line crosses must be clear, and at most one tile it runs beside may block, and only early on the line. The ray is ported as written. I checked it against a literal transliteration of the C++ on 360,000 random cases, on flat and wrapping maps, with no mismatches.
  4. Wooded hills. Civ V's sight levels let a unit on a hill see over forest, jungle and other hills, but not over a forested or jungle hill, or a mountain. Before this, a unit on a hill saw over everything except mountains.

Sight (fog of war) uses the same ray and levels, so a unit sees what it can shoot. These rules already matched Civ V and are unchanged: a unit can always fire at the tile next to it, it can fire at a blocking tile but not past it, cities and aircraft ignore line of sight, and the target must be visible to someone on your side.

These are not changed, and I'm mentioning them for follow-up:

  • In Civ V, siege units have −1 sight (Limited Visibility), so Artillery relies on spotters. This game doesn't have that.
  • Ships use flat-ground sight levels. I couldn't confirm Civ V's sea values.

The Civilopedia's Combat article gets a "Line of sight" section, and Indirect Fire is listed with the other unit abilities. When a shot is blocked, the message now says mountains block it too.

Screenshot or clip

None. This is a rules change.

Checklist

  • npm run build passes: npm run typecheck passes locally, and CI's build (with the bundle) passed.
  • npm run test:headless passes: the four Blockilization headless tests pass locally, and CI's full suite passed.
  • A game imports only from @platform / @platform/client… (no new game)
  • Names are original
  • Assets: none added

Also run: there are three new cases in tests/cases.ts (line of sight, firing round a tile and range 3, Indirect Fire with the promotion and city fire). All 284 cases pass. I ran the bot benchmark (small 1-2) before and after. Bot turns took 13.5 ms on average against 14.9 ms before, and there were no exceptions.

🤖 Generated with Claude Code

https://claude.ai/code/session_01DJp3oDGF1p3b1w297oSHYf

Ranged attacks and sight now follow Civ V's targeting ray (CvTargeting): two
tiles off, a shot that passes between two tiles is stopped only when both
block, where before the line always took one side and a forest there stopped
it; further off, every tile it crosses must be clear and no more than one it
runs beside may block. Sight's levels are Civ V's too: from a hill a unit sees
over forest and hills but not over wooded hills or mountains.

Artillery, Rocket Artillery and the Battleship have Indirect Fire, as in
Civ V: they fire over what's in the way at anything their side sees. Ranged,
siege and naval ranged units can take it as a promotion after Accuracy III or
Barrage III (promotions can now need one of several).

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DJp3oDGF1p3b1w297oSHYf
@Potrock Potrock self-assigned this Oct 26, 2026
@Potrock
Potrock merged commit 45b2b9f into main Oct 26, 2026
3 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