19 KiB
{
"version": 3,
"id": "muc162bo-njvm8l",
"objective": "=== Goal ===\nObjective: Periodic random ship encounters in every neutral system (except the player's home system) — pirate ships, friendly neutral ships (new spritesheet frames 20–27), or both — where neutral ships escort the player, fight alongside them against pirates, then break off and fly off-screen, with all behavior data-driven and tunable.\n\nSuccess criteria:\n- In a neutral non-home system, while flying with no combat live, encounters trigger periodically (config: roll every ~45–90 s at ~50–60% chance, one at a time, ~30–60 s cooldown after one ends); all tunables live in data/combat.json.\n- Three encounter kinds roll at EVEN odds (~1/3 each, weighted in data/combat.json): pirates-only, neutrals-only, and mixed (pirates + neutrals); ships materialize off-screen and stream in via the existing spawn path (no mid-fight pops).\n- Group size GROWS WITH THE PLAYER'S XP LEVEL: 1–2 ships in a low level, scaling up to 4–5 at higher levels (level bands + per-kind counts in data/combat.json; mixed keeps both kinds present, e.g. 2 pirates + 1–2 neutrals at high end).\n- Neutrals-only: each neutral ship flies near the player for a random 10–15 s, then breaks off and flies off-screen; the encounter ends when the last one is off-screen.\n- Mixed: neutral ships attack the nearest pirate using varied weapon patterns (lance/spray/burst/rapid/ring/missile/combo); pirates attack both the player and neutral ships; when the last pirate is down, surviving neutrals escort the player for 10–15 s, then break off and fly off-screen.\n- Pirates-only: existing chase/lance behavior intact — hostiles fire once in range.\n- Neutral ship types (frames 20–27) are EIGHT DISTINCT crafts — each frame gets its own weapon pattern and a stats ramp (hull/shields/speed/XP), like the pirate roster.\n- Kills of pirates still award existing XP.\n- No encounters ever in the home system or in faction-controlled systems; random encounters never start while the 'Pirate Problems' ambush or any other wave run is in flight.\n\nBoundaries:\n- In scope: neutral ship types + roster config (data/combat.json, EnemyTypes registry), ally AI (escort/assist/depart), pirate target generalization (player or neutrals), the encounter director (trigger/cadence/composition/size-scaling/lifecycle) in GameScene + CombatSystem, combat-HUD readability for these encounters, Node unit tests for new pure logic.\n- Out of scope: encounters in faction systems or the home system; new rewards/economy hooks beyond existing XP; new audio/comms for neutral ships; save persistence of an in-flight encounter (same scene-local rule as the quest ambush); galaxy-map-level encounters; new art (frames 20–27 already exist on assets/images/ships-enemy.png).\n\nConstraints:\n- Neutral ships never target or damage the player, and the player's own shots never damage neutral allies (no friendly fire); the player's auto-fire only targets pirates.\n- Neutral lifecycle state machine: spawn off-screen → (escort 10–15 s | engage pirates until all down) → escort 10–15 s → break off and fly off-screen → despawn off-screen.\n- Reuse existing building blocks: EnemyShip, the EnemyTypes deep-merge registry, Weapons.js patterns, CombatSystem off-screen wave spawn + on-screen fire rule, XpManager level as the size-scaling input; no parallel combat systems.\n- Every new tunable (cadence, weights, size bands, stats, escort duration) in data/combat.json — no magic numbers in code.\n- Existing combat must keep working: the ?combat sandbox, the 'Pirate Problems' ambush, and the combat_demo sequence.\n\nVerification contract:\n- node dev/run-all.mjs — 0 failures, including new tests covering the neutral roster config (8 distinct patterns), composition roll (even odds), size-scaling bands, and cadence/cooldown rules (pure logic, Node-only).\n- Manual playthrough checklist in the browser: (1) home system: no encounters over several minutes; (2) neutral system: all three encounter kinds appear roughly evenly over time at a non-constant pace, respecting cooldown; (3) neutrals-only: 10–15 s escort then break-off off-screen; (4) mixed: neutrals visibly shoot pirates, pirates shoot player + neutrals, survivors escort then leave; (5) faction system: no encounters; (6) 'Pirate Problems' ambush and ?combat sandbox unaffected; (7) group size visibly larger at a higher XP level than at level 1.\n\nIf blocked: stop and ask the user (default).\n\nTasks:\n1. Neutral ship roster + config — define neutralTypes (frames 20–27) in data/combat.json: eight distinct crafts, each a unique weapon pattern + stats ramp (hull/shields/speed/XP); register them as player-side types in the EnemyTypes registry; Node tests for roster + config merge.\n2. Ally AI for neutral ships — escort/engage/break-off state machine, target selection (nearest pirate, else escort the player 10–15 s), fire via existing Weapons patterns at pirate targets, excluded from player auto-fire targeting.\n3. Pirate targeting generalization — in mixed encounters pirates target the player and neutral ships (player preferred when in range); their bolts/missiles can damage neutral ships; no behavior change for pirates-only.\n4. Encounter director — GameScene/CombatSystem time-based periodic trigger (neutral non-home systems, interval + chance + cooldown, one at a time, wave-run guard); EVEN-WEIGHTED composition roll (pirates-only / neutrals-only / mixed, ~1/3 each); group size scaled by player XP level (1–2 ships low → 4–5 high, bands in data/combat.json); off-screen spawn + lifecycle/finish; full config section in data/combat.json.\n5. HUD readability + regression — threat markers, off-screen arrows, and kill feed correct for mixed encounters; confirm ?combat sandbox, 'Pirate Problems' ambush, and combat_demo still work.\n6. Verification + tuning — dev/run-all.mjs green, new director/roster tests, manual playthrough checklist (all seven items above), and a balance/tuning pass on cadence, weights, size bands, and neutral stats.",
"status": "complete",
"autoContinue": true,
"usage": {
"tokensUsed": 34714474,
"activeSeconds": 34776
},
"sisyphus": false,
"revision": 543,
"createdAt": "2026-09-22T02:03:56.868Z",
"updatedAt": "2026-09-22T12:33:12.796Z",
"scheduler": {
"version": 1,
"owner": "01a0c6a8-2a48-73b4-81cc-08edd13c36e9",
"generation": "26da9df5-d3fb-440b-938c-70163b1d3e15",
"used": 7,
"phase": "running",
"repairUsed": false,
"decision": {
"kind": "ready",
"nextAction": "Retry after the provider error and continue pursuing the goal.",
"purpose": "recovery"
},
"dispatch": {
"id": "dda17093-02e1-44af-a76f-b44843d45148",
"kind": "recovery",
"claimedAt": 1790053931046
}
},
"taskList": {
"tasks": [
{
"id": "task-1",
"title": "Neutral ship roster + config (frames 20–27)",
"status": "complete",
"verificationContract": "neutralTypes present in data/combat.json: 8 distinct crafts (frames 20–27), each with a unique weapon pattern + stats ramp; EnemyTypes registry resolves them as player-side types; Node test (dev/*.test.mjs via dev/run-all.mjs) asserts roster + config merge — 0 failures.",
"completedAt": "2026-09-22T02:24:26.180Z",
"evidence": "data/combat.json: neutral base + 8 neutralTypes on frames 20–27 (8 distinct patterns incl. new 'volley' in Weapons.js), monotonic hull/shields ramp, xp=(hull+shields)/5; EnemyTypes.neutralTypeConfig/I"
},
{
"id": "task-2",
"title": "Ally AI for neutral ships (escort/assist/depart)",
"status": "complete",
"verificationContract": "Neutral ships escort the player 10–15 s then break off off-screen (neutrals-only); in mixed fights they target the nearest pirate and fire via existing Weapons patterns; never target/damage the player; excluded from player auto-fire; covered by Node logic test.",
"completedAt": "2026-09-22T03:12:28.542Z",
"evidence": "dev/neutral.test.mjs 33/33 pass: roster (allies roster, side 'player', frames 20–27), escort window from data (escortMin/Max 10–15 s), escort (no fire at player), break-off fly-off, despawn off-screen"
},
{
"id": "task-3",
"title": "Pirate targeting generalization (player + neutrals)",
"status": "complete",
"verificationContract": "In mixed encounters pirates attack the player and neutral ships (player preferred when in range); their bolts/missiles damage neutrals; pirates-only behavior unchanged; covered by Node logic test.",
"completedAt": "2026-09-22T03:12:28.546Z",
"evidence": "dev/neutral.test.mjs pirate-targeting block: player preferred in weapon range, nearest in-range escort draws aggro when player out of range, classic chase unchanged with no escort in reach, pirate lan"
},
{
"id": "task-4",
"title": "Encounter director (trigger, cadence, composition, size-scaling)",
"status": "complete",
"verificationContract": "Time-based periodic rolls (default ~45–90 s interval, ~50–60% chance, ~30–60 s cooldown, one active at a time) fire only in neutral non-home systems and never during an in-flight wave run; EVEN-WEIGHTED composition (~1/3 pirates-only, ~1/3 neutrals-only, ~1/3 mixed); group size scales with player XP level (1–2 low → 4–5 high, bands in data/combat.json); ships spawn off-screen; lifecycle ends with all ships off-screen; Node tests for cadence/cooldown/composition/size rules — 0 failures.",
"completedAt": "2026-09-22T03:43:19.224Z",
"evidence": "js/combat/Encounters.js (pure director) + encounters section in data/combat.json + GameScene wiring (spawn off-screen, one-shot pirates); dev/encounters.test.mjs 48/48 (cadence exact-timing, one-at-a-"
},
{
"id": "task-5",
"title": "HUD readability + existing-combat regression",
"status": "complete",
"verificationContract": "Threat markers / off-screen arrows / kill feed render correctly for mixed encounters in-browser; ?combat sandbox, 'Pirate Problems' ambush, and combat_demo verified working.",
"completedAt": "2026-09-22T07:16:46.267Z",
"evidence": "encounter-hud-check.mjs PASS exit=0 (×2): threat markers off→0/on→2 pirates px-lit/restore→0; arrows px-verified at both pirates' edges, escorts never; kill feed live text @1262 alpha .95 + ink px abo"
},
{
"id": "task-6",
"title": "Verification + tuning pass",
"status": "complete",
"verificationContract": "node dev/run-all.mjs green (0 failures, incl. new tests); manual playthrough checklist complete: home system no encounters, neutral system all three kinds roughly even at a non-constant pace with cooldown, neutrals-only escort+break-off, mixed fight + survivor escort, faction system no encounters, quest ambush/sandbox unaffected, group size larger at higher XP level than level 1; cadence/weights/size bands/neutral stats tuned to feel periodic-not-constant.",
"completedAt": "2026-09-22T10:28:11.546Z",
"evidence": "run-all.mjs ALL 66 TESTS PASSED (incl. encounters/neutral/roster new tests); combat-demo-check PASS (sandbox+combat_demo intact); encounter-hud-check 7 consecutive passes (mixed arrows/threat/feed+esc"
}
],
"blockCompletion": false,
"proposedAt": "2026-09-22T02:02:03.207Z"
},
"stopReason": "agent",
"archivedPath": ".pi/goals/archived/goal_2026092206331272_muc162bo-njvm8l.md"
}
Goal Prompt
=== Goal === Objective: Periodic random ship encounters in every neutral system (except the player's home system) — pirate ships, friendly neutral ships (new spritesheet frames 20–27), or both — where neutral ships escort the player, fight alongside them against pirates, then break off and fly off-screen, with all behavior data-driven and tunable.
Success criteria:
- In a neutral non-home system, while flying with no combat live, encounters trigger periodically (config: roll every ~45–90 s at ~50–60% chance, one at a time, ~30–60 s cooldown after one ends); all tunables live in data/combat.json.
- Three encounter kinds roll at EVEN odds (~1/3 each, weighted in data/combat.json): pirates-only, neutrals-only, and mixed (pirates + neutrals); ships materialize off-screen and stream in via the existing spawn path (no mid-fight pops).
- Group size GROWS WITH THE PLAYER'S XP LEVEL: 1–2 ships in a low level, scaling up to 4–5 at higher levels (level bands + per-kind counts in data/combat.json; mixed keeps both kinds present, e.g. 2 pirates + 1–2 neutrals at high end).
- Neutrals-only: each neutral ship flies near the player for a random 10–15 s, then breaks off and flies off-screen; the encounter ends when the last one is off-screen.
- Mixed: neutral ships attack the nearest pirate using varied weapon patterns (lance/spray/burst/rapid/ring/missile/combo); pirates attack both the player and neutral ships; when the last pirate is down, surviving neutrals escort the player for 10–15 s, then break off and fly off-screen.
- Pirates-only: existing chase/lance behavior intact — hostiles fire once in range.
- Neutral ship types (frames 20–27) are EIGHT DISTINCT crafts — each frame gets its own weapon pattern and a stats ramp (hull/shields/speed/XP), like the pirate roster.
- Kills of pirates still award existing XP.
- No encounters ever in the home system or in faction-controlled systems; random encounters never start while the 'Pirate Problems' ambush or any other wave run is in flight.
Boundaries:
- In scope: neutral ship types + roster config (data/combat.json, EnemyTypes registry), ally AI (escort/assist/depart), pirate target generalization (player or neutrals), the encounter director (trigger/cadence/composition/size-scaling/lifecycle) in GameScene + CombatSystem, combat-HUD readability for these encounters, Node unit tests for new pure logic.
- Out of scope: encounters in faction systems or the home system; new rewards/economy hooks beyond existing XP; new audio/comms for neutral ships; save persistence of an in-flight encounter (same scene-local rule as the quest ambush); galaxy-map-level encounters; new art (frames 20–27 already exist on assets/images/ships-enemy.png).
Constraints:
- Neutral ships never target or damage the player, and the player's own shots never damage neutral allies (no friendly fire); the player's auto-fire only targets pirates.
- Neutral lifecycle state machine: spawn off-screen → (escort 10–15 s | engage pirates until all down) → escort 10–15 s → break off and fly off-screen → despawn off-screen.
- Reuse existing building blocks: EnemyShip, the EnemyTypes deep-merge registry, Weapons.js patterns, CombatSystem off-screen wave spawn + on-screen fire rule, XpManager level as the size-scaling input; no parallel combat systems.
- Every new tunable (cadence, weights, size bands, stats, escort duration) in data/combat.json — no magic numbers in code.
- Existing combat must keep working: the ?combat sandbox, the 'Pirate Problems' ambush, and the combat_demo sequence.
Verification contract:
node dev/run-all.mjs— 0 failures, including new tests covering the neutral roster config (8 distinct patterns), composition roll (even odds), size-scaling bands, and cadence/cooldown rules (pure logic, Node-only).- Manual playthrough checklist in the browser: (1) home system: no encounters over several minutes; (2) neutral system: all three encounter kinds appear roughly evenly over time at a non-constant pace, respecting cooldown; (3) neutrals-only: 10–15 s escort then break-off off-screen; (4) mixed: neutrals visibly shoot pirates, pirates shoot player + neutrals, survivors escort then leave; (5) faction system: no encounters; (6) 'Pirate Problems' ambush and ?combat sandbox unaffected; (7) group size visibly larger at a higher XP level than at level 1.
If blocked: stop and ask the user (default).
Tasks:
- Neutral ship roster + config — define neutralTypes (frames 20–27) in data/combat.json: eight distinct crafts, each a unique weapon pattern + stats ramp (hull/shields/speed/XP); register them as player-side types in the EnemyTypes registry; Node tests for roster + config merge.
- Ally AI for neutral ships — escort/engage/break-off state machine, target selection (nearest pirate, else escort the player 10–15 s), fire via existing Weapons patterns at pirate targets, excluded from player auto-fire targeting.
- Pirate targeting generalization — in mixed encounters pirates target the player and neutral ships (player preferred when in range); their bolts/missiles can damage neutral ships; no behavior change for pirates-only.
- Encounter director — GameScene/CombatSystem time-based periodic trigger (neutral non-home systems, interval + chance + cooldown, one at a time, wave-run guard); EVEN-WEIGHTED composition roll (pirates-only / neutrals-only / mixed, ~1/3 each); group size scaled by player XP level (1–2 ships low → 4–5 high, bands in data/combat.json); off-screen spawn + lifecycle/finish; full config section in data/combat.json.
- HUD readability + regression — threat markers, off-screen arrows, and kill feed correct for mixed encounters; confirm ?combat sandbox, 'Pirate Problems' ambush, and combat_demo still work.
- Verification + tuning — dev/run-all.mjs green, new director/roster tests, manual playthrough checklist (all seven items above), and a balance/tuning pass on cadence, weights, size bands, and neutral stats.
Progress
- Status: complete
- Auto-continue: on
- Sisyphus mode: no
- Time spent: 9h39m36s
- Tokens used: 35M (34,714,474) tokens
Tasks
- task-1: Neutral ship roster + config (frames 20–27) — evidence: data/combat.json: neutral base + 8 neutralTypes on frames 20–27 (8 distinct patterns incl. new 'volley' in Weapons.js), monotonic hull/shields ramp, xp=(hull+shields)/5; EnemyTypes.neutralTypeConfig/I
- task-2: Ally AI for neutral ships (escort/assist/depart) — evidence: dev/neutral.test.mjs 33/33 pass: roster (allies roster, side 'player', frames 20–27), escort window from data (escortMin/Max 10–15 s), escort (no fire at player), break-off fly-off, despawn off-screen
- task-3: Pirate targeting generalization (player + neutrals) — evidence: dev/neutral.test.mjs pirate-targeting block: player preferred in weapon range, nearest in-range escort draws aggro when player out of range, classic chase unchanged with no escort in reach, pirate lan
- task-4: Encounter director (trigger, cadence, composition, size-scaling) — evidence: js/combat/Encounters.js (pure director) + encounters section in data/combat.json + GameScene wiring (spawn off-screen, one-shot pirates); dev/encounters.test.mjs 48/48 (cadence exact-timing, one-at-a-
- task-5: HUD readability + existing-combat regression — evidence: encounter-hud-check.mjs PASS exit=0 (×2): threat markers off→0/on→2 pirates px-lit/restore→0; arrows px-verified at both pirates' edges, escorts never; kill feed live text @1262 alpha .95 + ink px abo
- task-6: Verification + tuning pass — evidence: run-all.mjs ALL 66 TESTS PASSED (incl. encounters/neutral/roster new tests); combat-demo-check PASS (sandbox+combat_demo intact); encounter-hud-check 7 consecutive passes (mixed arrows/threat/feed+esc