ReviewOS

stacks/the-settlers-iii-remake

[S3-053] Implement individual combat and projectiles

#55
Open chris opened this 9 days ago ·
9 days ago

S3-053: Implement individual combat and projectiles

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

Resolve deterministic target and movement decisions. Apply health, ranged attacks, and verified strength. Account for unit death and ownership.

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

  • Resolve deterministic target and movement decisions.
  • Apply health, ranged attacks, and verified strength.
  • Account for unit death and ownership.
  • 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

  • Compare repeated melee and ranged encounters.
  • Verify wealth and visibility effects.
  • 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: individual combat and projectiles run in the deterministic engine.

Done, with tests in tests/unit/engine-military.test.ts:

  • Deterministic targeting (nearest visible enemy soldier, ties by id) and movement: chase, stop on the tile entered once in reach, bowmen step back when too close. A melee duel gives identical checksums across two runs and a mid-fight save/restore.
  • Health and strength by rank, swordsman and pike reach, bow range 7 to 15 and 25 from walls. Arrows are saved entities that land after 4 + 2 × distance ticks and miss a target that has moved more than one step. Tested both ways, including a save mid-flight.
  • Deaths are recorded in the ledger and events; the weapon goes with the soldier as equipment. Soldiers fight only what their player currently sees.

Still open:

  • Verified strength: health, strength, reach and attack timing are reference-remake values (evidence class E, professions.soldiers), not original observations. Recruitment time and search reach are U placeholders owned here.
  • Wealth effects: gold-based soldier strength is not implemented.
  • Presentation: strike animations (ACTION1 sequences 12/12-14, 18-20, 24-26) are not mapped yet. Arrows are drawn as plain shafts because no original arrow sprite is mapped.
9 days ago

Progress in 3f07ce0: wealth effects are in.

Rules roman-engineering 0.4.0 add the reference remake's combat-strength rule (CombatStrengthInformation.java, SoldierMovable#getCombatStrength, evidence class E). Damage is the rank's strength × log2(gold + start) / 9, where gold is what the player can hand out (not reserved, not inputs or construction) and start depends on the number of players. On their own land, soldiers never fall below full strength. The manual (military.htm) only confirms that gold strengthens soldiers.

The logarithm uses fixed point (squaring and halving), so browser, Bun and native hosts compute identical damage. Profile 0.3.0 is frozen in the catalog and keeps full strength for games saved with it.

Tests: strength 495 per mille away from home without gold for two players, 1000 at home, 1000 with 490 gold, the reference value with 1000 gold, reserved gold excluded, a gold-backed swordsman winning an otherwise equal duel, and 0.3.0 unchanged.

Visibility is already enforced: soldiers target only enemies their player currently sees. The arrow tests rely on this; the enemy pikeman never sees the bowman beyond settler sight.

This also fixed a save defect: settlers whose job was cancelled, or who were released mid-step, kept a half-taken step, so the save was refused.

Still open, so this issue stays open: verified (original-observed) health, strength and timing (S3-002), and strike animations from the ACTION1 sequences.

Sign in to comment on this issue.