One shared site rule decides where a structure stands, and structures stand on a city's open ground #129
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "task/3608-one-shared-site-rule-and-structures-stan"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Tracker: #3608
This PR puts the structure site rule in one function in
src/shared/site.ts, and every site calls it. A structure may now stand on a city's open ground, off its streets, its plots and the monument's block.The rule
siteRefusalanswers each tile with aconst enum SiteRefusalmember, or null when the tile is open. The members are: off the map, terrain closed to the site's domain, a unit holds it, a street, a standing building's plot, the monument's block, and beyond reach.siteOpenaccepts a footprint when every tile is open.Game.reseatnow skips aircraft, asGame.spawndoes, so a reload no longer closes the tiles under a hovering Gunship.heldTiles. The replica's route map uses the sameholdsGroundtest.Game.placeBuildingsiteNearfactorySiteclearOfCities,canPlaceFootprint,footprintNearCity,Replica.nearCityandReplica.clearOfCitiesare gone.inReachin cities.ts answers reach per tile.Where structures go
preferredSite, in the same file, ranks the sites the rule accepts. A site whose footprint keeps off a given set of cities' ground ranks above one on it. It returns the first site of the best rank, in the caller's search order.placeNearAnchorranks its anchor's spawn steps against every city.stageranks itsPLACE_STEPSthe same way. Its remote players keep their rotation, and they skip a try the rule accepts only below the best rank their steps offer.siteNearranks against every city it knows the layout of, its own, neutral and enemy alike. So it takes the first site of its ring that keeps off every city's ground, and a site on a city's open ground only when the ring has no other. This amends the plan's D5, which ranked against the AI's own cities only: under that ranking an AI seat in churn-128 re-placed its factory on a neutral city's open ground, and p1's deflated B/s fell 30% from base.placeNearAnchorkeep main's sites. Tests pin them:stageCasefor this.Tests
placeNearAnchortakes a city tile only when its steps offer no site off every city's ground.Help and changelog
Checks, against base
5da81ccsak-gate fullrun 1 passed on54d8ad4:npm test864/864 andtest:phone65/65.The bench and AI checks below ran on
a00e00f.54d8ad4changes only the changelog's text, so they stand.Net bench at seed 11 over wan, on esbuild bundles of both arms. Idle, battle, assault, economy, cities and siege at 128 and 256 match base exactly: frame, game and command hashes and every byte. Churn moves within 5%:
Churn's deltas come from the remote players' skipped tries. Each command a remote session sends advances its ack, and that costs a frame. When the skipped tries were sent as refused off-map placements, churn-256 matched base exactly.
The 14 AI matches, each seeded through
Math.random: small 1–6 with 2 seats, medium 1–4 with 3, and large 1–4 with 4. All ran to their end on both arms. 11 traces match base exactly. medium-1, medium-2 and large-3 differ partway through and still end at the 20-minute limit with the same standing seats.npm run towns, measured atdb394b0: "No Factory site at founding" goes from 0 / 5 / 7 to 0 / 0 / 0 at Lakes 0.25 / 0.9 / 1. Its other 20 rows are identical. The towns and traffic benches do not reachsiteNear, soa00e00fleaves these rows as they are.