Skip to content

Blockilization: closed borders keep civilians out too - #43

Merged
Potrock merged 1 commit into
mainfrom
claude/project-thread-6dd9kq
Oct 25, 2026
Merged

Potrock merged 1 commit into
mainfrom
claude/project-thread-6dd9kq

Conversation

@Potrock

@Potrock Potrock commented Oct 25, 2026

Copy link
Copy Markdown
Owner

Requested by Patrick · project thread

What this is

A Blockilization fix. Closed borders kept soldiers out, but settlers, workers, great people and caravans could walk through any civ's land. In Civ V, no unit may enter another major civ's land in peace without Open Borders, so now civilians are kept out too.

  • The rule (rules/units.ts heedsBorders, rules/movement.ts closedLand). Every unit is kept out of land that's closed to it: another major civ's, at peace, that hasn't opened its borders to you. Missionaries, inquisitors and Great Prophets are exempt, as they are in Civ V. A city-state's land is still open to everyone, and so is an enemy's land in a war. A Great Musician now needs Open Borders to go on a concert tour, as in Civ V.
  • One rule everywhere. The move order (refused with "X's borders are closed to you"), the rules' paths (which now go round closed land), the bots' paths (ai/context.ts passable) and the route preview on the screen (client/path.ts) all use it.
  • Units already inside. When Open Borders ends, or borders grow over them, units are moved to the nearest tile outside as the turn ends. This already happened to soldiers and now happens to civilians too (a worker's job there is dropped). Missionaries stay.
  • The bots. A settler skips a site it can't reach because closed land is in the way. The advisor's "build a settler" hint uses the same check. A worker with no way to its best job takes the next one, trying up to three. A Great Musician tours only civs whose borders are open to it, and otherwise starts a golden age.
  • The Diplomacy concept page explains closed borders.

Missionaries can enter freely but don't lose strength in closed land. Civ V's "Unwelcome Evangelist" attrition isn't modelled.

Screenshot or clip

Rules only, no visual change. The route preview and the "borders are closed" reason now show for civilians as they already did for soldiers.

Checklist

  • npx tsc --noEmit and npm run check:boundaries pass. A full npm run build couldn't run here: wasm-opt couldn't be downloaded, so the engine was built with --no-opt for the tests.
  • npm run test:headless passes
  • The rules' behaviour tests (tests/cases.ts) pass, 273 of 273. The four new tests fail on the old code:
    • civilians are refused, routed round closed land, and let in by Open Borders, a war or a city-state's land; missionaries and prophets go in
    • soldiers and civilians are moved out when borders close; a missionary stays
    • a bot settler skips a site walled off by closed land, and goes to it once borders open
    • a bot worker passes over a job it can't reach for one it can
  • Bot-only benchmark (tests/ai-bench.ts, small maps, seeds 1–8), before and after. Cities by turn 60 and 120 are unchanged (3.95 and 5.95 on average). Turns spent broke went from 2.8 to 1.5 a game, a bot turn still takes about 11 ms, and there were no exceptions. The victory mix shifts because the games play out differently.
  • n/a: not a new game; names and assets unchanged

Generated by Claude Code

Without open borders (or a war), no unit may enter another major civ's land:
settlers, workers, great people and caravans now as well as soldiers, as in
Civ V. Missionaries, inquisitors and Great Prophets still go in without leave,
and a city-state's land stays open to all. Units left in land that closes to
them (open borders ending, borders growing over them) are moved out as the
turn ends, civilians included.

The move order, the rules' paths, the bots' paths and the screen's route
preview share the one rule (`heedsBorders`, `closedLand`). The bots keep to
it: settler sites behind closed land are passed over, a worker with no way to
its best job takes the next, and a Great Musician tours only where borders are
open to it.

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