blind-review-data commited on
Commit
e72a06c
·
verified ·
1 Parent(s): 08fcc72

Upload README.md with huggingface_hub

Browse files
Files changed (1) hide show
  1. README.md +295 -0
README.md ADDED
@@ -0,0 +1,295 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ license: cc-by-nc-4.0
3
+ pretty_name: StarCraftMotion
4
+ language:
5
+ - en
6
+ size_categories:
7
+ - 100K<n<1M
8
+ task_categories:
9
+ - time-series-forecasting
10
+ - other
11
+ tags:
12
+ - starcraft-ii
13
+ - multi-agent
14
+ - trajectory-prediction
15
+ - motion-forecasting
16
+ - partial-observability
17
+ - benchmark
18
+ configs:
19
+ - config_name: default
20
+ data_files:
21
+ - split: train
22
+ path: train/*.parquet
23
+ - split: validation
24
+ path: val/*.parquet
25
+ - split: test
26
+ path: test/*.parquet
27
+ ---
28
+
29
+ # StarCraftMotion
30
+
31
+ StarCraftMotion is a large-scale benchmark for agent simulation
32
+ 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
33
+ states, dynamic map layers, and per-player economy time series.
34
+
35
+ The released split is **adversarial**: scenarios are subsampled to
36
+ overweight interaction-heavy windows (mutual-visibility and inter-player
37
+ transitions), making it a stress test for multi-agent prediction under
38
+ partial observability.
39
+
40
+ - **Total scenarios:** 469,187
41
+ - **Train / Val / Test:** 362,075 / 45,121 / 61,991
42
+ - **Source replays:** 64,327 replay-level HDF5 files (Blizzard `3.16.1-Pack_1-fix`)
43
+ - **Maps (ID):** Abyssal_Reef_LE, Acolyte_LE, Ascension_to_Aiur_LE, Interloper_LE, Mech_Depot_LE
44
+ - **Maps (OOD, test only):** Catallena_LE_(Void), Odyssey_LE
45
+ - **Splits are replay-level** — windows from the same replay never cross splits.
46
+
47
+ ## Why parquet, and how to read
48
+
49
+ Each row is one scenario. All per-frame / per-unit array columns are
50
+ stored as **typed Arrow `large_list` arrays** (e.g. `LIST<float16>`,
51
+ `LIST<bool>`). `n_timesteps = 145` and `n_units` varies per scenario (stored per row).
52
+ The dynamic map layers (`map_creep`, `map_fow_p1`, `map_fow_p2`) are
53
+ sampled every 16 frames, giving `map_T = 10` snapshots per scenario.
54
+ Spatial dimensions `map_H` and `map_W` are stored as explicit scalar
55
+ columns per row (map-dependent; e.g. Abyssal_Reef_LE is 176 × 200).
56
+
57
+ ```python
58
+ import numpy as np
59
+ from datasets import load_dataset
60
+
61
+ ds = load_dataset("blind-review-data/StarCraftMotion", split="train", streaming=True)
62
+ row = next(iter(ds))
63
+
64
+ T, N = row["n_timesteps"], row["n_units"]
65
+ map_T, map_H, map_W = row["map_T"], row["map_H"], row["map_W"]
66
+
67
+ coord = np.asarray(row["coordinate"], dtype=np.float16).reshape(T, N, 3)
68
+ alive = np.asarray(row["is_alive"], dtype=bool ).reshape(T, N)
69
+ owner = np.asarray(row["unit_owner"], dtype=np.uint8 ).reshape(N)
70
+ utype = np.asarray(row["unit_type"], dtype=np.uint32).reshape(T, N)
71
+ creep = np.asarray(row["map_creep"], dtype=bool ).reshape(map_T, map_H, map_W)
72
+ ```
73
+
74
+ ### Schema
75
+
76
+ #### Scalar fields
77
+
78
+ | Field | Type | Description |
79
+ |---------------|--------|--------------------------------------------------------------|
80
+ | `split` | string | `train`, `val`, or `test` |
81
+ | `map_name` | string | Map name (spaces replaced with `_`) |
82
+ | `replay_hash` | string | Hash of the parent SC2Replay file |
83
+ | `segment_idx` | int32 | Index of this 145-frame window inside the parent replay |
84
+ | `n_timesteps` | int32 | Number of frames per row (constant `145` in this release) |
85
+ | `n_units` | int32 | Number of unique unit rows in this scenario (variable) |
86
+ | `map_T` | int32 | Number of map snapshots per row (constant `10` in this release) |
87
+ | `map_H` | int32 | Map grid height in cells (map-dependent) |
88
+ | `map_W` | int32 | Map grid width in cells (map-dependent) |
89
+
90
+ #### Map data — shape `(map_T, map_H, map_W)` where `map_T = 10`
91
+
92
+ `map_H` and `map_W` are map-specific (each StarCraft II ladder map has
93
+ its own native grid). All three layers below share the same shape per
94
+ scenario.
95
+
96
+ | Field | dtype |
97
+ |---------------|-------|
98
+ | `map_creep` | bool |
99
+ | `map_fow_p1` | bool |
100
+ | `map_fow_p2` | bool |
101
+
102
+ #### Player economy — shape `(145, 2)`, column 0 = Player 1, column 1 = Player 2
103
+
104
+ | Field | dtype |
105
+ |-------------|--------|
106
+ | `food_cap` | uint8 |
107
+ | `food_used` | uint8 |
108
+ | `minerals` | uint16 |
109
+ | `vespene` | uint16 |
110
+
111
+ #### Per-unit constants — shape `(n_units,)`
112
+
113
+ | Field | dtype | Description |
114
+ |--------------|--------|----------------------------------------------|
115
+ | `unit_owner` | uint8 | 1 = P1, 2 = P2, 16 = neutral |
116
+ | `unit_tag` | uint64 | Raw SC2 engine tag (unique per unit instance)|
117
+
118
+ #### Per-frame, per-unit — shape `(145, n_units)` unless noted
119
+
120
+ | Field | dtype | Shape | Description |
121
+ |-------------------|---------|----------------------|-------------------------------------------------|
122
+ | `coordinate` | float16 | (145, n_units, 3) | Native (x, y, z) map coordinates |
123
+ | `target_pos` | float16 | (145, n_units, 2) | Order target ground position |
124
+ | `health` | float16 | | |
125
+ | `health_max` | float16 | | |
126
+ | `shield` | float16 | | Protoss shield |
127
+ | `energy` | float16 | | |
128
+ | `heading` | float16 | | Facing direction in radians (0 to 2π) |
129
+ | `radius` | float16 | | Unit collision radius |
130
+ | `build_progress` | float16 | | 0.0–1.0 |
131
+ | `unit_type` | uint32 | | Raw SC2 unit type ID |
132
+ | `ability_id` | uint32 | | First order's ability ID |
133
+ | `target_id` | uint32 | | Target's row index (`0xFFFFFFFF` = no target) |
134
+ | `mineral_contents`| uint16 | | Remaining minerals (mineral fields) |
135
+ | `vespene_contents`| uint16 | | Remaining vespene (geysers) |
136
+ | `is_alive` | bool | | |
137
+ | `is_burrowed` | bool | | Zerg burrowed |
138
+ | `is_carried` | bool | | Inside a transport |
139
+ | `is_flying` | bool | | Air unit / lifted building |
140
+ | `visible_status` | uint8 | | Combined P1/P2 visibility (see below) |
141
+
142
+ `visible_status = p1_state * 3 + p2_state`, with each state in
143
+ `{0 = unseen, 1 = snapshot, 2 = visible}`. Examples: `8` = visible to both,
144
+ `6` = visible to P1 only, `2` = visible to P2 only.
145
+
146
+ ### Action labels
147
+
148
+ The `ability_id` column stores the **raw SC2 ability ID as `uint32`**
149
+ (e.g. `MOVE = 16`, `ATTACK_ATTACK = 23`, `HARVEST_GATHER_DRONE = 1183`,
150
+ `ability_id == 0` means the unit has no active order). It is **not**
151
+ class-indexed.
152
+
153
+ For action prediction tasks we provide an 11-class coarse mapping in the
154
+ source repository at
155
+ [`sc2sensor/utils/coarse_action_mapping.py`].
156
+
157
+ | Label | Name | Description |
158
+ |------:|-----------|------------------------------------------------------------|
159
+ | 0 | NO_OP | `ability_id == 0`; unit idle |
160
+ | 1 | MOVE | move, patrol, hold position, stop, smart (right-click) |
161
+ | 2 | ATTACK | attack, attack-move, attack building |
162
+ | 3 | HARVEST | gather resources, return cargo |
163
+ | 4 | TRAIN | produce units from buildings / larvae / warp-in |
164
+ | 5 | BUILD | construct structures, add-ons, creep tumors |
165
+ | 6 | RESEARCH | upgrades and tech research |
166
+ | 7 | MORPH | unit/structure transformation (siege, archon, lair, etc.) |
167
+ | 8 | EFFECT | combat abilities, spells, auto-cast effects |
168
+ | 9 | TRANSPORT | load, unload, lift off, land |
169
+ | 10 | BURROW | burrow down / burrow up (Zerg) |
170
+ | 255 | UNKNOWN | unmapped or cosmetic |
171
+
172
+ Sources for the mapping:
173
+ - Blizzard `s2client-api` `ABILITY_ID` enum:
174
+ https://blizzard.github.io/s2client-api/sc2__typeenums_8h.html
175
+ - Blizzard `s2client-proto` `stableid.json`:
176
+ https://github.com/Blizzard/s2client-proto/blob/master/stableid.json
177
+
178
+ Coverage on the released split is 100% of all action occurrences
179
+ (every `ability_id` either matches a Blizzard enum prefix, is one of 10
180
+ explicit `stableid.json` overrides, or is `0` / falls into `UNKNOWN`).
181
+
182
+ #### Applying the mapping
183
+
184
+ ```python
185
+ import numpy as np
186
+ from sc2sensor.utils.coarse_action_mapping import ABILITY_ID_TO_COARSE_ACTION
187
+
188
+ T, N = row["n_timesteps"], row["n_units"]
189
+ ability_id = np.frombuffer(row["ability_id"], dtype=np.uint32).reshape(T, N)
190
+
191
+ # Vectorized lookup via a dense uint8 table.
192
+ max_id = max(ABILITY_ID_TO_COARSE_ACTION) + 1
193
+ lut = np.full(max_id, 255, dtype=np.uint8)
194
+ for aid, label in ABILITY_ID_TO_COARSE_ACTION.items():
195
+ lut[aid] = label
196
+
197
+ coarse = np.where(ability_id < max_id, lut[np.clip(ability_id, 0, max_id - 1)], 255)
198
+ ```
199
+
200
+ ## Pipeline summary
201
+
202
+ 1. **Replay extraction** (`extract_replay_level.py`): three SC2 engine passes
203
+ (omniscient + per-player FOW) into one HDF5 per replay, preserving native
204
+ coordinates, raw SC2 unit/ability IDs, and per-player visibility.
205
+ 2. **Scenario windowing** (`split_scenarios.py`): chunk into `145`-frame
206
+ windows at `16 FPS` (1 s history + current + 8 s future).
207
+ Drops replays with `duration < 120 s` or either player at `APM < 1`.
208
+ 3. **Replay-level split** (`create_dataset_split.py`): 80/10/10 train/val/test
209
+ over ID maps; OOD maps go to test only. Keeps `10%` of each replay's
210
+ windows.
211
+ 4. **Adversarial weighting**: window sampling weight is
212
+ `log(1 + mutual_unit_sum) + log(1 + transition_cnt)`; zero-score windows
213
+ are excluded.
214
+
215
+ ## Dataset statistics
216
+
217
+ ### Player-unit counts (units with `owner != 16`)
218
+
219
+ | Split | Mean | Std | Min | P25 | Median | P75 | Max |
220
+ |-------|-------:|-------:|----:|----:|-------:|----:|----:|
221
+ | Train | 204.56 | 113.06 | 11 | 109 | 189 | 284 | 921 |
222
+ | Val | 203.56 | 112.51 | 18 | 109 | 188 | 282 | 689 |
223
+ | Test | 202.78 | 111.70 | 13 | 107 | 189 | 281 | 779 |
224
+
225
+ ### Race matchups
226
+
227
+ | Split | PvP | PvT | PvZ | TvT | TvZ | ZvZ |
228
+ |-------|-------:|-------:|-------:|-------:|--------:|-------:|
229
+ | Train | 23,322 | 82,819 | 66,139 | 54,819 | 104,780 | 30,196 |
230
+ | Val | 3,037 | 9,978 | 8,514 | 6,853 | 13,326 | 3,413 |
231
+ | Test | 4,112 | 13,927 | 10,883 | 9,536 | 18,531 | 5,002 |
232
+
233
+ ### Mutual visibility (units with `visible_status == 8` and `is_alive`)
234
+
235
+ | Split | Mean mutually-visible units / frame |
236
+ |-------|------------------------------------:|
237
+ | Train | 23.56 |
238
+ | Val | 23.40 |
239
+ | Test | 23.43 |
240
+
241
+ ## Intended use
242
+
243
+ - Multi-agent simulation under adversarial partial observability.
244
+ - Benchmarks for fog-of-war handling, ID vs OOD-map
245
+ generalization, and interaction-heavy scenes.
246
+
247
+ ## Limitations and ethical considerations
248
+
249
+ - **Replay provenance:** raw replays come from Blizzard's
250
+ `3.16.1-Pack_1-fix` distribution. Per-replay curation, demographics of
251
+ players, and any prior filtering performed by Blizzard are not documented.
252
+ - **MMR caveat:** raw MMR values include sentinel-like negatives (down to
253
+ `-36400`) for some replays. League-tier bucketing should be recomputed
254
+ rather than relied upon naively.
255
+ - **Single game version:** all replays are SC2 build 3.16.1; balance and
256
+ meta-game differ from current ladder versions.
257
+ - **No personally identifying content** is included beyond what Blizzard
258
+ publishes in replay packs. Player names are not surfaced as columns.
259
+ - **Game-balance / strategic bias:** the corpus is whatever Blizzard
260
+ released in the pack and is not a uniform sample of competitive play.
261
+
262
+ ## License
263
+
264
+ The released parquet artifacts are licensed under
265
+ [**Creative Commons Attribution-NonCommercial 4.0 International (CC-BY-NC-4.0)**](https://spdx.org/licenses/CC-BY-NC-4.0.html)
266
+ (SPDX: `CC-BY-NC-4.0`).
267
+
268
+ The released parquet files are **derivative ML features** (float16 unit
269
+ trajectories, fog-of-war and creep masks, per-player economy time series,
270
+ and raw SC2 unit/ability identifiers) extracted from StarCraft II
271
+ replays. The dataset does **not** redistribute raw `.SC2Replay` files,
272
+ SC2 game maps, or any portion of the StarCraft II Software. Use of the
273
+ underlying StarCraft II replays and the SC2 engine is separately
274
+ governed by Blizzard's
275
+ [AI and Machine Learning License](https://blzdistsc2-a.akamaihd.net/AI_AND_MACHINE_LEARNING_LICENSE.html);
276
+ that license explicitly permits use of derived ML data for personal or
277
+ internal research and development.
278
+
279
+
280
+ ## Citation
281
+
282
+ Underlying replays:
283
+
284
+ ```bibtex
285
+ @misc{blizzard_sc2_replaypacks,
286
+ title = {StarCraft II Replay Packs (3.16.1-Pack\_1-fix)},
287
+ author = {{Blizzard Entertainment}},
288
+ howpublished = {\url{https://blzdistsc2-a.akamaihd.net/ReplayPacks/3.16.1-Pack_1-fix.zip}}
289
+ }
290
+ ```
291
+
292
+ ## Acknowledgments
293
+
294
+ Built on top of DeepMind's `pysc2` and Blizzard's StarCraft II AI/ML
295
+ infrastructure.