Build Reference

The ASL compiler transforms a policy into a build order — a scheduled sequence of actions with resource costs, timing, dependencies, and critical path analysis. This is the data the runtime executes each tick.

A build can be inspected, diffed, versioned, and hot-swapped at tick boundaries via asctl game load. See Tutorials for examples of all three races.

Properties

  • Portable — runs on desktop, mobile, and web via a single runtime
  • Inspectable — human-readable tabular format for debugging and visualization
  • Hot-swappable — load new builds at tick boundaries without restart
  • Deterministic — same policy produces identical build orders across platforms
  • Compact — typically 10-50 KB

CPA Table Format

Each segment is a table of scheduled actions. The columns:

  • # — Row number (for the "After" column references)
  • Action — What to do: train a unit, build a structure, research an upgrade, assign gas workers
  • EST — Earliest Start Time, when this action can begin (all prerequisites met, resources available)
  • Min / Gas — Mineral and gas cost at the time of scheduling
  • Food — Supply used / supply cap after this action
  • Slack — How much this action can be delayed without pushing the deadline. *crit* means zero slack — it's on the critical path
  • After — Dependencies: which earlier actions must complete first

Goal rows (attack, scout, army positioning) appear after production actions with dashes in the resource columns. Goals are runtime directives — they don't consume resources or have timing constraints, but activate once the segment's production is underway.

Example: Multi-Segment Build

A 2-state Terran policy compiled into two segments. Segment 1 inherits the buildings from segment 0:

$ asctl compile bio_push.asl
Bio Push | Terran | patch 4.10.0
───────────────────────────────────────────────────────────────────

Segment #0: "opener" (deadline 3:30)
 #  Action                EST    Min  Gas  Food   Slack  After
───────────────────────────────────────────────────────────────────
 1  Build Supply         0:04   100    0 12/15    2:18
 2  Train Worker         0:08    50    0 12/15    3:09
 3  Build Barracks       0:25   235    0 12/23    2:18  #1
 4  Build Barracks       0:30   150    0 12/23    2:13  #1
 5  Train Worker         0:38    50    0 13/23    2:39
 6  Train Worker         0:50   134    0 14/23    2:27
 7  Train Worker         1:02   230    0 15/23    2:15

Expected: 16 workers | 16/23 supply
  Barracks x2

Segment #1: "push" (deadline 8:00)
 #  Action                EST    Min  Gas  Food   Slack  After
───────────────────────────────────────────────────────────────────
 1  Build Gas            1:16   374    0 16/23    3:49
 2  Train Marine         1:16   299    0 16/23    6:25
 3  Train Marine         1:16   249    0 17/23    6:25
 4  Train Marine         1:35   474    0 18/23    6:06
 5  Train Marine         1:35   424    0 19/23    6:06
 6  Train Marine         1:53   664    0 20/23    5:48
 7  Train Marine         1:53   614    0 21/23    5:48
 8  Assign 3 gas wrkrs   2:11   707    0 23/23    3:16  #1
 9  Train Marine         2:11   857    0 22/23    5:30
10  Build Supply         2:11   807    0 23/23    5:09
11  Train Marine         2:32   964   59 23/31    5:09  #10
12  Train Marauder       2:40  1030   84 24/31    4:58  #8
13  Train Marauder       2:50  1052   86 26/31    4:48  #8
14  Research Stimpack    3:25  1416  161 28/31    2:54  #8
15  Attack enemy main      —     —    —     —       —
    priority [army, workers]

Expected: 16 workers | 28/31 supply
  Marine x8, Marauder x2
  Stimpack

Segment Structure

Each state in the trajectory compiles to a segment. Segments chain:

  • State chaining — Segment N+1 starts with the economy, buildings, units, and upgrades from segment N's end state
  • Delta planning — Each segment only plans what's new. If segment 0 built 2 Barracks and segment 1 needs 2, nothing is built
  • Expected state — Each segment ends with a summary: worker count, supply, units, buildings, and upgrades
  • Branching — When a trajectory branches, the compiler plans each branch as its own sequence of segments from the common end state

Critical Path

Actions with zero slack are on the critical path — any delay pushes the segment's deadline. The critical path shows the bottleneck chain: which actions are sequentially blocking completion.

Non-critical actions have slack time. A worker training with 0:06 slack can be delayed by 6 seconds without affecting the deadline. This helps identify where the build has flexibility.

Race-Specific Mechanics

The compiler accounts for each race's building mechanics:

  • Protoss — Probes warp buildings and return immediately to mining (no lost income during construction)
  • Terran — SCVs are busy during construction (reduced mineral income while building)
  • Zerg — Drones morph into buildings and are consumed (worker count drops, supply freed)
← Back to home