Hillclimbing, or: How I Learned to Stop Worrying and Love the Token
How I used an overnight multi-agent council and an impossible 30,000-unit RTS pathfinding gauntlet to crush simulation performance in Rust and Godot.
I’ve been working on games with AI for over a year now. I wonder sometimes if an AI developer’s job is to kick the machine. “Keep going!” “Yes, I approve the plan already!” “You found some bugs and noted them, great! NOW FIX THEM!11!!!!11”. We as AIdevs care too much about the end result to one-shot something nonfunctional, but we have too much to do to be involved with HOW each particular end is accomplished. Recently I went in search of a solution and found that quantity has a quality all on its own.
Hillclimbing is something I first saw described in Theo’s video about it, but it’s ABSURDLY powerful for game development, and it can be made even more powerful with different agents. If an AI dev’s goal is to turn the open problems of real life into constrained problems an agent can solve, then this is how we do that for very large problems.
There are a few versions:
Pull examples of the things you like best and make it build until it’s ranked as high
(Say, find screenshots of the best RTS UIs, most beautiful game terrains. And set up a loop: “build something on our end, NOT LOOKING AT THE REFERENCES. Then, pass it on to a grading council who impartially gives a score to each of them. Keep looping until your thing is graded at parity with the others or until it stalls.” My councils typically include neon, opus and astra.)
Design an impossible task, set an impossible number, and make beating that the goal.
(The subject of today.)
I used this to tackle performance in my RTS game written in Rust and Godot. Mission design and game balance was starting to need tens of thousands of units when I had planned for no more than 10k in total.
So I prompted. In steps.
Step 1: make a VERY DIFFICULT TASK.
(yes this is the actual prompt I sent, very informal haha)
This was with neon by the way. Fable and opus are strong but I hate hate hate HATE their taste and it shows up in most anything artistic they do. so I make neon boss opus around and it works great (multiagent stuff in t3code).
It gave me a response of a few things I liked and a lot of things I didn’t:
I don’t always like agent ideas, but when I do, I sometimes use ‘em. Always good to ask for input since you might be pleasantly surprised. An agent once came up with a key part of one of my favorite units, the Crusader, but that’s another writeup.
Anyway.
Step 2: make a precise plan.
Informal, but precise. Tokens will be set on fire here, so it’s gotta be good. A dangerous thing is to adopt the mental instinct of “New problem? I’ll delegate it” rather than “New problem? I’ll do it.” You gotta write out the scope of the task yourself, according to your knowledge, I think.
Note here: “You will do a map like this” “These will be the invariants that must be satisfied” “oh and do it at an unreasonable scale so we can be sure it’ll work (30k units).” And “Work as a team so that one stupidity doesn’t sink us. These are your roles as judged by my arbitrary and biased decision-making.”
It got back to me with a thing, and I was like “make it harder in these ways and help me understand the scale by using a measurement I understand”:
And then, without much fanfare after some back and forth on the environment, it was kicked off without any fancy prompting — just a dictated “go do it” before bed, since it already had the context on the task scope:
(You REALLY don’t need the perfect prompt.)
BUT! I would have been doomed to failure if I’d left it running. With long running agent tasks, check in, and think about them! You see:
I think hillclimbing is like training a model with RL or with data.
You set up a target and the AI will optimize towards that target.
SO SET UP A GOOD TARGET.
I didn’t just need 30k units moving through a maze. I’m building an RTS. Units fight in an RTS. I came back to it the next morni—er, afternoon, and said:
Principle: DESIGN TESTS THAT IF THEY PASSED, THE GAME WOULD WORK. Don’t leave edge cases for it to exploit. You’re basically training an LLM except you’re doing it in the context window.
The run started at 03:43 day 1. This correction came in at wave 5, at 13:43 (day 1). The thread stopped working at 07:29 the next morning (day 2). It had solved it.
If you're curious, here are the full overnight results, scorecards, and frames (else scroll)
Good morning! The overnight 13-wave Council hillclimb finished cleanly on slot-03 (17 commits ahead of origin/master, HEAD 1a75a3086).
Headline result: Both 30,000-unit RTS benchmarks now pass every performance gate (mean, p50, p95, p99, and Tick-1 dispatch < 44.643 ms at 22.4 Hz on 8 threads) — including a full 60,000-tick end-to-end Wipeout run running 1.36× faster than real time (32.25 ms mean, 43.97 ms p99) with 29,998 / 30,000 (99.993%) settled in S8 and 0 units left anywhere in S1–S7, plus 0 / 448 ticks over budget (43.83 ms max) on 15k-vs-15k combined-arms Clash 30k. Real body collision stayed ON, unit/map definitions were untouched, and 1-vs-8 determinism is bit-identical across every run.
Final Gate Scorecard (1a75a3086, 8 threads)
| Benchmark | Mean | p50 | p95 | p99 | Max | Tick-1 Dispatch | Over Budget | Perf Gates | Integrity / Arrival / Collision |
|---|---|---|---|---|---|---|---|---|---|
| Wipeout 448t | 30.19 ms | 30.65 ms | 34.82 ms | 36.82 ms | 40.12 ms | 36.70 ms | 0 / 448 (0.0%) | ALL PASS | resp/coll/allies/orders PASS (0 severe) |
| Wipeout 2,240t | 35.53 ms | 36.22 ms | 41.15 ms | 41.83 ms | 46.45 ms | 35.63 ms | 1 / 2,240 (0.04%) | ALL PASS | resp/coll/allies/orders PASS (0 severe) |
| Wipeout 60,000t (full) | 32.25 ms | 33.80 ms | 42.35 ms | 43.97 ms | 52.17 ms | 37.10 ms | 180 / 60,000 (0.3%) | ALL PASS | resp/allies/orders PASS; 29,998/30,000 settled; 1 sample at t=25,760 had 1 solid pair at 40.11 px, final solid_ovlp = 0.39 px, wall_viol = 0 |
| Clash 30k 448t (clean) | 37.10 ms | 37.44 ms | 42.26 ms | 43.61 ms | 43.83 ms | 39.50 ms | 0 / 448 (0.0%) | ALL PASS | combat/orders PASS; exact-landing teleports/charges diagnosed separately, 0 hostile severe at t=448 |
- 1-vs-8 Determinism: PASS — W192
0x4a30f85950634c20, C1920x06841520c7896247; 8T W4480x94f2f6a953f64ed5, W22400x2210d56134c6668c, C4480x38adc5c82cf05f80(all bit-identical from Wave 11 through Wave 13 + FMA3). - Regression Suites:
fog_parity3/3 PASS,march_maze4/4 PASS (500/500,p95 = 1.145 ms),sim_core --lib621 passed / exact 22 pre-existing baseline failures (0new), Clippy exact 68 pre-existing diagnostics (0new).
Wipeout 30k Progression (Baseline → Wave 13)
| Checkpoint | Commit | 448t Mean / p99 / Max (ms) | 2,240t Mean / p99 (ms) | Dispatch (t=1) | Key Milestone |
|---|---|---|---|---|---|
| Baseline | 58f205dc8 | 602.2 / 693.4 / 15,016.8 | — | 285.4 ms | Frozen Wipeout v2.1 course |
| Wave 1–3 | 8c3803a40 | 52.7 / 65.3 / 90.1 | — | 85.2 ms | 11.4× faster mean, 167× lower max |
| Wave 4 | 61f5b2d08 | 37.8 / 49.3 / 79.6 | — | 79.6 ms | First 448t mean pass; exposed mid-run stall-repath storm |
| Wave 5 | 1c53cd480 | 38.9 / 50.4 / 66.2 | 45.0 / 57.0 | 66.2 ms | General 2×2 congestion CrowdField (3× S2 flow, 24× less stall) |
| Wave 8 | 3fb89c278 | 35.0 / 44.1 / 51.9 | 41.4 / 49.6 | 51.9 ms | First 448t p99 pass & first 2,240t mean pass |
| Wave 10 | 23073ee0b | 34.9 / 43.2 / 44.2 | 40.95 / 48.71 | 41.4 ms | First 0/448 over budget; boulder crowd escape + court-spread handoff |
| Wave 11 | 326598501 | 33.4 / 39.7 / 42.9 | 39.83 / 46.86 | 37.0 ms | First sub-40ms 2,240t; full 65k run cleared S1–S7 (29,928/30,000 arrived) |
| Wave 12 (code) | 47718b263 | 32.7 / 41.1 / 48.3 | 38.92 / 45.52 | 36.1 ms | Unified resubscribe_from/past_exit + coalesced aura refreshes |
| Wave 12b (+FMA3) | c9b76a15a | 30.2 / 37.1 / 41.2 | 35.51 / 41.48 | 36.1 ms | Hardware FMA3 (0/2,240 over budget, max 41.96 ms, bit-identical) |
| Wave 13 | 1a75a3086 | 30.2 / 36.8 / 40.1 | 35.53 / 41.83 | 35.6 ms | Full 60k run: 32.25 mean / 43.97 p99 (1.36× real-time), 29,998/30,000 settled |
Clash 30k Progression (15,000 Anfald vs 15,000 Despotate, 448 ticks)
| Checkpoint | Commit | Mean / p50 / p95 / p99 (ms) | Max (ms) | Dispatch (t=1) | Over Budget | Key Win |
|---|---|---|---|---|---|---|
| Baseline | 436928608 | 125.5 / 117.2 / 157.5 / 210.9 | 3,496.7 | 163.9 ms | 448 / 448 | Pulse-3 donor-claim freeze |
| Wave 6 | 60969f9ed | 64.8 / 65.2 / 77.5 / 84.0 | 109.0 | 109.0 ms | 448 / 448 | Spatial donor claims (3,497 → 109 ms), fast combat flush |
| Wave 8 | 3fb89c278 | 51.9 / 52.6 / 59.9 / 65.1 | 73.5 | 73.5 ms | ~390 / 448 | 16B ProjBody, parallel autocast, dispel batching |
| Wave 10 | 23073ee0b | 46.1 / 46.9 / 53.3 / 55.3 | 63.7 | 63.7 ms | ~290 / 448 | Scalar scan preferences, narrow autocast |
| Wave 11 | 326598501 | 42.9 / 43.3 / 49.7 / 51.3 | 52.9 | 41.1 ms | 165 / 448 | First mean & dispatch pass; straight leaders, concurrent route fields, Voronoi donors |
| Wave 12 (code) | 47718b263 | 41.2 / 41.4 / 47.6 / 49.1 | 50.9 | 41.0 ms | 103 / 448 | Coalesced aura refreshes, faction-pruned transients/weapons, incremental packed spatial |
| Wave 12b (+FMA3) | c9b76a15a | 39.3 / 39.7 / 44.8 / 46.5 | 50.5 | 39.6 ms | 26 / 448 | Hardware FMA3 (-3.8 to -4.6 ms movement, 0 fmaf symbols) |
| Wave 13 | 1a75a3086 | 37.1 / 37.4 / 42.3 / 43.6 | 43.8 | 39.5 ms | 0 / 448 | Batched Thrallmaster rank-switch & lone Warmth auras (behaviors p95 6.12 → 4.29 ms), pruned snapshot logistics scans (publish 2.30 → 1.69 ms), deduped settling stamps |
Visual Verification (1a75a3086)
Open Decisions & Known Rough Edges
- Final 2 of 30,000 Wipeout units (
decisions.mdcall): Wave 12’sresubscribe_from/past_exitfix unblocked 70 of the 72 Wave 11 vestibule stragglers (29,928 → 29,998). The remaining 2 sit pressed against already-settled teammates at the west lip of the North S8 court because an existing arrival invariant forbids settling aMoveunit outside its own ~25 px slot neighborhood. - Hardware FMA3 build flag (
c9b76a15a): Eliminated all softwarecompiler_builtins::fmaf()calls across ~488f32::mul_addsites (1,113 hardwarevfmaddinstructions, 100% bit-identical to softwarefmafand ARM64fmadd, requires Haswell 2013 / Zen 1 2017+). - Clash 30k overlap census: Wave 12 proved the remaining severe overlaps came from exact-landing
Dark Lunge/Port-stabteleports and Brute charges rather than movement optimizations (0/1,787hostile att=448). - Single
40.11 pxmid-run Wipeout sample:52/53samples in the 60k run had0solid severe pairs;t=25,760had 1 pair0.11 pxover the40.0 pxbar.
Now, I didn’t just use this as-is. I had to test it for gamefeel because very little AI is good as is. It did end up needing to be nudged in a few ways, but if you embrace the fact that some tweaks will need to be made, it gets a lot less frustrating.
Most of my tweaks ended up to do with making movement LOOK good, like a formation marching, and less like a bunch of little robots finding the best path from A to B. I think I’m, like, 3 or 4 tweaks in since that point, each one or two prompts (find cause and brainstorm with council; pick best option and implement with council). Not too shabby! And then I ran the hillclimb against 50k just to be safe and it also worked.
So that’s how I used performance hillclimbing to make Null Crusade run good, even on my overloaded old macbook. I wonder if AAA studios could’ve also said “take our biggest level and make it run at 60fps on a console make no mistakes”
If you have some spare weekly tokens to burn, consider getting your agents to climb a hill important to you.
What’s next in this series
But what about making it look pretty?
Legacy Engine Post-Hillclimb Terrain And what about making your working environment not totally wasteful to your agents?
Media slot pending: Delivery time vs. shipped code graph (teaser for the multi-worktree / remote dev-box write-up).
Built for Null Crusade
Follow the game — join the waitlist
These write-ups are from building Null Crusade — a single-player fantasy RTS with battles of thousands of units and a full story campaign. The Steam page is in Valve review; leave your email and I will let you know the day it opens.
No spam — only Null Crusade milestones, and one click to leave. Or hang out in the Discord.