Broodwar replays dumper (using BWAPI)
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
Release
BWRepDump.cpp
BWRepDump.h added time limit (45 minutes), corrected findClosest big bug Jan 31, 2012
BWRepDump.sln
BWRepDump.vcproj
Dll.cpp
LICENSE
MkDirs.sh
README.md
cp.py
find_missing.py

README.md

Requirements

BWAPI
MS Visual C++ 2008 (optional, a DLL is here)
StarCraft: Broodwar

Pipeline used

First, get some replays (I did get mine from ICCUP, TeamLiquid and GosuGamers), with scripts.
I use ChaosLauncher to inject BWAPI in StarCraft: Broodwar, in Release mode (Debug will not be able to deal with un-analysed/un-serialized BWTA maps), with:

    auto_menu = SINGLE_PLAYER
    auto_restart = ON
    map = maps\replays\some_folder\*.rep
    mapiteration = SEQUENCE

Regions

Serialization

To serialize, we hash BWTA's regions and ChokeDepReg regions on their TilePosition center.

ChokeDepReg: Choke dependant regions

ChokeDepReg are regions created from the center of chokes to MAX(MIN_CDR_RADIUS(currently 9), CHOKE_WIDTH) build tiles (TilePositions) away, in a Voronoi tiling fashion. Once that is done, ChokeDepRegs are completed with BWTA::Regions minus existing ChokeDepRegs.

Result for one replay

Data is partly redundant, in a way that eases analysis.

RGD file

    [Replay Start]
    RepPath: $(PATH/TO/REP)
    MapName: $MAPNAME
    NumStartPositions: $N
    The following players are in this replay:
    <list of 
    $PLAYER_ID, $PLAYER_NAME, $START_LOC
    separated by newlines>
    Begin replay data:
    <list of
    $FRAME_NUMBER,$PLAYER_ID,$ACTION,[$ACTION_DEP_ARGS]
    separated by newlines>
    [EndGame]

Actions can be:

  • Created,$UNIT_ID,$UNIT_TYPE,($POS_X,$POS_Y),$CDR_HASH,$REGION_HASH
  • Destroyed,$UNIT_ID,$UNIT_TYPE,($POS_X,$POS_Y)
  • Discovered,$UNIT_ID,$UNIT_TYPE
  • R,$MINERALS,$GAS,$GATHERED_MINERALS,$GATHERED_GAS,
    $SUPPLY_USED,$SUPPLY_TOTAL
  • ChangedOwnership,$UNIT_ID
  • Morph,$UNIT_ID,$UNIT_TYPE,($POS_X,$POS_Y)
  • $FIRST_FRAME,$DEFENDER_ID,IsAttacked,($ATTACK_TYPES), ($INIT_POSITION.X,$INIT_POSITION.Y),
    $INIT_CDR, $INIT_REGION, {$PLAYER_ID:{$TYPE:$MAX_NUMBER_INVOLVED}},
    ($SCORE_GROUND_CDR,$SCORE_GROUND_REGION,$SCORE_AIR_CDR,
    $SCORE_AIR_REGION,$SCORE_DETECT_CDR,$SCORE_DETECT_REGION,
    $ECO_IMPORTANCE_CDR,$ECO_IMPORTANCE_REGION,
    $TACT_IMPORTANCE_CDR,$TACT_IMPORTANCE_REGION),
    {$PLAYER_ID:{$TYPE:$NUMBER_AT_END}},($LAST_POSITION.X,$LAST_POSITION.Y),
    {$PLAYER_ID:$NB_WORKERS_DEAD},$LAST_FRAME,$WINNER_ID(OPTIONAL)

$ATTACK_TYPES are in {DropAttack, GroundAttack, AirAttack, InvisAttack, UnknownAttackError}.

$TACT_IMPORTANCE and $ECO_IMPORTANCE are from in-game heuristics.

ROD file

    <list of
    $FRAME,$PLAYER_ID,$ORDER,TargetOrPosition,$POS_X,$POS_Y
    separated by newlines>

with TargetOrPositions being T if the order in on a unit, P if it's a map position.

RLD file

    Regions,$REGIONS_IDS_COMMA_SEPARATED
    $REGION_ID, $DIST, $DIST, ...
    $REGION_ID, $DIST, $DIST, ...
    .
    .
    .
    ChokeDepReg,$REGIONS_IDS_COMMA_SEPARATED
    $REGION_ID, $DIST, $DIST, ...
    $REGION_ID, $DIST, $DIST, ...
    .
    .
    .
    [Replay Start]
    <list of
    $FRAME,$UNIT_ID,$POS_X,$POS_Y
    $FRAME,$UNIT_ID,Reg,$REGION_ID
    $FRAME,$UNIT_ID,CDR,$CDR_ID
    separated by newlines>

With new lines uniquely when the unit moved (of Position and/or Region and/or ChokeDepReg) in the last refresh rate frames (100 atm).

Tuning

You can tune these defines.

Final words

This work is an extension of bwrepanalysis