# V2 Bot Harness

`V2BotHarness` covers `TODOS.phase-72.72.19.1.1`: a headless game client
controlled by script/ML model policy bindings that can execute any player action
in automation. It lives in the `V2Tests` developer-tool module so bot runs can
drive QA, Gauntlet, soak, coverage, economy, and performance scenarios without
adding shipping gameplay dependencies.

## Runtime Surface

- `EV2BotHarnessActionKind` defines the player action surface: movement, look,
  jump, crouch, sprint, interact, primary attack, secondary attack, ability, use
  item, open menu, pause, wait, and custom command.
- `FV2BotHarnessAction` is one frame-addressed player command with axis values,
  target id, payload JSON, duration, and headless eligibility flags.
- `FV2BotHarnessPolicyBinding` connects a deterministic script, ML model, or
  script-or-ML-model controller to observation and action schemas. The default
  binding sets `bCanEmitAnyPlayerAction` and supports every action kind.
- `FV2BotHarnessClientConfig` describes the headless game client, NullRHI mode,
  dedicated-server connection, frame budget, per-frame action budget,
  observation capture, and action transcript capture.
- `FV2BotHarnessConfig` combines the policy, client, and scripted player action
  sequence into an automation-run harness.
- `FV2BotHarnessResult` reports accepted and executed actions, rejected actions,
  deterministic final observation hash, transcript capture, script control, ML
  model control, and headless client boot state.

## Control Model

The harness accepts both authored scripts and ML policy output. Scripts use the
same action schema as the model path, so later exploration, navigation, combat,
quest, economy, and profiling bots can swap their controller while preserving
the same headless execution contract.

The required capabilities are script/ML model control, can execute any player
action, deterministic observation hash, action transcript capture, and
unsupported action rejection.

The harness can execute any player action through either controller.

`RunBotHarnessScript` validates the policy and client, verifies that scripted
actions fit the configured frame count and per-frame budget, rejects unsupported
or malformed player actions, executes accepted actions, records a transcript,
and emits a deterministic observation hash. A default config covers every player
action kind so CI can prove the harness is not limited to movement-only smoke
tests.

## Validation Commands

```bash
python3 V2/ue/Tools/check-v2-bot-harness.py
python3 V2/ue/Tools/check-v2-tests-module.py
python3 V2/ue/Tools/check-v2-ci-workflow.py
python3 -m json.tool V2/ue/Content/V2/QA/BotHarness_V2_Contract.json
python3 -m json.tool V2/ue/Build/Horde/v2-buildgraph-job.json
python3 V2/tools/validate-v2-docs.py
```
