Skip to content

調査: 味方機体・敵機体の運用モデルと NPC 行動契約を正本化する #975

Closed
7 of 7 issues completed

Description

@squne121

Machine-Readable Contract

contract_schema_version: v1
issue_kind: research
parent_issue: "none"
goal_ref: "RTS/Z指示モードの実装前に、味方機体・敵機体・NPC の運用、command intent、targeting、AI state、UI surface 境界を product SSOT として定義し、後続 implementation Issue が起票可能な状態にする"
change_kind: research-only

Parent Issue

none

Outcome

docs/product/features/unit-operations-and-npc-behavior.md を primary artifact として作成し、RTS/Z 指示 mode の前提となる unit taxonomy・faction・role・command intent・NPC state machine・targeting priority・deterministic update order・UI / debug surface 境界・playtest measurement を product SSOT として正本化する。これにより「Z 指示 mode」「戦闘中 HUD」「ブリーフィング」を分解する後続 implementation Issue が安全に起票可能な状態になる。

In Scope

  • 味方機体 / 敵機体 / player-controlled entity / neutral entity の分類(unit taxonomy)
  • Faction / UnitRole / CommandIntent / NpcBehaviorState / TargetingPolicy の型・enum 定義案
  • 味方機体が commandable か semi-autonomous か pure NPC かの決定
  • 敵機体の基本運用(chase / guard / intercept / retreat、target player / target ally の優先順位)
  • 味方機体の基本運用(follow / assist / hold / intercept / retreat、revive / repair の採否)
  • MVP に含める macro command を最大 1 種(assist_player 候補)に制限するかの判断
  • Z キーを直接固定する前に、Z が発火する CommandIntent の定義
  • fixed tick 内の update order と deterministic tie-break(threatScore DESC, distance ASC, entityId ASC 等)
  • 通常 UI / debug UI の情報境界(Canvas は visual cue、DOM HUD は authoritative control surface)
  • playtest で「勝因がプレイヤー介入に見えるか」を測る観測方法
  • milestone movement + projectile の最小仕様を固定する #2 と repo roadmap の境界整合方針(roadmap 同期 or spec delta)の記述

Out of Scope

  • 実装コード変更(src/ / tests/)
  • pathfinding / navmesh
  • large squad formation
  • base building / territory
  • network / multiplayer
  • full behavior tree / GOAP
  • high fidelity asset / animation polish
  • 複数 command intent の同時実装

8-Stage Follow-up Decomposition

後続 implementation Issue は以下の順序で起票する(artifact に詳細を含む):

  1. docs-only: unit-operations-and-npc-behavior.md SSOT accepted
  2. state/types: Faction / UnitRole / CommandIntent 型追加(ally runtime はまだ追加しない)
  3. command intent input: binding-agnostic command intent buffer + Z-equivalent mapping(DOM/focusable fallback 必須)
  4. targeting policy: deterministic target scoring pure function + unit tests
  5. ally NPC MVP: 1 種 ally_basic state と semi-autonomous behavior
  6. enemy policy migration: existing enemy_chaser を new taxonomy に対応(挙動は変えない)
  7. HUD/Canvas integration: DOM command affordance + Canvas visual cue([Deferred] 実装: 戦闘中ステータス(HULL/HP)を戦闘描画画面(Canvas)に集約表示する #727 は rewrite/replacement)
  8. playtest/evidence: self-explanation test + artifact/Pages evidence policy

Roadmap Boundary

  • This issue does not create or mutate GitHub Milestone objects.
  • "M2" refers only to the conceptual roadmap section in docs/product/playable-roadmap.md.
  • Runtime implementation belongs to follow-up issues after this SSOT is accepted.

RTS Boundary

  • "Z指示" is a lightweight macro intent, not a full RTS command system.
  • No multi-select, command queue, squad formation, pathfinding, navmesh, base building, or territory control.
  • MVP supports at most one player command intent: assist_player.
  • The default key binding may be Z-equivalent, but product SSOT defines CommandIntent, not a physical key.

UI Surface Contract

  • Canvas may show non-authoritative visual cues: target line, ally intent icon, danger/warning shape.
  • DOM HUD must provide the authoritative, focusable player command affordance for assist_player.
  • Canvas text or icon must not be the only representation of command state.
  • Debug panel may expose raw CommandIntent / NpcBehaviorState / target score.
  • Normal UI must not expose raw enum labels.

#727 Handling

Acceptance Criteria

  • AC1: docs/product/features/unit-operations-and-npc-behavior.md が YAML フロントマター付きで作成され、feature ID / status / related issue / acceptance / non-goals / related tests を含む
  • AC2: 同ファイルに unit taxonomy・Faction / UnitRole / CommandIntent / NpcBehaviorState / TargetingPolicy の定義が記載されている
  • AC3: 同ファイルに fixed tick 内の update order と deterministic tie-break ルールが記載されている(current runSortieSimulationStep との差分付き NPC tick schedule を含む)
  • AC4: 同ファイルに通常 UI / debug UI の情報境界(Canvas cue + DOM/focusable control)が記載されている
  • AC5: 同ファイルに playtest measurement(勝因がプレイヤー介入に見えるかの観測方法)が記載されている
  • AC6: milestone movement + projectile の最小仕様を固定する #2 と repo roadmap の境界整合方針が記載されている
  • AC7: 結論をもとに後続 implementation Issue が起票され、本 Issue がそれを link している(または追加調査要件が明示されている)
  • AC8: Roadmap Boundary が本 Issue 本文および artifact に明記されている
  • AC9: RTS Boundary が本 Issue 本文および artifact に明記されている
  • AC10: artifact に Current Runtime Compatibility Matrix(GameState.player / EnemyState / EnemyAISystem / runSortieSimulationStep との対照表)が含まれる
  • AC11: artifact に NPC tick schedule(current / target order 差分付き)が含まれる
  • AC12: artifact に assist_player MVP semantics 契約(Source / Duration / TTL / no-op conditions / effect / DOM focusable affordance / Canvas visual cue / debug panel / normal UI wording)が含まれる
  • AC13: UI Surface Contract が本 Issue 本文および artifact に明記されている(Canvas/DOM 責務境界)
  • AC14: [Deferred] 実装: 戦闘中ステータス(HULL/HP)を戦闘描画画面(Canvas)に集約表示する #727 が rewrite/replace only として本 Issue 本文に明記されている
  • AC15: Playtest falsification signals が HYP-001 と接続されており、以下の 4 項目が artifact に含まれる: (a) Player cannot explain what assist_player did; (b) Player attributes victory primarily to allied AI randomness rather than own intervention; (c) Command use does not correlate with local threat removal or ally survival; (d) Command feedback is noticed only as debug text, not as world/visual cue
  • AC16: Evidence/Distribution Policy が artifact に含まれており、以下を要求している: full commit SHA, GitHub Actions run ID, deployed page_url or stable artifact URL, artifact names, artifact digests, retention-days, viewport / DPR / browser zoom / userAgent / timezone / paused/running state / screenshot path
  • AC17: 8 段階 follow-up 分解が artifact に含まれる(本 Issue Out of Scope セクション参照)

Verification Commands

# AC1
# baseline-expect: fail
$ test -f docs/product/features/unit-operations-and-npc-behavior.md
# AC2
# baseline-expect: fail
$ rg -n "feature_id|status|related_issue|acceptance|non_goals|related_tests" docs/product/features/unit-operations-and-npc-behavior.md
# AC3
# baseline-expect: fail
$ rg -n "candidate filter|target score|tie-break|entityId ASC|stale target|defeated" docs/product/features/unit-operations-and-npc-behavior.md
# AC4
# baseline-expect: fail
$ rg -n "Canvas.*visual cue|DOM.*focusable|debug.*raw|CommandIntent.*debug|NpcBehaviorState.*debug" docs/product/features/unit-operations-and-npc-behavior.md
# AC5
# baseline-expect: fail
$ rg -n "playtest measurement|観測方法|before.*after.*local threat|command use count|no-op count" docs/product/features/unit-operations-and-npc-behavior.md
# AC6
# baseline-expect: fail
$ rg -n "Roadmap Boundary|does not create or mutate GitHub Milestone|conceptual roadmap" docs/product/features/unit-operations-and-npc-behavior.md
# AC7
# baseline-expect: pass
$ gh issue list --search "Z指示 OR HUD OR unit-operations" --state open --repo squne121/loop-protocol
# AC8
# baseline-expect: fail
$ rg -n "This issue does not create or mutate GitHub Milestone|M2.*conceptual roadmap" docs/product/features/unit-operations-and-npc-behavior.md
# AC9
# baseline-expect: fail
$ rg -n "RTS Boundary|lightweight macro intent|no multi-select|at most one player command intent" docs/product/features/unit-operations-and-npc-behavior.md
# AC10
# baseline-expect: fail
$ rg -n "Current Runtime Compatibility Matrix|GameState|EnemyState|EnemyAISystem|runSortieSimulationStep" docs/product/features/unit-operations-and-npc-behavior.md
# AC11
# baseline-expect: fail
$ rg -n "NPC tick schedule|sample input commands|CommandIntent buffer|snapshot boundary|increment tick" docs/product/features/unit-operations-and-npc-behavior.md
# AC12
# baseline-expect: fail
$ rg -n "CommandIntent|assist_player|TTL|no-op|semi-autonomous|binding-agnostic|Z-equivalent" docs/product/features/unit-operations-and-npc-behavior.md
# AC13
# baseline-expect: fail
$ rg -n "UI Surface Contract|Canvas.*non-authoritative.*visual cue|DOM HUD.*authoritative.*focusable" docs/product/features/unit-operations-and-npc-behavior.md
# AC14
# baseline-expect: fail
$ rg -n "#727.*not.*resume|rewrite|replace|Canvas visual cues|DOM HUD" docs/product/features/unit-operations-and-npc-behavior.md
# AC15
# baseline-expect: fail
$ rg -n "cannot explain|allied AI randomness|no-op count|target switch count" docs/product/features/unit-operations-and-npc-behavior.md
# AC16
# baseline-expect: fail
$ rg -n "commit SHA|GitHub Actions run ID|page_url|artifact|retention-days|viewport|DPR|browser zoom|userAgent|timezone" docs/product/features/unit-operations-and-npc-behavior.md
# AC17
# baseline-expect: fail
$ rg -n "state/types|command intent input|targeting policy|ally NPC MVP|enemy policy migration|HUD/Canvas|playtest/evidence" docs/product/features/unit-operations-and-npc-behavior.md

Allowed Paths

  • docs/product/features/unit-operations-and-npc-behavior.md(新規作成)

Stop Conditions

  • Outcome / Scope / AC が検索可能な形で記載されていない場合は即停止
  • Allowed Paths 外への書き込みを試みた場合は即停止
  • 権限不足(permission denied)により操作が完了できない場合は即停止
  • 成果物の書き込みに失敗した場合(I/O エラー等)は即停止

Handoff Contract

Runtime Verification Applicability

rva:
  applicability: deferred
  decision: deferred
  reason: "research-only issue; primary artifact (docs/product/features/unit-operations-and-npc-behavior.md) does not exist yet at Issue creation time. All VC that reference this file are expected-baseline-fail until the research task produces the artifact."
  deferred_until: "artifact accepted and merged"
  deferred_destination: "implementation issue that creates docs/product/features/unit-operations-and-npc-behavior.md"
  deferred_verification_condition: "docs/product/features/unit-operations-and-npc-behavior.md exists and all VC pass at PR review time"

Sub-issues

Sub-issues

7 of 7 Issues completed
Loading 7 sub-issues

Activity

  1. added
    phase/research
    agent/research
    on Jun 17, 2026
  2. squne121 commented on Jun 17, 2026

    @squne121
    OwnerAuthor

    判定

    REQUEST_CHANGES / BLOCKED。
    #975 は必要な research issue ですが、現状のまま unit-operations-and-npc-behavior.md を product SSOT として受け入れると、後続 agent が RTS/Z指示、HUD、ブリーフィング、NPC AI、配布証跡を過剰に実装し始める危険が高いです。特に、milestone #2 の意味、現行 runtime との差分、assist_player の契約、Canvas/DOM 責務、配布・証跡条件がまだ弱いです。

    #975 自体は comments が空なので、Issue 本文と、関連する #727 / #785 / #800 / PR #803 / #788 / M2 runtime 実装を照合してレビューしています。#975 の outcome は docs/product/features/unit-operations-and-npc-behavior.md を primary artifact として、unit taxonomy、Faction / UnitRole / CommandIntent / NpcBehaviorState / TargetingPolicy、fixed tick update order、UI/debug boundary、playtest measurement を定義するものです。 コメントが空であるため、#975 については Issue 本文外の議論は存在しません。


    良い点

    #975 の問題設定は妥当です。#727 は「戦闘中に何を Canvas / DOM に出すか」が未確定のため Deferred になっており、再開条件として、表示情報候補の列挙、always / conditional / debug-only / hidden 分類、Canvas と DOM HUD の責務境界、viewport / DPR 方針の仕様化が要求されています。 したがって、Z指示・味方NPC・敵NPC・HUD を実装する前に、NPC 行動契約を research-only で正本化する方向自体は正しいです。

    また、現行 requirements は Canvas/DOM 分離と src/systems から DOM/Canvas API を触らない原則を置いており、固定タイムステップ 60Hz も active requirement です。 #975 が deterministic update order と UI/debug boundary を scope に入れているのは、この architecture invariant と整合します。


    Blocker 1: milestone #2 が危険に曖昧

    #975 は open questions に milestone #2 / roadmap sync を含めていますが、roadmap は「conceptual roadmap; not GitHub Milestone object creation」と明記し、GitHub Milestone object の作成・更新は別 Issue としています。 一方、現行 focus は M3 Result Persistence であり、M3 の Do Not Do には M4 相当の強化導線や大型機能の持ち込み禁止が明記されています。

    修正要求: #975 は milestone #2 という語をそのまま使わず、次のどちらかに固定してください。

    Roadmap boundary:
    - This issue does not create or mutate GitHub Milestone objects.
    - "M2" refers only to the conceptual roadmap section in docs/product/playable-roadmap.md.
    - Runtime implementation belongs to follow-up issues after this SSOT is accepted.

    または、GitHub Milestone object を本当に扱うなら change_kind: github-metadata の別 Issue に分離すべきです。#975 の research-only contract に混ぜるべきではありません。


    Blocker 2: Z指示が「軽量マクロ」なのか「RTS指揮」なのか未固定

    Game Thesis は、プレイヤーを「大規模軍勢のマクロ運用」ではなく、局所介入するエース機として定義し、Zキー相当 は軽量なマクロ指示に留めるとしています。 HYP-001 でも、軽量マクロ指示は「拠点防衛 / 突出 / 退避 等」で味方挙動を誘導する程度であり、プレイヤー介入が局所戦況を変えたと感じられることが主目的です。

    #975 は RTS/Z指示モード と書いていますが、この表現は後続 agent に「複数ユニット選択」「命令キュー」「編隊」「個別ターゲット指定」「RTS UI」を想起させます。これは Game Thesis の軽量マクロ指示と衝突します。

    修正要求: #975 本文に以下の制約を追加してください。

    RTS Boundary:
    - "Z指示" is a lightweight macro intent, not a full RTS command system.
    - No multi-select, command queue, squad formation, pathfinding, navmesh, base building, or territory control.
    - MVP supports at most one player command intent: assist_player.
    - The default key binding may be Z-equivalent, but product SSOT defines CommandIntent, not a physical key.

    これを入れないと、CommandIntent の正本化が入力バインディングや RTS 機能拡張に漏れます。


    Blocker 3: 現行 runtime との差分が大きすぎるのに migration 契約がない

    現行 GameState の EnemyState は id / definitionId / hp / position / radius / speed / contactDamage / defeated 程度で、Faction、UnitRole、NpcBehaviorState、TargetingPolicy、ally state は存在しません。 GameState にも player、projectiles、enemies はありますが、ally collection や command intent buffer はありません。 現行 EnemyAISystem は「非撃破 enemy を player center へ直線接近させる」だけの chaser AI です。 runEnemySpawnSystem も enemies が空なら 1 体 spawn するだけです。

    #975 の AC は rg -n "Faction|UnitRole|CommandIntent|NpcBehaviorState|TargetingPolicy" で grep できれば通り得ます。これは prose artifact として弱いです。現行 runtime から新 taxonomy へ移行する互換表がないと、後続 implementation が GameState を広く壊します。

    修正要求: primary artifact に必ず Current Runtime Compatibility Matrix を入れてください。

    | Current runtime concept | Current source | Proposed taxonomy | Runtime gap | Downstream issue |
    |---|---|---|---|---|
    | player | GameState.player | Faction.player / UnitRole.ace_player | command source only; not NPC | none |
    | enemy-basic | EnemyState / enemyDefinitions | Faction.enemy / UnitRole.enemy_chaser | no behavior state field yet | targeting issue |
    | allies | absent | Faction.ally / UnitRole.ally_basic | no runtime state exists | ally-state issue |
    | command intent | absent | CommandIntent.assist_player | no input buffer / TTL | command-intent issue |

    この表がないなら、#975 は「名前を増やすだけの仕様」で止まり、implementation-ready にはなりません。


    Blocker 4: deterministic update order が既存 tick schedule と接続されていない

    現行 runSortieSimulationStep は、runMovementSystem → runEnemySpawnSystem → runEnemyAISystem → runCombatSystem → runProjectileSystem → runCollisionSystem → resolveCombatCollisions → runSortieSystem → tick/elapsedMs 加算、という順序です。 Combat Core も collision pair の deterministic order を定義しており、projectile-enemy を先に、次に player-enemy、同種内は id 昇順で処理することを SSOT にしています。

    #975 は “fixed tick update order and deterministic tie-break” を求めていますが、NPC target acquisition が現行 schedule のどこへ入るのかが未定義です。特に、assist_player が入力された tick に、味方 target が player の現在 aim / target / threat を読むのか、前 tick snapshot を読むのかで結果が変わります。

    修正要求: 次を明文化してください。

    NPC tick schedule:
    1. sample input commands into CommandIntent buffer
    2. update player movement / aim / fire command
    3. spawn/despawn gate
    4. expire or apply CommandIntent TTL
    5. acquire NPC targets from a declared snapshot boundary
    6. update NPC movement / attack intent
    7. update projectile movement
    8. collision detection
    9. combat resolution
    10. sortie terminal evaluation
    11. increment tick
    12. render reads state only

    さらに、既存 runtime order と差分があるなら、current_order と target_order を併記し、実装 Issue で一括変更するか段階移行するかを決めるべきです。


    Blocker 5: assist_player の意味がまだ実装不能

    #975 の open questions に「MVP の macro command を assist_player 1 種に絞るか」があります。 しかし、#975 の acceptance では assist_player の発火条件、TTL、no-op 条件、target 選定、HUD feedback、debug 表示が固定されません。これでは command intent ではなく、単なる名前です。

    推奨する MVP 契約:

    type CommandIntent = 'none' | 'assist_player'
    assist_player semantics:
    - Source: player command surface; default key may be Z-equivalent but SSOT is binding-agnostic.
    - Duration: active for N fixed ticks or M milliseconds, then expires deterministically.
    - Effect: biases allied NPC target selection toward threats near the player or the player's current engagement vector.
    - It does not directly move units, create formations, enqueue commands, or select individual allies.
    - If no allied NPC exists, no valid target exists, or player is not in combat phase, the command is a no-op.
    - Normal UI shows a player-facing affordance/feedback, not raw `assist_player`.
    - Debug panel may show raw CommandIntent, TTL, candidate scores, selected target id.

    assist_player は “命令” ではなく “意図による target scoring bias” として扱うのが安全です。直接移動命令にすると pathfinding / formation / collision avoidance にスコープが爆発します。


    Blocker 6: UI IA を再発見しており、既存 SSOT への依存が弱い

    ui-information-architecture.md はすでに accepted で、Canvas は world / danger / lock / damage の visual cue、DOM HUD は player-facing status と command affordance、debug panel は exact state と telemetry と定義しています。 Surface taxonomy でも、Canvas combat layer は primary text-control surface と internal state name を forbidden にし、DOM HUD overlay は command affordance を担うとしています。 さらに Canvas-only interactive control を禁止し、player command / menu action / debug action には DOM control または focusable fallback が必要です。

    Web 実装面でも、MDN は <canvas> が単なる bitmap であり、描画された object の semantic information を提供しないため、アクセシブルな web/app では注意が必要だと説明しています。([MDN Web Docs]1) したがって、Z指示や target indicator を Canvas だけに描く設計は不可です。

    修正要求: #975 の UI section に、最低限これを入れてください。

    UI Surface Contract:
    - Canvas may show non-authoritative visual cues: target line, ally intent icon, danger/warning shape.
    - DOM HUD must provide the authoritative, focusable player command affordance for assist_player.
    - Canvas text or icon must not be the only representation of command state.
    - Debug panel may expose raw CommandIntent / NpcBehaviorState / target score.
    - Normal UI must not expose raw enum labels.

    Blocker 7: #727 を “再開” させる書き方は危険

    #727 はもともと「HULL/HP を Canvas に集約表示する」方向でしたが、後続の UI IA はこの方向を supersede し、#727 はそのまま resume せず Canvas visual cues + DOM HUD player status integration へ rewrite または replace すべきとしています。 #727 の人間コメントも、表示情報・配置を検討しない段階的 UI 修正は手戻りが多いとして保留を求めています。

    #975 は「Z指示 mode」「戦闘中 HUD」「ブリーフィング」を分解可能にする outcome ですが、#727 との接続を “resume” と読める形にしてはいけません。

    修正要求: Handoff に以下を入れてください。

    #727 handling:
    - #727 must not be resumed as-is.
    - This issue may unblock a replacement/rewrite issue only.
    - Replacement direction: Canvas visual cues + DOM HUD player status / command affordance integration.
    - No Canvas aggregated player HP/HULL implementation is authorized by this issue.

    Blocker 8: Playtest measurement が Game Thesis の falsification とつながっていない

    Game Thesis の HYP-001 は、プレイヤーが「自分の介入で局所戦況が変わった」と感じることを検証対象にしており、勝因が味方 AI 任せに見える場合や、介入導線が複雑で何をしているかわからない場合を falsification signal としています。 また、軽量マクロ指示がどの程度のガイダンスで直感的に使えるかは未解決の問いです。

    #975 の “playtest measurement” は、これを直接測るべきです。単に「Z command を使ったか」「ally が動いたか」では不足です。

    修正要求: measurement section に以下を追加してください。

    Playtest falsification signals:
    - Player cannot explain what assist_player did.
    - Player attributes victory primarily to allied AI randomness rather than own intervention.
    - Command use does not correlate with local threat removal or ally survival.
    - Command feedback is noticed only as debug text, not as world/visual cue.
    - Player asks for full RTS controls, indicating lightweight macro intent is underspecified.
    
    Required evidence:
    - self-explanation prompt after sortie
    - command use count
    - no-op count
    - target switch count caused by command intent
    - before/after local threat count
    - ally survival or protected-zone stability
    - screenshot/video with viewport, DPR, zoom, paused/running state

    Blocker 9: 配布・証跡ポリシーが #975 に入っていない

    UI IA は、UI review / playtest evidence を一時的 PR preview URL だけに依存させず、stable artifact URL または stable GitHub Pages URL、full commit SHA、Actions run ID、artifact names / digests / retention-days、viewport、DPR、browser zoom、userAgent、timezone、build metadata、paused/running state、screenshot/video reference を残す方針を要求しています。

    GitHub Actions artifacts は workflow 完了後に build/test output を保存・共有する仕組みで、retention-days を設定できますが、repository / organization / enterprise の上限は超えられません。([GitHub Docs]2) GitHub Pages の deploy-pages は、事前に upload された Pages artifact を deploy し、page_url を output として返します。ただし PR preview は alpha で public 利用不可とされています。([GitHub]3) upload-pages-artifact も retention-days を持ち、Pages 向け artifact の生成を支援します。([GitHub]4)

    修正要求: #975 の artifact/evidence section に以下を入れてください。

    Evidence / Distribution Policy:
    - Do not use PR preview URL as the only evidence.
    - Required for UI / playtest follow-up PRs:
      - full commit SHA
      - GitHub Actions run ID
      - deployed page_url or stable artifact URL
      - artifact names
      - artifact digests or attestations when available
      - retention-days
      - live asset check result for JS/CSS/images
      - viewport / DPR / browser zoom / userAgent / timezone
      - paused/running state
      - screenshot or video path

    Artifact provenance まで要求するなら、GitHub の artifact attestations は「build がどこでどのように作られたか」の provenance を確立する機能として使えます。([GitHub Docs]5)


    Blocker 10: viewport / DPR / zoom の pass/fail が weak

    UI IA は implementation PR の verification cases として、viewport 1920x1080 / 1366x768 / 1280x720、browser zoom 100% / 125% / 150% / 200%、DPR 1 / 1.25 / 2 を要求しています。 また、DPR 固定前提を避け、page zoom / browser zoom / OS scaling を含む実測 viewport / DPR で evidence を残す方針です。 MDN でも window.devicePixelRatio は physical pixel と CSS pixel の比率で、page zoom により変化し、pinch zoom では変化しないと説明されています。([MDN Web Docs]6)

    W3C WCAG 2.2 の Resize Text は、caption と images of text を除く text を assistive technology なしで 200% まで resize しても content/functionality を失わないことを求めます。([W3C]7) Microsoft の Xbox Accessibility Guideline 101 は、PC/VR で 1080p の text が 18px 以上、4K で 36px 以上、text scaling は 200% まで content/functionality/meaning を失わないことを求めています。([Microsoft Learn]8)

    修正要求: #975 で「後続 UI/visual cue 実装 issue は UI IA の viewport/readability cases を継承する」と明記してください。Z指示の HUD/indicator は readable/focusable/observable でなければ、UI 実装で再び #782 と同じ失敗になります。


    Major: enum 定義はこの形まで落とすべき

    #975 の primary artifact には、最低限この粒度の型契約を置くべきです。

    type Faction =
      | 'player'
      | 'ally'
      | 'enemy'
      | 'neutral'
    
    type UnitRole =
      | 'ace_player'
      | 'ally_basic'
      | 'enemy_chaser'
      | 'objective'
      | 'neutral_obstacle'
    
    type CommandIntent =
      | 'none'
      | 'assist_player'
    
    type NpcBehaviorState =
      | 'inactive'
      | 'acquire_target'
      | 'move_to_engage'
      | 'attack'
      | 'retreat'
      | 'destroyed'
    
    type TargetingPolicy =
      | 'focus_player'
      | 'assist_player_threat'
      | 'nearest_hostile'
      | 'ignore'

    ただし、これは runtime 実装を許可するものではなく、#975 では product SSOT と migration plan までに留めるべきです。現行 Combat Core の EnemyState と collision/damage system はすでに accepted spec を持っているため、既存契約を上書きするのではなく、後続 implementation issue で EnemyState 拡張や AllyState 追加を行う設計にする必要があります。


    Major: targeting policy は score と tie-break を固定しないと再現不能

    推奨する MVP target scoring は以下です。

    Target candidate filter:
    - exclude defeated / destroyed units
    - exclude same faction unless explicitly protected objective
    - exclude entities outside active arena
    - exclude stale target ids before scoring
    
    assist_player target score tuple:
    1. commandIntentMatch DESC
    2. threatToPlayer DESC
    3. distanceToPlayer ASC
    4. distanceToAlly ASC
    5. targetEntityId ASC
    
    enemy_chaser target score tuple:
    1. isPlayer DESC
    2. distanceToPlayer ASC
    3. targetEntityId ASC

    同一 tick で同点が出た場合は、最終 tie-break を必ず monotonic entity id にしてください。現行 collision system は deterministic comparator を持っており、この方針と揃えるべきです。


    Major: normal UI に raw enum を出すな

    UI IA は LoopPhase、Telemetry、Claim reward、STATUS HULL、raw internal state name、exact/fractional HP、<1 を通常 UI に出すことを forbidden にしています。 #788 も、normal play の player Hull と enemy HP label の両方で <1 / 小数を禁止し、0 < value < 1 は Math.ceil で "1" にする方針を決定しています。

    したがって、NpcBehaviorState: acquire_target や CommandIntent: assist_player を HUD にそのまま出すのは regression です。通常 UI では Assist、Covering you、No ally available などの player-facing な語彙に変換し、raw enum は debug panel 限定にしてください。


    Major: Follow-up issue の分解が粗い

    #975 の Next Action は「Z 指示 mode / HUD / ブリーフィングを分解する implementation Issue 群を起票」となっています。 ただし、この粒度ではまた肥大化します。分解は以下が安全です。

    1. docs-only: unit-operations-and-npc-behavior.md accepted SSOT 作成。
    2. state/types: Faction / UnitRole / CommandIntent の型追加。ただし ally runtime はまだ追加しない。
    3. command intent input: binding-agnostic command intent buffer + default Z-equivalent mapping。DOM/focusable fallback 必須。
    4. targeting policy: deterministic target scoring pure function + unit tests。
    5. ally NPC MVP: 1 種の ally_basic state と semi-autonomous behavior。
    6. enemy policy migration: existing enemy_chaser を new taxonomy に対応。ただし挙動は変えない。
    7. HUD/Canvas integration: DOM command affordance + Canvas visual cue。[Deferred] 実装: 戦闘中ステータス(HULL/HP)を戦闘描画画面(Canvas)に集約表示する #727 は rewrite/replacement として扱う。
    8. playtest/evidence: self-explanation test + artifact / Pages evidence policy。

    修正後の Acceptance Criteria 案

    現行 AC は grep で通りすぎます。以下へ強化してください。

    - [ ] AC1: `docs/product/features/unit-operations-and-npc-behavior.md` が YAML frontmatter 付きで作成され、`feature_id`, `status`, `related_issue`, `acceptance`, `non_goals`, `related_tests` を含む。
    - [ ] AC2: Authority section があり、requirements / game-thesis / game-design / ui-information-architecture / combat-core / roadmap / current-focus の優先順位を明記する。
    - [ ] AC3: Current Runtime Compatibility Matrix があり、現行 `GameState`, `EnemyState`, `EnemyAISystem`, `runSortieSimulationStep` との差分を示す。
    - [ ] AC4: `Faction`, `UnitRole`, `CommandIntent`, `NpcBehaviorState`, `TargetingPolicy` の定義に、allowed values, non-goals, examples, anti-examples がある。
    - [ ] AC5: MVP commandability は `semi_autonomous ally NPC + CommandIntent.assist_player only` または明示的な別案として確定されている。
    - [ ] AC6: `assist_player` の TTL, no-op, target scoring bias, debug-only fields, normal UI wording が定義されている。
    - [ ] AC7: NPC target acquisition の candidate filter, scoring tuple, tie-break, stale/dead target handling が deterministic に定義されている。
    - [ ] AC8: tick schedule が現行 runtime order と target order の差分付きで定義されている。
    - [ ] AC9: Canvas visual cue / DOM focusable command / debug raw state の surface boundary が UI IA と整合している。
    - [ ] AC10: #727 は resume as-is ではなく rewrite/replace と明記されている。
    - [ ] AC11: Playtest measurement が Game Thesis HYP-001 の falsification signal に接続されている。
    - [ ] AC12: Evidence / distribution policy が stable artifact or page_url, commit SHA, run ID, artifact metadata, retention-days, viewport/DPR/zoom/userAgent/timezone を要求している。
    - [ ] AC13: 後続 implementation issue drafts が artifact 内に含まれ、runtime mutation は本 Issue の out of scope として維持されている。

    Verification Commands 強化案

    # artifact existence / frontmatter
    test -f docs/product/features/unit-operations-and-npc-behavior.md
    rg -n "feature_id|status|related_issue|acceptance|non_goals|related_tests" docs/product/features/unit-operations-and-npc-behavior.md
    
    # authority / SSOT hierarchy
    rg -n "Authority|requirements.md|game-thesis.md|game-design.md|ui-information-architecture.md|combat-core.md|playable-roadmap.md|current-focus" docs/product/features/unit-operations-and-npc-behavior.md
    
    # runtime compatibility
    rg -n "Current Runtime Compatibility Matrix|GameState|EnemyState|EnemyAISystem|runSortieSimulationStep|no runtime ally state" docs/product/features/unit-operations-and-npc-behavior.md
    
    # command contract
    rg -n "CommandIntent|assist_player|TTL|no-op|semi-autonomous|binding-agnostic|Z-equivalent" docs/product/features/unit-operations-and-npc-behavior.md
    
    # targeting determinism
    rg -n "candidate filter|target score|tie-break|entityId ASC|distance.*ASC|stale target|defeated" docs/product/features/unit-operations-and-npc-behavior.md
    
    # UI/accessibility boundary
    rg -n "Canvas.*visual cue|DOM.*focusable|debug.*raw|Canvas-only|CommandIntent.*debug|NpcBehaviorState.*debug" docs/product/features/unit-operations-and-npc-behavior.md
    
    # #727 routing
    rg -n "#727.*not.*resume|rewrite|replace|Canvas visual cues|DOM HUD" docs/product/features/unit-operations-and-npc-behavior.md
    
    # evidence / distribution
    rg -n "commit SHA|GitHub Actions run ID|page_url|artifact|digest|retention-days|viewport|DPR|browser zoom|userAgent|timezone|paused|running" docs/product/features/unit-operations-and-npc-behavior.md

    最終推奨

    #975 は 閉じずに修正が妥当です。Issue の目的は正しいですが、現状のままでは「NPC 行動契約の SSOT」ではなく「RTSっぽい用語一覧」になり、後続実装が広がります。

    採用すべき方針は次です。

    MVP direction:
    - allies are semi-autonomous, not directly commanded units
    - exactly one MVP macro intent: assist_player
    - Z-equivalent is an input mapping, not the product contract
    - assist_player biases targeting; it does not issue path/formation/order queues
    - Canvas shows non-authoritative visual cues
    - DOM provides the authoritative focusable command affordance
    - debug panel owns raw CommandIntent / NpcBehaviorState / target scores
    - #727 is rewrite/replace only, not resume as-is
    - all UI/playtest follow-ups must carry stable artifact/evidence metadata

    この修正を入れれば、#975 は後続 implementation issue を安全に生やせる research contract になります。現状のままなら、AI 実装者が RTS、HUD、Canvas command UI、ally state、targeting、artifact evidence を同時に広げるため、No-Go です。

  3. squne121 commented on Jun 17, 2026

    @squne121
    OwnerAuthor

    Refinement Loop: Approved

    The issue has been approved and is ready for implementation.

  4. added a commit that references this issue on Jun 17, 2026
  5. squne121 commented on Jun 18, 2026

    @squne121
    OwnerAuthor

    後続実装 issue の起票・link 一覧(follow-up / AC7 充足)

    PR #978 で SSOT docs/product/features/unit-operations-and-npc-behavior.md が merge され、本 Issue は close 済みです。artifact §14 の 8-stage decomposition(stage1=docs-only は本 SSOT で完了)に基づき、後続 implementation issue(stage2〜8)を起票・link しました。各 issue の詳細契約は artifact の該当セクション(§番号)を SSOT とします。

    stage issue 内容 blocked by
    2 #981 unit taxonomy 型 Faction / UnitRole / CommandIntent を src/state に追加(§5,§6) —
    3 #982 binding-agnostic command intent buffer + Z-equivalent mapping(§7,§9,§10.1) #981
    4 #983 deterministic target scoring pure function(§8,§8.5) #981,#982
    5 #984 ally_basic NPC state(1種) と semi-autonomous behavior(§4,§5,§7) #981,#983
    6 #985 enemy_chaser を new taxonomy へ非破壊移行(§6,§14.1 compatibility gate) #981,#983
    7 #986 assist_player の DOM affordance + Canvas visual cue(§10,§11、#727 rewrite/replace) #982,#984
    8 #987 playtest self-explanation test + evidence policy(§12,§12.3,§13) #986

    各 issue は triage-required であり、実装着手前に issue-contract-review を通します。#727 は #986 で rewrite/replace として扱い、resume as-is しません。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    agent/researchphase/research

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions