Repository navigation
Blockilization: line of sight as Civ V has it, and Indirect Fire - #45
Merged
Merged
Conversation
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
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.
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.cppandCvPlot::canSeePlotfrom the Brave New World SDK) and fixed where they differ:needsOne). Units that already have it aren't offered it.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:
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 buildpasses:npm run typecheckpasses locally, and CI's build (with the bundle) passed.npm run test:headlesspasses: the four Blockilization headless tests pass locally, and CI's full suite passed.@platform/@platform/client… (no new game)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