ReviewOS

stacks/the-settlers-iii-remake

[S3-051] Implement barracks and individual recruitment

#53
Closed chris opened this 9 days ago ·
9 days ago

S3-051: Implement barracks and individual recruitment

Parent and ownership

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

Problem and observable result

Recruit three infantry classes from actual settlers and weapons. Support manual and automatic orders. Preserve original rank at recruitment.

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

Individual units execute deterministic commands. Recruitment, damage, ownership, offerings, promotions, and interventions use versioned faction rules and physical resources.

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

  • Recruit three infantry classes from actual settlers and weapons.
  • Support manual and automatic orders.
  • Preserve original rank at recruitment.
  • 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

  • Recruit with one missing requirement.
  • Verify weapon consumption and unit identity.
  • 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.
9 days ago

Completed in 36af2f0 and b3d7457 (rules profile roman-engineering 0.3.0, digest 0a78e27f…0af72).

  • Three infantry classes from actual settlers and weapons: a barracks receives swords, spears and bows by carrier like any other input. An idle carrier (respecting the carrier ratio) walks to the weapon, carries it to the door, and becomes a swordsman, pikeman or bowman. The weapon is recorded as equipped and leaves goods accounting. resources/game/engine/military.ts (enlist, arm).
  • Manual and automatic orders: recruit command per class (queue) and settings.recruitAutomatic; both are in the army panel. A missing weapon leaves the order waiting.
  • Rank at recruitment: settings.rank applies to soldiers recruited afterwards; serving soldiers keep theirs (manual candidate, evidence military.promotion).
  • Visible result: army panel counts by class, queued orders, rank and soldiers outside garrisons; soldiers are drawn with their rank's original sequence (file 12, 9/11/10, 15/17/16, 21/23/22 per reference movables-ROMAN) and a health bar.

Tests (tests/unit/engine-military.test.ts, recruitment block):

  • recruit with a missing spear: no pikeman, order stays queued; sword consumption and soldier identity, carrier count, ledger, rank 1 then rank 3 with 150 health
  • automatic recruitment, save/restore mid-recruitment with identical checksums
  • recruitment interrupted by demolishing the barracks while the weapon is carried: weapon dropped and conserved, no soldier, order back in the queue, audit clean
  • malformed orders refused (non-soldier class, zero count, rank 4)

Lint, typecheck and the full unit suite (125 tests) pass. Barracks cost stays a manual candidate with the reference discrepancy tracked in #104.

Sign in to comment on this issue.