
_信頼性の高いゲーム AI 統合では、JEV が任意のコマンドを発明すべきではありません。ゲームは最初に Legal Actions を生成します: Choice は、現在のルール、認識、リソース、および権限の制約の下で可能です。 JEV はそれらの候補を選択するか、Score することができます。実行者はワールドを変更する前にそれらを再チェックします。法的措置とは何ですか?法的措置は、現在のエージェントが試みることが許可されている意味のあるコマンドです。これには、安定した名前、明示的なパラメータ、前提条件、および実行所有者があります。例としては、_攻撃(targetId)_、_takeCover(coverId)_、 _heal(allyId)_、およびretreat(routeId)_.なぜ自由形式のアクションではないのですか?自由形式の生成により、検証、テスト、バランス調整が難しくなります。モデルは、存在しないターゲット、到達不能なルート、または実装されていない動詞を返す場合があります。閉じられたアクション セットは発明を選択に変えます。設計者は候補を検査し、QA がそれらをリプレイし、実行者は契約外のものを拒否します。ゲーム コード内で候補を生成_
if (canSeeTarget && ammo > 0) add({ name: 'attack', targetId }); if (safeCover) add({ name: 'takeCover', coverId }); if (allyNeedsHelp) add({ name: 'assist', allyId }); if (empty) add({ name: 'holdPosition' });
_ビルダーは、権限のある状態とエージェントの認識を使用します。候補リストはまだスナップショットであり、最終検証の代わりにはなりません。Choice、Score、およびゲート候補を 1 つ選択する必要がある場合は Choice を使用し、ターゲットまたはルートのランク付けが必要な場合は Score を使用し、目標を放棄するかどうかなどのゲートとして有界のイエスかノーの判断を使用します。広いスペースの場合は、まず候補を絞り込み、次に選択します。実行前に再検証応答が到着したら、現在のアクション セットを再構築または再確認します。名前、パラメータ、状態バージョン、ターゲットの存在、リソース、および権限を確認します。候補者が消えた場合は、応答を破棄し、フォールバック を使用します。古い決定を新しい世界状態に強制的に適用しないでください。_const current = buildLegalActions(world, npc); const selected = current.find(action => sameAction(action, decision)); if (!selected) return フォールバック(); return execute(selected);_アクション スペースはどれくらいの大きさがよいですか?実際のトレードオフを表すいくつかのオプションから始めます。すべての移動オプションを公開すると、意思決定層はナビゲーションと戦術を一緒に解決する必要があります。 NPC 分隊の場合、防御、援護、攻撃、撤退だけで十分です。ナビゲーションと機能は低レベルの詳細を処理します。古いアクションとターゲットが死亡し、クールダウンが開始され、ルートがブロックされ、認識が変化します。リアルタイム ゲームでは、古さを通常どおり扱います。結果を破棄し、状態を再構築し、決定論的なポリシーを継続します。 API の実装については、JEV API の使用方法 を参照してください。 NPC アーキテクチャについては、JEV . を参照してください。便利なアクション スキーマ各アクションを、ID、意図、パラメータ、前提条件、推定期間、リソース コスト、および実行者を含むデータとして表します。 ID は現在のスナップショットに対して安定している必要がありますが、ターゲットと場所の参照は明示的である必要があります。これにより、設計者と QA は動作について議論するための共通の語彙を得ることができます。_{ id: 'cover-wall-a', intent: 'takeCover', target: { coverId: 'wall-a' }, cost: { timeMs: 900 }, preconditions: ['reachable', 'notOccupied'] }_ランク付けする前に整理するハード制約はモデル評価の前に属します。範囲、クールダウン、所有権、可視性、ナビゲーション、またはマルチプレイヤー ルールに違反するアクションを削除します。その場合にのみ、JEV は安全性、客観的な圧力、資源の節約、チームの調整などのよりソフトなトレードオフを比較する必要があります。これによりノイズが軽減され、結果の説明が容易になります。アクションスペースが広い場合_2 段階の設計を使用します。最初に Score または候補を狭い領域にフィルターしてから、1 つのアクションを選択します。たとえば、ゲーム コードは 20 の可視カバー ポイントを生成でき、JEV はその戦術的価値を Score でき、決定論的ポリシーは最終的な Choice の前にベスト 3 を保持できます。ナビゲーションは引き続きパスの有効性を所有します。アクション空間のデザインはゲームバランスアクションを追加すると、NPC の戦略空間が変更されます。退却を追加すると、警備員がより長く生き残れる可能性があります。アシストを追加するとチームの結束力は向上しますが、目標は遅れる可能性があります。アクションの語彙をバージョン化し、代表的な遭遇を再現し、デザイナーにアクションが合法かどうかだけでなく、意図したトレードオフが生じるかどうかをレビューするよう依頼します。契約テストすべての候補者にはハンドラーがあります。すべてのハンドラーは現在の前提条件をチェックします不明なアクション ID はフェールクローズされます。パラメータ タイプとターゲットの所有権は次のとおりです。 _古い候補はリプレイおよびライブテストで拒否されます。フォールバックは、候補リストが有効な場合でも有効なままです。空です。_heal(allyId), and retreat(routeId).
Why not free-form actions?
Free-form generation makes validation, testing, and balancing harder. A model may return a target that no longer exists, an unreachable route, or an unimplemented verb. A closed action set turns invention into selection: designers inspect candidates, QA replays them, and the executor rejects anything outside the contract.
Generate candidates in game code
if (canSeeTarget && ammo > 0) add({ name: 'attack', targetId }); if (safeCover) add({ name: 'takeCover', coverId }); if (allyNeedsHelp) add({ name: 'assist', allyId }); if (empty) add({ name: 'holdPosition' });The builder uses authoritative state and the agent's perception. The candidate list is still a snapshot and is not a substitute for final validation.
Choice, Score, and gates
Use Choice when one candidate should be selected, Score when targets or routes need ranking, and a bounded yes-or-no judgment as a gate such as whether to abandon an objective. For large spaces, narrow candidates first and choose second.
Revalidate before execution
When the response arrives, rebuild or recheck the current action set. Verify name, parameters, state version, target existence, resources, and authority. If a candidate disappeared, discard the response and use a フォールバック. Never force an old decision into a new world state.
const current = buildLegalActions(world, npc); const selected = current.find(action => sameAction(action, decision)); if (!selected) return fallback(); return execute(selected);How large should the action space be?
Start with a few options that represent real trade-offs. Exposing every movement option forces the decision layer to solve navigation and tactics together. For a squad NPC, defend, take cover, assist, attack, and retreat can be enough; navigation and abilities handle low-level details.
Stale actions and フォールバック
Targets die, cooldowns start, routes block, and perception changes. Treat staleness as normal in a real-time game. Discard the result, rebuild state, and continue with a deterministic policy. For API implementation, read JEV API usage. For NPC architecture, see JEV NPC.
A useful action schema
Represent each action as data with an ID, intent, parameters, preconditions, estimated duration, resource cost, and executor. The ID should be stable for the current snapshot, while target and location references should be explicit. This gives designers and QA a shared vocabulary for discussing behavior.
{ id: 'cover-wall-a', intent: 'takeCover', target: { coverId: 'wall-a' }, cost: { timeMs: 900 }, preconditions: ['reachable', 'notOccupied'] }Prune before you rank
Hard constraints belong before model evaluation. Remove actions that violate range, cooldown, ownership, visibility, navigation, or multiplayer rules. Only then should JEV compare softer trade-offs such as safety, objective pressure, resource conservation, and team coordination. This reduces noise and makes the result easier to explain.
When the action space is large
Use a two-stage design: first score or filter candidates into a small frontier, then choose one action. For example, game code can generate twenty visible cover points, JEV can score their tactical value, and a deterministic policy can keep the best three before a final Choice. Navigation still owns path validity.
Action-space design is game balance
Adding an action changes the NPC's strategy space. Adding retreat may make a guard survive longer; adding assist may improve squad cohesion but delay the objective. Version the action vocabulary, replay representative encounters, and ask designers to review not only whether an action is legal but also whether it creates the intended trade-off.
Contract tests
- Every candidate has a handler.
- Every handler checks current preconditions again.
- Unknown action IDs fail closed.
- Parameter types and target ownership are validated.
- Stale candidates are rejected in replay and live tests.
- The フォールバック remains legal when the candidate list is empty.


