ReviewOS

stacks/the-settlers-iii-remake

[S3-052] Implement original troop selection and commands

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

S3-052: Implement original troop selection and commands

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

Support rectangles and additive/type selection. Implement groups, waypoints, patrols, and forced movement. Recall groups and camera correctly.

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

  • Support rectangles and additive/type selection.
  • Implement groups, waypoints, patrols, and forced movement.
  • Recall groups and camera correctly.
  • 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

  • Replay original keyboard and pointer sequences.
  • Change commands during movement and combat.
  • 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

Progress in 36af2f0: soldiers take deterministic commands through the normal command queue.

  • move-soldiers sends soldiers to a tile, where they hold the position.
  • attack targets a visible enemy military building.
  • Each garrison keeps its last soldier.
  • Malformed, foreign and out-of-map orders are refused with reasons, and tested.
  • The browser has a Send soldiers tool: it sends soldiers standing outside, or the garrisons when none are outside. Verified on the T1 tutorial map.

Not done yet, so this stays open: rectangle, additive and type selection, groups and recall, waypoints, patrols, forced movement, camera recall, and replaying original keyboard/pointer sequences.

9 days ago

Completed in 29c432f (on top of 36af2f0), following the pinned manual's "How to Direct Soldiers" (military.htm, SHA-256 1609d51c59a335194f10be6d2cf51c612f3b1fe28ae507c5e2a8aafa922911f7).

  • Rectangle, additive and type selection: a left click or a dragged rectangle marks soldiers. SHIFT adds to the marked group. ALT-click marks every soldier of that type nearby; the manual says only "a wider radius", so TYPE_RADIUS = 12 is an engineering choice. Marked soldiers are ringed. The map pans with the right or middle button or touch.
  • Groups and recall: ALT+1-9 stores a group, the number marks it, and pressing it twice centers the view on it. Fallen soldiers drop out of selections and groups.
  • Moves: a right click moves, or attacks an enemy military building. CTRL forces a move that ignores enemies until arrival. SHIFT adds waypoints, at most three before the destination; the fifth move is refused. ALT patrols between the start and the turn-around point. Any other move cancels the previous one. Routes, patrols and forced moves are saved and validated.
  • Visible result: dispatch messages report how many soldiers obey and how. Verified in the browser on the T1 tutorial map: marked 14 soldiers with a rectangle, moved them with a right click, stored them with ALT+1, and recalled and centered them with 1, 1.

Tests:

  • tests/unit/troops.test.ts replays the manual's input sequences against createTroops: rectangle, SHIFT, ALT type, clear, groups, recall, centering, and each right-click variant. The engine accepts every resulting command.
  • tests/unit/engine-military.test.ts, movement orders: waypoint order and limit, a patrol turning at both ends and surviving a restore, a patrol cancelled by a new move, a forced move past an enemy, a diverted normal move ending in a fight, a forced retreat out of a fight in progress, and malformed modes and tampered routes refused.

Not in scope here: TAB to keep only wounded soldiers marked belongs with healers. War machines are owned elsewhere in epic #9.

9 days ago

Additional real-browser acceptance is retained in e73277f, with the exact source and installed versions in the receipt.

Native Chrome tab input exercised dispatch from the castle, a real left-pointer rectangle selecting five soldiers, Alt+1 storage, Escape then 1 recall, Ctrl+right-click forced movement, Shift+right-click waypoint append, Alt+right-click patrol, and normal Save/Load. The restored Army panel retained five soldiers outside the garrison and cleared transient selection. Original-media raster remains local; the committed receipt records its SHA256 and dimensions.

This is interface evidence, separate from the automated DOM-event selection regression. It does not measure completed patrol routes, combat or original Gold balance, and does not qualify native game acceptance. No runtime substitution or application state injection was used.

The screenshot API returned JPEG bytes. The corrected receipt identifies the actual JPEG format and 1167x798 dimensions; an initial PNG-offset interpretation was invalid. The original image bytes and SHA256 did not change.

Sign in to comment on this issue.