ReviewOS

stacks/the-settlers-iii-remake

[S3-072] Implement military and religious AI

#74
Open chris opened this 8 days ago ·
8 days ago

S3-072: Implement military and religious AI

Parent and ownership

Parent epic: https://github.com/stacksjs/the-settlers-iii-remake/issues/11 Source owner: stacksjs/the-settlers-iii-remake. Master roadmap: https://github.com/stacksjs/the-settlers-iii-remake/issues/4.

Problem and observable result

Scout, defend, recruit, and capture legally. Use siege and interventions with actual costs. Respect allowed visibility.

The current application is a browser prototype. Passing the Riverlands campaign does not establish original-game or native parity. This issue is complete only when its stated behavior has retained evidence.

Evidence and interfaces

AI submits the same commands as players and observes an allowed player view. Difficulty is explicit and seeded. AI must not create resources or use concealed enemy information.

Pin the inspected revisions and fixture hashes in the implementation evidence. Original-game observations govern rules and timing. JSettlers is implementation evidence, not an authoritative balance specification. Unknown values remain explicitly unverified.

Acceptance criteria

  • Scout, defend, recruit, and capture legally.
  • Use siege and interventions with actual costs.
  • Respect allowed visibility.
  • The visible result agrees with the underlying simulation or platform state, including failure paths.
  • Tests exercise the maintained public interface and retain reproducible fixtures or execution receipts.

Test matrix

  • Run fixed-seed attack and defense scenarios.
  • Hide enemy units and verify AI decisions.
  • Exercise invalid input, cancellation or interruption, and repeated execution where this interface permits them.
  • Verify determinism/conservation for simulation changes and resource ownership/disposal for platform changes.
  • Run owning-repository lint, relevant type checks and tests. Capture actual native output for native capability claims.

Scope constraints

Implement this behavior as a complete verifiable slice. Do not silently expand into adjacent tickets or substitute simplified gameplay. Keep the shared TypeScript simulation, shared stx signals, and ts-css conventions. Native gameplay and HUD must not depend on a WebView. HomeOS reuse must not introduce a kernel dependency into the game. Existing unrelated edits and authored guidance must be preserved.

Blocked by

Upstream release and adoption

Application behavior belongs here. If a reproduction identifies a framework defect, repair and release its owning source first, update Stacks where affected, then install the verified packages here.

No node_modules edits, copied runtimes, generated-source string patches, fabricated globals, successful no-op implementations, or skipped release gates. Push tested conventional commits as Chris to the owning origin/main without coauthor trailers or force pushes.

Completion evidence

  • Implementation commits and relevant upstream issue links.
  • Exact checks and results, fixture hashes, and screenshots/native execution evidence where applicable.
  • Published package versions, downstream lockfile identity, and release receipts when affected.
  • Remaining limitations stated explicitly. Partial work does not close this issue.
7 days ago

The source-first web AI corrections through #202 are now qualified on main at b0d1df3. Exact CI 40242723177 succeeded; its original artifact 12618051922 matches SHA256 a5a9df03b47549820dcac09d0c7defcfb69649b48b63a0da9c82cd415fc9e4fc, with every CRC/all 385 steps/no error collections verified.

All four sampled ordinary two-policy matches now finish: seeds 1/5/2/3 at ticks 31801/73581/184761/139741. Complete traces have no failed commands and clean conservation. The charcoal correction uses the existing real recipe and demand; it changes no rules, starting stock, physics, speeds or battle deadlines. The source and rejected-candidate evidence are retained in the receipt. The qualified framework cohort remains Stacks 0.75.311 / STX 0.2.691 / Craft 0.0.341 / Pantry 0.11.127 / Bun 1.4.4.

This advances the browser engineering prototype. Keeping this broader issue open. A human-input skirmish victory, all-seed behavior, broader configuration, native presentation and original Gold Edition agreement remain unproven. Work continues on #203 after normal browser input exposed a woodcutter suggestion with no reachable trees despite other known usable sites. Seed 1 has no initially known granite, so its quarry fallback needs an honest warning rather than an invented productive-site claim.

7 days ago

Browser qualification advanced with #203, now closed after cc702ac8 and exact main CI40244633903. All318unit tests and385browser steps pass. The original19651byte artifact12618617732 matches SHA256 46b79dfa1daa049459610a92c9ee7f6836cdb17b8d32b434a3d224fd0d23bdfe, all CRCs/steps/error collections verified.

Keyboard construction now prefers known reachable harvest sites, retaining legal fallback and an honest absent-resource warning. Native input confirms the suggestion and actual log production. Receipt. Simulation rules/AI/locks are unchanged from the qualified charcoal publication; its four completed sampled AI matches remain source-pinned evidence, not a new all-seed claim.

The next actual human-playability frontier is #204, with an ordinary four-site reproduction of all hammers stranded in idle construction crew. Lowering the cap leaves the tools unavailable for a geologist. The pinned reference has periodic surplus jobless-crew conversion and actual tool drops; a versioned source correction must preserve old saves and real accounting. The manual match ended in defeat after this shortage. No human victory, full sustainable game, native UI or original Gold parity has been proved. Keeping this broader issue open.

7 days ago

Staffing controls can now return idle construction workers and their tools to carrying. Ground drops also preserve ownership when another player's pile is nearby. These fixes are covered by #204 and #205.

329 unit tests and 385 browser steps passed, including save/reload. CI and validation details.

The player test got tools and storage working, but lost the rival match. Testing the original tutorial map then exposed a separate staffing stall: unreachable trained workers kept blocking reachable carriers. That is tracked in #206.

7 days ago

The staffing fix passed the rival battle and save/reload checks. Four sampled AI matches finished without command or accounting errors.

Implementation, passing CI and validation details. Crew limits, goods accounting and older save rules are preserved.

A player skirmish victory still needs verification.

8 days ago

Progress in 7e0c690: the computer player now scouts, defends, recruits and captures, still deciding only from its own observation and acting only through ordinary commands.

  • Recruit: once its economy reaches iron, it builds a weaponsmith and a barracks, stores spears and bows, and switches on automatic recruitment.
  • Defend: enemy soldiers it sees on its own land are met where they stand. Ready soldiers go first; otherwise garrisons send all but their last soldier.
  • Scout: one soldier walks toward the nearest unexplored land, in a direction that turns with time.
  • Capture: once its army reaches the declared size (MilitaryPolicy.attackAt), it attacks the nearest enemy military building it can currently see.
  • Visibility: foreign buildings outside its sight never appear in its view, so it cannot attack what it has not found.

Tests (tests/unit/engine-ai.test.ts, military AI):

  • a fixed-seed scout, sighting, attack and capture; no attack is ordered before the tower enters its view, and audits stay clean
  • meeting a forced raider
  • identical decisions after a restore
  • the browser rival's commands are all accepted (tests/unit/controller.test.ts)

The browser's computer rival now plays with this policy. Both sides start with a small guard, an unverified start owned by S3-074.

Still open, so this issue stays open: siege and divine interventions with actual costs (blocked by S3-057/S3-062 and religion), and naval behaviour (S3-073).

8 days ago

Browser-first progress: the normal seed-2 rival now reaches a complete battle using its ordinary 44-person start and 30 starting planks. It surveys known neutral mountains, explores visible frontiers when minerals are still missing, orders real pioneers to expand toward positive survey signs, and builds mines only when a known owned deposit is in range. Production and recruitment remain ordinary engine jobs and commands; no goods, soldiers or hidden mineral knowledge are granted.

The deterministic regression produces iron ore, iron and swords, captures the human castle at tick 38341, and matches a fresh-AI mid-game restore. All 267 unit tests pass, plus app/tools/STX types, lint, production build and 339 existing browser scenario steps. A normal native-input browser run through the seed-2 field and 4x control reached Mission lost; saving and reloading retained the seed, loss and captured castle.

The retained command-line full-match scenario exposed an independent Stacks driver failure after a minute of idle waiting. A static page reproduced it. The fix is upstream in stacksjs/stacks#2992, source acaab209, with a real 65-second idle regression. Maintained bun run release:patch created 0.75.310; its CI/publication qualification is pending before normal game adoption and the full scenario rerun.

These are engineering-profile results for one passive-player battle. They do not establish original Gold rules/timings, human-victory acceptance, religious AI, every seed, or native game completion. The game source and final acceptance receipt are still being prepared for main.

8 days ago

Pushed to main as Chris without coauthors: bfa7cb4 mineral progression, c5b0f55 stone recovery, and 85ac0f1 qualified framework adoption.

The ordinary seed-2 rival surveys known land, uses real pioneers to reach resources, constructs mines, produces iron and weapons, and defeats a passive player at tick 38,441 with a clean conservation audit. A fresh-AI mid-game restore matches. The captured seed-3 material deadlock now resumes stone production through actual civilian refunds and a real stonecutter. The map-seed field and both unsigned seed endpoints survive ordinary checkpoints.

Installed Stacks 0.75.310 qualification passed all 95 selected original package trees and all seven consumer checks. Ten browser suites passed 385 steps with zero recorded console, network or collection errors. The complete battle ran 612,342 ms through the normal 4x control, reached defeat, then saved and reloaded the same seed and outcome. The execution receipt retains identity and pacing samples; original rasters remain local.

Exact main CI40208919317 is running. Keeping the broader roadmap open: this proves one passive-player Roman engineering battle, not a human victory, every seed, religious AI, original Gold balance/timing, all civilizations or native application completion.

8 days ago

Exact main CI 40208919317 succeeded on 85ac0f1, which remains origin/main. The original job log confirms 272 unit tests, zero failures, 22,758 assertions.

The original campaign-browser-check artifact 12604504234 is 19,659 bytes. Its SHA-256 481b25aad73ed1cad91acf0c5bb7e1137055e895aaedf5b9f6522c852275d3f4 matches GitHub's digest, every ZIP CRC passes, and every recorded assertion across 385 browser steps passes with zero console, network or collection errors. The complete normal seed-2 battle ran 610,472 ms, reached defeat, then acknowledged save and passed the seed/outcome assertions after a real reload. The archive contains diagnostics and media identities only, with no original raster upload.

This qualifies the specific source fixes and the published Stacks 0.75.310 adoption recorded in the source/publication and browser acceptance receipts. The broader roadmap remains open for human-victory coverage, all seeds, factions, religious AI, original Gold balance/timing, campaigns and complete native applications.

8 days ago

Published construction and neutral-resource planning corrections: https://github.com/stacksjs/the-settlers-iii-remake/commit/08d4eff3b50eb295e68324c2b453551cf829defb. Exact main CI: https://github.com/stacksjs/the-settlers-iii-remake/actions/runs/40225612811. The installed Stacks 0.75.311 cohort passes all 95 original package-tree checks, seven consumer checks, 283 unit tests and 385 browser steps.

A normal seed-2 match between two economic policies now finishes at tick 45321 with player 2 winning, checksum 26b13881, and clean conservation. This is distinct from the production-paced passive-player browser defeat/save/reload check.

Broader acceptance stays open: exploratory seeds 1, 3 and 5 are unfinished at 80000 ticks with clean accounting. Seeds 1 and 5 retain scouting refusals. A focused public-policy reproduction shows a sole tower guard selected while a two-person castle can legally supply a scout; the engine correctly refuses the sole guard. That military-policy correction is being verified separately in #195. Full random-map completion, original difficulty, human victory and Gold behavior are not established.

Public receipts: docs/roadmap/receipts/ai-neutral-harvest-2026-10-25.json, random-seed-followups-2026-10-25.json, and framework-0.75.311-browser-acceptance.json.

8 days ago

The city-site correction #197 is complete at ccaf4315f5301811a1848de8106136937ed937b7, normal FF origin/main push as Chris/no coauthors. Exact-main CI40234111784 succeeded. Original artifact12614458702 (19648bytes), SHA256 e93aad842ce81646a591ed969e4a5b3cfda993cff973e81736934cca1c536b5b, matches GitHub; everyZIPCRC/all385steps/empty browser error arrays verified. The committed receipt retains 296passing units, full local385step browser run and three finished sampled two-policy matches.

The subsequent quarry-budget fix #198 is pushed at 340ddc2a561354a9df8c2c246745e7e957b08ddb, with299passing units and another fresh385browsersteps including ten real minutes at4x/save/reload. Its exact-main CI40235769537 is still running, so #198 remains open. It restores real stone/metal/weapons in seed3. Ordinary two-policy seeds1/5finish34021/72501; seed2's normal continuation finishes119001, zero failed executions and clean accounting. Seed3remainsunfinished100000 despite14troops.

The matched forestry control disproved the initial permanent-deadlock hypothesis in #199: unmodified AI wins earlier than the manual work-area probe. #199 is closed as not planned; no forestry code change was made. The next reproduced military frontier is #200: all six fixed home rays explored,513unknown off-axis tiles and no scouting order at the normal100800decision. Its source fix is in progress.

This broader issue stays open. These are Roman engineering-profile browser checks, not complete AI difficulty/religion, human victory, every map seed, original Gold rules/content, or native presentation acceptance. Published Stacks311/STX691/Craft341/Pantry127 adoption remains as recorded in the95tree/sevenconsumer receipt; this app-only work changes no framework package or profile identity.

6 days ago

The source landscape correction in #219 also fixes scouting destinations: rays choose a direction, while the actual destination must be a reachable observed frontier. A three-soldier escort becomes available after the declared army threshold; each garrison retains its last guard. The normal rival scenario passes its unchanged simulation bound and the ten-real-minute browser battle through defeat and save/reload. All-seed warfare and Gold balance remain unqualified.

Validation: full CI, 413 unit tests and all 16 browser suites. The original diagnostic artifact checksum and ZIP integrity were independently verified.

Sign in to comment on this issue.