# Reproduction recipe How the datasets in [this repo](../README.md) were recorded from public materials. Scripts live in the GitHub repo — record with [`examples/unity_collection`](https://github.com/ccnets-team/causal-gpt-rl/tree/main/examples/unity_collection) and package with [`collection/build_minari.py`](https://github.com/ccnets-team/causal-gpt-rl/blob/main/collection/build_minari.py). For each ONNX-driven environment, get the matching model-removed build and stock policy from the [envs repo](https://huggingface.co/datasets/ccnets/causal-gpt-rl-unity-envs), record each agent's per-step `(observation, action, reward, termination)`, and preserve the action/observation structure declared by that build. ## Format & provenance All environments, datasets, and stock behavior policies use **ML-Agents `release_23`**; machine-readable provenance is in `release_manifest.json`. Every dataset is stored at `//data/main_data.hdf5` with a sibling `metadata.json` (`minari_version` 0.5.3). **Action labels and decision periods.** An ML-Agents agent requests a decision only every *k*-th step; Unity repeats that decision through the gap, and the agent does not appear in `DecisionSteps` again until the next one. For those in-between steps, record the action Unity is still running — carry the agent's last decision forward. A recorder that instead stores whatever its policy wrapper emits for an agent with no observation that step will label most transitions with a placeholder; see the dataset card's data-quality notice. **Ego-agent schema (SoccerTwos, DungeonEscape).** These use `observations["agents"]["agent_0"]` / `actions["agents"]["agent_0"]`. Each physical agent is stored as one ego-centric episode because the Unity examples run one shared decentralized policy independently per agent; the wrapper exposes the multi-agent structure without granting the policy privileged access to teammates' private observations. Reconstruct a match/group by grouping the linked episodes on `match_id`; **split by `match_id`, never by individual ego episode.** **Quality tiers.** `medium`/`simple` degrade the stock policy (seed 2310000): continuous scenes add per-episode Gaussian action noise from a calibrated range; the discrete goal games sample the policy's own logits via `softmax(logits/T)` and are scored by step-reward (return/length, since their episode return is bimodal) — PushBlock and Pyramids each sampling `T` **per episode** from a calibrated range (each episode its own skill level); DungeonEscape (cooperative) samples a softmax temperature `T` **per group per match** from a calibrated range — all three group agents share the match's `T`; competitive self-play SoccerTwos draws a per-team softmax temperature `T` independently per match from a (wider) range — the two teams draw independently, so each match pairs two skill levels (a random gap = league play). Exact values, anchors, and calibration notes are in the [dataset card](../README.md)'s "Quality ladders" section. ## SoccerTwos 1. Build the release_23 SoccerTwos scene with both teams' model assets removed so both behavior groups are controlled externally. 2. Run the stock `SoccerTwos.onnx` for both teams and record both sides. The original ONNX declares two nonexistent Sentis metadata graph outputs; for ONNX Runtime, remove only those dangling output declarations (the action graph is unchanged). 3. Store the sum of per-agent `reward` and `group_reward` (goals arrive via `group_reward`). 4. Preserve `Tuple(Box(264), Box(72))` observations and `MultiDiscrete([3, 3, 3])` actions. 5. Link the four decentralized episodes per field with `match_id`; finish all in-flight matches after crossing one million transitions. Expert validation: 1,001,676 transitions, 14,692 terminated episodes, 3,673 matches, 0 truncations, every match has equal linked lengths with two wins / two losses. Mean agent ep length 68.18, mean return −0.034089. Tiers: `medium`/`simple` draw a **per-team** softmax temperature `T ~ U(1.3, 2.6)` / `U(2.1, 3.4)` (each team draws once per match, independently of its opponent, shared by its two agents — a per-match skill gap = cross-checkpoint league play; `collect.py --team-temperature-range `). Self-play keeps returns balanced (both tiers ≈ 50/50 win-loss), so tier skill is set by the ego team's own drawn `T` and calibrated to side-swapped match-score norm ≈0.80 / ≈0.60 (expert T=1 → 1.0, random T=25 → 0). medium: 12,940 ego ep / 1,002,368 transitions / 3,235 matches; simple: 11,820 / 1,001,564 / 2,955. ## DungeonEscape 1. Use the stock `DungeonEscape.onnx` shared POCA policy with the model removed so each agent is driven externally. 2. Record each physical agent independently; preserve its three local sensor leaves (rigid-body 10, stacked ray 360, has-key flag 1) and single `Discrete(7)` action. 3. Relabel each physical agent as ego path `agents.agent_0`. Three episodes sharing one `match_id` reconstruct the cooperative group (distinct local trajectories, not copies). 4. Sum `reward` and `group_reward`. Determine success only at group level — an agent that dies early may not receive a later positive group reward. 5. Split by `match_id`. Expert validation: 1,007,206 transitions, 35,505 ego episodes, 11,835 groups (11,366 successes / 469 failures), 0 shape/range errors. Every match links exactly three episodes. Tiers: `medium`/`simple` apply a **per-group** softmax temperature `T ~ U(1.5, 3.0)` / `U(3.0, 4.0)` (drawn once per cooperative group per match and shared by its three agents), calibrated to step-reward norm 0.80 / 0.61 against the expert step-reward anchor 0.019355 (random ≈0.00015). medium: 28,314 ego ep / 1,012,457 transitions; simple: 22,542 / 1,001,594. ## PushBlock 1. Use the model-removed PushBlock build and drive all 32 agents with the stock `PushBlock.onnx`. This is the original discrete PushBlock, not the hybrid PushBlockWithInput. 2. Preserve the two `105`-d sensors and the single `Discrete(7)` action branch. 3. Stop at one million transitions and package each physical-agent episode independently. Expert validation: 53,039 episodes (52,946 terminated / 93 truncated at the recording boundary), mean return 4.972780, mean ep length 18.85. ## Crawler, Pyramids, Worm, Walker, 3DBallHard Use each model-removed build with its matching stock ONNX; record each physical scene agent independently and stop at one million transitions. Schemas come directly from the live ML-Agents behavior specs. - **Crawler** — 1,043 episodes, 1,000,000 transitions, mean return 2575.8405, mean length 958.77 (76 terminated / 967 truncated). `Tuple(Box(126), Box(32))`, `Box(20)`. - **Pyramids** — 5,392 episodes, 1,000,000 transitions, mean return 1.797730, mean length 185.46 (5,344 terminated / 48 truncated). `Tuple(Box(56)×3, Box(4))`, `Discrete(5)`. - **Worm** — 1,000 episodes, 1,000,000 transitions, mean return 1044.106317, mean length 1000.00 (0 terminated / 1,000 truncated). `Box(64)`, `Box(9)`. - **Walker** — 1,464 episodes, 1,000,000 transitions, mean return 1354.565443, mean length 683.06 (768 terminated / 696 truncated). `Box(243)`, `Box(39)`. - **3DBallHard** — 1,011 episodes, 1,000,008 transitions, mean return 98.909511, mean length 989.13 (3 terminated / 1,008 truncated). `Tuple(Box(27), Box(18))`, `Box(2)`. The recipe ends at the Minari dataset — a portable, env-less trajectory set.