AlfredStar: a fresh take on AI for StarCraft II

DeepMind's AlphaGo revolutionized Go, achieving superhuman mastery and pulling off unprecedented plays. But they moved on from AlphaStar too soon in 2019, leaving its potential in StarCraft II only partially realized.

AlfredStar picks up where they left off — superhuman play at a fraction of the cost. All three races. Adaptive strategies. No neural networks at execution time.

StarCraft II as a Bayesian Machine

StarCraft II is a partially observable game. You can't see what your opponent is doing. Every decision you make — expand or attack, tech or army, defend or pressure — depends on what you believe about the game state, not what you know.

AlfredStar treats SC2 as a Bayesian machine. You program policies in ASL — a domain-specific language for expressing SC2 strategy. The runtime maintains a belief state that drives all decisions. Partial information is explicit: what you've seen, what you've inferred, what's decayed.

The policy decides how to win. The runtime maintains belief. You author the strategy; the system executes it with perfect mechanics, tick by tick, against a live game.

THE STACK
ASL Source → asctl compile → Build Artifact → Runtime
Policy (what to do) → Plan (how to do it) → Execution (tick-by-tick)

ASL is not a general-purpose language. It's a commitment language — you declare the game states that must hold by certain times, how to react to events, and how to coordinate concurrent behavior. The compiler plans optimal build orders. The runtime executes them deterministically.

Get Started

Prerequisites

  • StarCraft II — installed and runnable (free to play)

Install asctl

terminal
curl -fsSL https://thealfreds.com/install.sh | sh

Write your first policy

zergling_rush.asl
strategy "Zergling Rush" for Zerg on patch 4.10.0 {
    trajectory {
        state "rush" by 4:00 {
            have Zergling: 12
            workers >= 13
            attack enemy.main
        }
    }
}

Compile it

terminal
$ asctl compile zergling_rush.asl

Zergling Rush | Zerg | patch 4.10.0
────────────────────────────────────────

Segment #0: "rush" (deadline 4:00)
  #  Action                 EST
────────────────────────────────────────
  1  Build SpawningPool     0:12
  2  Train Overlord         0:21
  3  Train Worker           0:39
  4  Train Zergling x2      0:58
  5  Train Zergling x2      1:15
  6  Train Zergling x2      1:32
  7  Train Zergling x2      1:49
  8  Train Zergling x2      2:06
  9  Train Zergling x2      2:23
 10  Attack enemy main       —

Expected: 13 workers | 19/22 supply
  Zergling x12

Compiled successfully → zergling_rush.build.json

Run a game

terminal
# Start SC2, then:
$ asctl ping
SC2 reachable — version 5.0.13 (build 90870)

$ asctl game start --map AbyssalReefLE.SC2Map --policy zergling_rush.asl
game_id: g1
status: in_game
map: AbyssalReefLE.SC2Map

# Watch the game, iterate on the policy:
$ asctl game load g1 zergling_rush_v2.asl
status: loaded

# Stream per-tick trace:
$ asctl game trace g1
[0:25] m=325 g=0 s=12/15 w=13
[0:50] m=250 g=0 s=15/22 w=13
[1:15] m=180 g=0 s=19/22 w=13

See the tutorials for more strategies across all three races.