File size: 15,349 Bytes
13bc155
 
297c9e4
13bc155
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
297c9e4
13bc155
 
 
 
 
 
 
297c9e4
13bc155
 
 
 
 
 
 
297c9e4
13bc155
 
 
 
 
 
 
 
 
 
 
297c9e4
13bc155
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
297c9e4
 
 
 
 
 
 
 
 
 
13bc155
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
297c9e4
 
 
13bc155
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
297c9e4
 
 
 
13bc155
 
 
 
 
297c9e4
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
13bc155
297c9e4
13bc155
297c9e4
 
 
 
 
13bc155
 
 
 
 
 
 
 
 
 
 
 
297c9e4
 
 
13bc155
 
297c9e4
 
13bc155
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
297c9e4
 
 
 
 
 
13bc155
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
---
license: cc-by-nc-4.0
pretty_name: StarCraftMotion
language:
- en
size_categories:
- 1K<n<10K
task_categories:
- time-series-forecasting
- other
tags:
- starcraft
- multi-agent
- agent-simulation
- partial-observability
- benchmark
configs:
- config_name: default
  data_files:
  - split: train
    path: train/*.parquet
  - split: validation
    path: validation/*.parquet
  - split: test
    path: test/*.parquet
---

# StarCraftMotion

StarCraftMotion is a large-scale benchmark for agent simulation
under adversarial and partial observability scenarios (built from StarCraft replays). Each example is a fixed-length scenario window (`145` frames at `16 FPS`, ~9 seconds) containing all unit 
states, dynamic map layers, and per-player economy time series.

- **Total scenarios:** 1,000
- **Train / Val / Test:** 800 / 100 / 100
- **Source replays:** 64,327 replay-level HDF5 files (Blizzard `3.16.1-Pack_1-fix`)
- **Maps (ID):** Abyssal_Reef_LE, Acolyte_LE, Ascension_to_Aiur_LE, Interloper_LE, Mech_Depot_LE
- **Maps (OOD, test only):** Catallena_LE_(Void), Odyssey_LE
- **Splits are replay-level** — windows from the same replay never cross splits.

## Why parquet, and how to read

Each row is one scenario. All per-frame / per-unit array columns are
stored as **typed Arrow `list` arrays** (e.g. `LIST<float16>`,
`LIST<bool>`). `n_timesteps = 145` and `n_units` varies per scenario (stored per row).
The dynamic map layers (`map_creep`, `map_fow_p1`, `map_fow_p2`) are
sampled every 16 frames, giving `map_T = 10` snapshots per scenario.
Spatial dimensions `map_H` and `map_W` are stored as explicit scalar
columns per row (map-dependent; e.g. Abyssal_Reef_LE is 176 × 200).

```python
import numpy as np
import pyarrow.parquet as pq
from huggingface_hub import hf_hub_download

path = hf_hub_download("inouye-lab/StarCraftMotion_sample", "train/shard_00000.parquet", repo_type="dataset")
row = next(pq.ParquetFile(path).iter_batches(batch_size=1)).to_pylist()[0]

T, N = row["n_timesteps"], row["n_units"]
map_T, map_H, map_W = row["map_T"], row["map_H"], row["map_W"]

coord = np.asarray(row["coordinate"], dtype=np.float16).reshape(T, N, 3)
alive = np.asarray(row["is_alive"],   dtype=bool    ).reshape(T, N)
owner = np.asarray(row["unit_owner"], dtype=np.uint8 ).reshape(N)
utype = np.asarray(row["unit_type"],  dtype=np.uint32).reshape(T, N)
creep = np.asarray(row["map_creep"],  dtype=bool    ).reshape(map_T, map_H, map_W)
```

### Schema

#### Scalar fields

| Field         | Type   | Description                                                  |
|---------------|--------|--------------------------------------------------------------|
| `split`       | string | `train`, `val`, or `test`                                    |
| `map_name`    | string | Map name (spaces replaced with `_`)                          |
| `replay_hash` | string | Hash of the parent SC2Replay file                            |
| `segment_idx` | int32  | Index of this 145-frame window inside the parent replay      |
| `n_timesteps` | int32  | Number of frames per row (constant `145` in this release)    |
| `n_units`     | int32  | Number of unique unit rows in this scenario (variable)       |
| `map_T`       | int32  | Number of map snapshots per row (constant `10` in this release) |
| `map_H`       | int32  | Map grid height in cells (map-dependent)                     |
| `map_W`       | int32  | Map grid width in cells (map-dependent)                      |
| `player_1_start_location` | `list<float32>` | Full xyz start location, length 3, for in-game slot 1 |
| `player_2_start_location` | `list<float32>` | Full xyz start location, length 3, for in-game slot 2 |
| `playable_area` | `list<int64>` | Playable bounds `[x0, y0, x1, y1]`, length 4 |
| `chunk_start_frame` | int32 | Scenario start frame |
| `chunk_end_frame` | int32 | Scenario end frame |
| `map_frame_start` | int32 | Starting map-layer frame |
| `map_frame_skip` | int32 | Map sampling interval, constant 16 |
| `current_frame_idx` | int32 | Current-frame index, constant 16 |
| `player_info` | string | JSON list with keys `player_id` (in-game slot 1/2), `race_requested`, `race_actual` (0 = NoRace, 1 = Terran, 2 = Zerg, 3 = Protoss, 4 = Random), `player_result` (1 = Victory, 2 = Defeat, 3 = Tie, 4 = Undecided), `player_mmr`, `player_apm` |
| `replay_info` | string | JSON object with keys `game_duration_loops`, `game_duration_seconds` (float), `game_version` (string), `data_build`, `base_build` |

#### Map data — shape `(map_T, map_H, map_W)` where `map_T = 10`

`map_H` and `map_W` are map-specific (each StarCraft II ladder map has
its own native grid). All three layers below share the same shape per
scenario.

| Field         | dtype |
|---------------|-------|
| `map_creep`   | bool  |
| `map_fow_p1`  | bool  |
| `map_fow_p2`  | bool  |

#### Player economy — shape `(145, 2)`, column 0 = Player 1, column 1 = Player 2

| Field       | dtype  |
|-------------|--------|
| `food_cap`  | uint8  |
| `food_used` | uint8  |
| `minerals`  | uint16 |
| `vespene`   | uint16 |

#### Per-unit constants — shape `(n_units,)`

| Field        | dtype  | Description                                  |
|--------------|--------|----------------------------------------------|
| `unit_owner` | uint8  | 1 = P1, 2 = P2, 16 = neutral                 |
| `unit_tag`   | uint64 | Raw SC2 engine tag (unique per unit instance)|

#### Per-frame, per-unit — shape `(145, n_units)` unless noted

| Field             | dtype   | Shape                | Description                                     |
|-------------------|---------|----------------------|-------------------------------------------------|
| `coordinate`      | float16 | (145, n_units, 3)    | Native (x, y, z) map coordinates                |
| `target_pos`      | float16 | (145, n_units, 2)    | Order target ground position                    |
| `health`          | float16 |                      |                                                 |
| `health_max`      | float16 |                      |                                                 |
| `shield`          | float16 |                      | Protoss shield                                  |
| `energy`          | float16 |                      |                                                 |
| `heading`         | float16 |                      | Facing direction in radians (0 to 2π)           |
| `radius`          | float16 |                      | Unit collision radius                           |
| `build_progress`  | float16 |                      | 0.0–1.0                                         |
| `unit_type`       | uint32  |                      | Raw SC2 unit type ID                            |
| `ability_id`      | uint32  |                      | First order's ability ID                        |
| `target_id`       | uint32  |                      | Target's row index (`0xFFFFFFFF` = no target)   |
| `mineral_contents`| uint16  |                      | Remaining minerals (mineral fields)             |
| `vespene_contents`| uint16  |                      | Remaining vespene (geysers)                     |
| `is_alive`        | bool    |                      |                                                 |
| `is_burrowed`     | bool    |                      | Zerg burrowed                                   |
| `is_carried`      | bool    |                      | Inside a transport                              |
| `is_flying`       | bool    |                      | Air unit / lifted building                      |
| `visible_status`  | uint8   |                      | Combined P1/P2 visibility (see below)           |

`visible_status = p1_state * 3 + p2_state`, with each state in
`{0 = unseen, 1 = snapshot, 2 = visible}`. Examples: `8` = visible to both,
`6` = visible to P1 only, `2` = visible to P2 only.

### Action labels

The `ability_id` column stores the **raw SC2 ability ID as `uint32`**
(e.g. `MOVE = 16`, `ATTACK_ATTACK = 23`, `HARVEST_GATHER_DRONE = 1183`,
`ability_id == 0` means the unit has no active order). It is **not**
class-indexed.

For action prediction tasks we provide an 11-class coarse mapping in the
source repository at
`utils/coarse_action_mapping.py`.

| Label | Name      | Description                                                |
|------:|-----------|------------------------------------------------------------|
|   0   | NO_OP     | `ability_id == 0`; unit idle                               |
|   1   | MOVE      | move, patrol, hold position, stop, smart (right-click)     |
|   2   | ATTACK    | attack, attack-move, attack building                       |
|   3   | HARVEST   | gather resources, return cargo                             |
|   4   | TRAIN     | produce units from buildings / larvae / warp-in            |
|   5   | BUILD     | construct structures, add-ons, creep tumors                |
|   6   | RESEARCH  | upgrades and tech research                                 |
|   7   | MORPH     | unit/structure transformation (siege, archon, lair, etc.)  |
|   8   | EFFECT    | combat abilities, spells, auto-cast effects                |
|   9   | TRANSPORT | load, unload, lift off, land                               |
|  10   | BURROW    | burrow down / burrow up (Zerg)                             |
|  255  | UNKNOWN   | unmapped or cosmetic                                       |

Sources for the mapping:
- Blizzard `s2client-api` `ABILITY_ID` enum:
  https://blizzard.github.io/s2client-api/sc2__typeenums_8h.html
- Blizzard `s2client-proto` `stableid.json`:
  https://github.com/Blizzard/s2client-proto/blob/master/stableid.json

Coverage on the released split is 100% of all action occurrences
(every `ability_id` either matches a Blizzard enum prefix, is one of 10
explicit `stableid.json` overrides, or is `0` / falls into `UNKNOWN`).

#### Applying the mapping

```python
import numpy as np
from utils.coarse_action_mapping import ABILITY_ID_TO_COARSE_ACTION

T, N = row["n_timesteps"], row["n_units"]
ability_id = np.asarray(row["ability_id"], dtype=np.uint32).reshape(T, N)

# Vectorized lookup via a dense uint8 table.
max_id = max(ABILITY_ID_TO_COARSE_ACTION) + 1
lut = np.full(max_id, 255, dtype=np.uint8)
for aid, label in ABILITY_ID_TO_COARSE_ACTION.items():
    lut[aid] = label

coarse = np.where(ability_id < max_id, lut[np.clip(ability_id, 0, max_id - 1)], 255)
```

## Pipeline summary

1. **Replay extraction** (`extract_replay_level.py`): three SC2 engine passes
   (omniscient + per-player FOW) into one HDF5 per replay, preserving native
   coordinates, raw SC2 unit/ability IDs, and per-player visibility.
2. **Scenario windowing** (`split_scenarios.py`): chunk into `145`-frame
   windows at `16 FPS` (1 s history + current + 8 s future).
   Drops replays with `duration < 120 s` or either player at `APM < 1`.
3. **Replay-level split** (`create_dataset_split.py`): 80/10/10 train/val/test
   over ID maps; OOD maps go to test only. Keeps `10%` of each replay's
   windows.
4. **Interaction-biased window sampling**: drop windows with no mutually
   observable units, then sample `10%` of each replay's candidate windows with
   higher probability for many mutually visible units or frequent
   visibility-status changes. Window sampling weight is
   `log(1 + mutual_unit_sum) + log(1 + transition_cnt)`; zero-score windows
   are excluded.

## Dataset statistics

Mingyu Kim's `sample_convert_to_parquet.py` uses seed 42, stratified by split and map, to select 800 train, 100 validation and 100 test scenarios; all seven maps are represented in test.

### Player-unit counts (units with `owner != 16`)

| Split | Mean   | Std    | Min | P25 | Median | P75 | Max |
|-------|-------:|-------:|----:|----:|-------:|----:|----:|
| Train | 201.49 | 107.92 | 19 | 112 | 186 | 280.25 | 559 |
| Val | 199.96 | 118.06 | 35 | 100.75 | 181 | 291.5 | 477 |
| Test | 200.25 | 117.61 | 43 | 100.75 | 172 | 294.5 | 526 |

### Race matchups

| Split | PvP    | PvT    | PvZ    | TvT    | TvZ     | ZvZ    |
|-------|-------:|-------:|-------:|-------:|--------:|-------:|
| Train | 59 | 201 | 156 | 115 | 205 | 64 |
| Val | 6 | 16 | 23 | 14 | 33 | 8 |
| Test | 7 | 17 | 21 | 14 | 32 | 9 |

### Mutual visibility (units with `visible_status == 8` and `is_alive`)

| Split | Mean mutually-visible units / frame |
|-------|------------------------------------:|
| Train | 28.67 |
| Val | 27.79 |
| Test | 26.66 |

## Intended use

- Multi-agent simulation under adversarial partial observability.
- Benchmarks for fog-of-war handling, ID vs OOD-map
  generalization, and interaction-heavy scenes.

## Limitations and ethical considerations

- **Replay provenance:** raw replays come from Blizzard's
  `3.16.1-Pack_1-fix` distribution. Per-replay curation, demographics of
  players, and any prior filtering performed by Blizzard are not documented.
- **MMR caveat:** `player_info.player_mmr` values include negatives (down to
  `-36400`) for some replays. League-tier bucketing should be recomputed
  rather than relied upon naively.
- **Single game version:** all replays are SC2 build 3.16.1; balance and
  meta-game differ from current ladder versions.
- **No personally identifying content** is included beyond what Blizzard
  publishes in replay packs. Player names are not surfaced as columns.
- **Game-balance / strategic bias:** the corpus is whatever Blizzard
  released in the pack and is not a uniform sample of competitive play.

## License

The released parquet artifacts are licensed under
[**Creative Commons Attribution-NonCommercial 4.0 International (CC-BY-NC-4.0)**](https://spdx.org/licenses/CC-BY-NC-4.0.html)
(SPDX: `CC-BY-NC-4.0`).

The released parquet files are **derivative ML features** (float16 unit
trajectories, fog-of-war and creep masks, per-player economy time series,
and raw SC2 unit/ability identifiers) extracted from StarCraft II
replays. The dataset does **not** redistribute raw `.SC2Replay` files,
SC2 game maps, or any portion of the StarCraft II Software. Use of the
underlying StarCraft II replays and the SC2 engine is separately
governed by Blizzard's
[AI and Machine Learning License](https://blzdistsc2-a.akamaihd.net/AI_AND_MACHINE_LEARNING_LICENSE.html);
that license explicitly permits use of derived ML data for personal or
internal research and development.


## Authors

- Yi-Chung Chen — Purdue University
- Mingyu Kim — Purdue University
- Ruqi Bai — Purdue University
- James Zachary Hare — DEVCOM Army Research Laboratory
- Jing Gao — Purdue University
- David I. Inouye — Purdue University

## Citation

```bibtex
@inproceedings{chen2026starcraftmotion,
  title = {StarCraft Motion: A Dataset for Agent Simulation in Adversarial and Partially Observable Scenarios},
  author = {Yi-Chung Chen and Mingyu Kim and Ruqi Bai and James Zachary Hare and Jing Gao and David I. Inouye},
  booktitle = {NeurIPS 2026 Evaluations and Datasets Track},
  year = {2026}
}
```

Underlying replays:

```bibtex
@misc{blizzard_sc2_replaypacks,
  title  = {StarCraft II Replay Packs (3.16.1-Pack\_1-fix)},
  author = {{Blizzard Entertainment}},
  howpublished = {\url{https://blzdistsc2-a.akamaihd.net/ReplayPacks/3.16.1-Pack_1-fix.zip}}
}
```

## Acknowledgments

Built on top of DeepMind's `pysc2` and Blizzard's StarCraft II AI/ML
infrastructure.