causal-gpt-rl-unity-envs / docs /additional-simulations.md
kissin42's picture
Add model-removed Hallway, GridWorld, Sorter and WallJump simulations
546d427 verified
|
Raw History Blame Contribute Delete
5.43 kB
# Run the additional model-removed simulations
Released 2026-10-22: PushBlockCollab, FoodCollector, StrikersVsGoalie,
Hallway, GridWorld, Sorter, WallJump.
The players contain no baked-in policy. Download their stock ONNX separately or
send your own actions through ML-Agents.
Use a dedicated Python 3.10 environment:
```bash
pip install -r unity-envs/tools/requirements-simulation.txt
```
Download one Windows environment, external policy, and runner:
```python
from huggingface_hub import snapshot_download
snapshot_download(
repo_id="ccnets/causal-gpt-rl-unity-envs", repo_type="dataset",
allow_patterns=["PushBlockCollab/**", "PushBlockCollab.onnx", "tools/**"],
local_dir="unity-envs",
)
```
```bash
python unity-envs/tools/probe_simulation.py --build unity-envs/PushBlockCollab/PushBlockCollab.exe --policies unity-envs --report probe.json --ticks 1000
```
Add `--graphics --time-scale 1` to view the scene in real time. Use `--random`
to supply random actions without loading any ONNX. Set distinct `--worker-id`
values when launching multiple players concurrently. Close the run with Ctrl+C.
For FoodCollector, fetch `FoodCollector/**` and `GridFoodCollector.onnx` instead.
For StrikersVsGoalie, fetch `StrikersVsGoalie/**`, `Striker.onnx`, and `Goalie.onnx`;
both role policies are required. The runner reads policy names from each player's
`simulation-build.json` and routes them to the corresponding behavior.
Linux players are under `linux/<Environment>/`. Download that prefix instead of
the Windows prefix, use the same root ONNX files, run
`chmod +x unity-envs/linux/<Environment>/<Environment>.x86_64`, and pass the
`.x86_64` path to `--build`. A graphical run needs an available display. These
Linux players were startup-tested under Ubuntu/WSL; stock-policy rollouts were
verified on Windows only.
The runner preserves the native grid tensor and separate vector sensors, applies
action masks, and handles continuous, discrete, and hybrid action spaces. It is
a smoke-test/viewer tool and does not record Minari trajectories or instruction
labels. The JSON reports contain raw reward sums, not calibrated skill scores;
group-reward sums count rewards on each agent row, not unique team outcomes.
`tools/AdditionalSimulationBuild.cs` is the build helper. It opens copies of the
three release-23 scenes in an isolated Unity project, unpacks prefabs, removes
model references, sets external-control behavior, and rejects a build if its
packed asset report includes ONNX/NN. Run with Unity 6000.0.40f1:
```text
-batchmode -force-d3d11 -projectPath <isolated-release23-project> -executeMethod AdditionalSimulationBuild.Build -simulationOutput <output>
```
Place the helper in `Assets/Editor/` first. For Linux add
`-buildTarget Linux64 -simulationTarget StandaloneLinux64`. The local customized
source project used here is not redistributed; this helper alone is not a full
source project archive.
## Remaining four scenes
Download `<Environment>/**`, its policy file(s), and `tools/**` as above:
| Environment | External files | Runtime requirement |
|---|---|---|
| Hallway | `Hallway.onnx` | Per-agent recurrent memory, reset on episode endings |
| GridWorld | `GridWorld.onnx` | Camera rendering and action masks |
| Sorter | `Sorter.onnx` | Preserve padded variable-size buffer |
| WallJump | `SmallWallJump.onnx`, `BigWallJump.onnx` | Route dynamic behavior names to both policies |
```bash
python unity-envs/tools/probe_simulation.py --build unity-envs/Hallway/Hallway.exe --policies unity-envs --report hallway-probe.json --ticks 1000
python unity-envs/tools/probe_simulation.py --build unity-envs/GridWorld/GridWorld.exe --policies unity-envs --report grid-probe.json --ticks 1000 --render
python unity-envs/tools/probe_simulation.py --build unity-envs/Sorter/Sorter.exe --policies unity-envs --report sorter-probe.json --ticks 1000
python unity-envs/tools/probe_simulation.py --build unity-envs/WallJump/WallJump.exe --policies unity-envs --report wall-probe.json --ticks 1000
```
Hallway's state is keyed by agent ID, not batch row. Memory is advanced only
when an agent requests a decision and cleared on terminal or interrupted steps.
The runner registers StatsSideChannel for scene statistics. GridWorld uses a
rendering device even in `--render` batchmode; a Linux server must provide a
working graphics backend/display for camera observations. Linux startup checks
alone do not validate camera pixels. Sorter exposes `VARIABLE_SIZE` on its buffer
dimension; do not discard this contract when designing a recorder.
Wall Jump's existing controller keeps its per-episode behavior switch, with
all model references removed. Both behavior specs were exercised in the Windows
probe; their initial allocation was 8 SmallWallJump and 16 BigWallJump agents,
and this allocation changes during play. Count physical agents, not cumulative
behavior slots, for scene population. All four Windows stock probes passed
1,000 ticks. Linux policy rollouts remain untested; native startup checks passed.
The build helper now supports all seven scenes. Add
`-simulationEnvironments Hallway,GridWorld,Sorter,WallJump` to build only this
batch. Some scenes need a graphics device while building their lighting data;
keep the editor in batchmode and omit `-nographics` for those builds.