Preparing Game Data Starcraft 2 ~upd~ May 2026

| Source | Format | Use Case | |--------|--------|----------| | | Binary / MPQ archive | Full game state reconstruction, player actions, timings | | Live game state (via API) | JSON (via SC2API) | Real-time bot development, decision-making models | | Match history (Blizzard API) | JSON | Win rates, map stats, ladder ranking |

for event in replay.events: if event.name == 'UnitBornEvent': print(f"Unit event.unit_type_name born at event.second") if event.name == 'PlayerStatsEvent': print(f"Minerals: event.minerals, Vespene: event.vespene") Store actions as a table:

Example save:

df.to_parquet('sc2_actions.parquet', compression='snappy') If you control the game (bot development):

import pandas as pd actions = [] for event in replay.events: if hasattr(event, 'second'): actions.append( 'time_sec': event.second, 'event_type': event.name, 'player': getattr(event, 'player', None), 'unit_type': getattr(event, 'unit_type_name', None), 'position': getattr(event, 'location', None) ) df = pd.DataFrame(actions) Create a time-aligned representation: every 5 seconds, record game state (supply, workers, army, buildings, resources). preparing game data starcraft 2

import numpy as np state_data = [] timeline = np.arange(0, replay.real_length.seconds, 5)

import sc2reader replay = sc2reader.load_file("path/to/replay.SC2Replay") print(f"Map: replay.map_name") print(f"Duration: replay.real_length") | Source | Format | Use Case |

Here’s a comprehensive, step-by-step guide to for machine learning, replay analysis, or build order mining. 1. Understanding SC2 Data Sources You have three primary sources of game data: