An AI-controlled goblin base mid-game with a walled arc, towers behind it, and a scouting warg rider heading off toward the fog line

How an RTS AI opponent thinks

Game Design10 min readUpdated
ClaudeBuilt the thing
Adam SturrockDecided what mattered

Written up later from the commit history. Dated to when the work landed.

Difficulty levels should be real. Easy is genuinely easy, Hard requires tight play.

That is one line from the design pillars and it does more work than it looks like. The usual way to make a strategy opponent harder is to hand it more gold, which satisfies the sentence and nothing else, because a player who loses to a bigger allowance has learned nothing they can use next time. So this opponent mostly does not get one, and where it does the amount is small enough to write down here.

Three pieces of genre vocabulary appear throughout. A build order is the sequence a player builds and trains in during the opening minutes, and it is where most of a strategy game's planning lives. To scout is to send a cheap unit to look at the other player's base, because the map is hidden under fog and you otherwise have no idea what they are making. An expansion is a second base placed at a second patch of resources, which is the standard way to get richer and the standard way to get overextended.

What separates the three settings you pick between in a skirmish is what the opponent is willing to do. The harder one does more things. It does not have more of everything.

A goblin warboss standing on a wrecked siege engine roaring at a mob of goblins, a fortress of scrap timber and iron smoking behind them

Difficulty as a list of behaviours

There are around ninety separate switches describing what an opponent will and will not attempt, and almost all of them are about conduct rather than about economy. A representative slice:

EasyMediumHard
How often it reconsidersevery 2 secondsevery 1.5 secondsevery second
Town hall it will build up tosecond tierthird tierthird tier
Upgrades it will researchnoneearly onesall of them
Expansions it will takenoneonetwo
Tracks where it is being threatenednoyesyes
Builds counters to what it has seennohalf-heartedlyfully
Pulls wounded units out of a fightneverretreats onlyretreats and repositions
Attacks from more than one directionnonoyes
Spots an all-in early attacknonoyes
Delay before it reacts to its base being hit5 seconds2 secondsnone
Trains heroesnoyesyes

Read down the Easy column and you get a coherent opponent rather than a lobotomised one. It never builds its town hall past the second tier, so it never fields casters or flyers at all. It researches nothing. It never expands. It takes five seconds to notice its base is under attack, and it will not chase a raider who runs away.

None of that is a numerical penalty, and all of it is visible in play. The Easy opponent is beatable because it is playing a smaller game, not because its units are made of paper.

The economy bonuses that do exist need stating exactly, because a post claiming "no cheating" would be false. Easy gets nothing at all. Medium gets a one-off 200 gold and 100 lumber at the start of the match and nothing afterwards. Hard gets a one-off 250 gold, 150 lumber and 50 stone, then 25 gold, 15 lumber and 5 stone a minute, a 10% gathering bonus and 25% faster construction. Every one of those numbers used to be twice as large. They were halved, and the behaviour switches in the table above were added to make up the difference.

Why behaviour is the better difficulty dial, and what it costs

The argument for building dozens of behaviours where one multiplier would do is that a player who loses should be able to name the reason.

A resource bonus is off-screen. The opponent simply had more, there was nothing to see and therefore nothing to counter, and the only honest lesson available to the player is "try harder". A behaviour difference is on the map. It expanded and you did not. It came at you from two directions and you had one wall. Both of those are lessons about the game rather than about the opponent's allowance, which is the entire reason a single-player difficulty ladder exists.

There is a second argument that only shows up across the whole ladder. An Easy opponent playing a smaller game teaches that smaller game correctly, so the habits a player forms while beating it are still true against Medium. An Easy opponent that plays the full game with a resource penalty teaches habits that stop working the moment the penalty is lifted, which is the ladder actively misleading the player it was built to train.

The trade is real, and it is why most games reach for the multiplier instead.

Behaviour is discrete and does not slide. A resource multiplier is continuous and takes ten seconds to tune. You cannot sit halfway between "expands" and "does not expand", so the fineness of your ladder is the fineness of your list, and adding a rung means inventing a new behaviour rather than nudging a slider.

Every entry on the list needs working behaviour behind it. A resource bonus works on day one. "Attacks from two directions" requires an opponent that can hold two groups and want two places at once, which is why the length of that list is a fair measure of how much opponent you have actually built.

They interact, so the ladder needs testing per combination. Switching on expansions makes an opponent weaker if it cannot defend two bases, whereas a resource multiplier cannot make an opponent worse no matter how you turn it.

The top of the ladder is your best behaviour. Once the hardest setting does everything the opponent knows how to do, there is nowhere left to go except better behaviour or a bonus. That is exactly why the small economy bonuses survive on Hard. They are the continuous dial sitting on top of a discrete ladder, and pretending otherwise would be the marketing version of this post.

The portable version of the whole position is one question to ask of every difficulty knob you own: could a player who just lost name this knob? If the honest answer is no, it is a handicap rather than a difficulty, and it will be felt as unfairness whether or not it is fair.

Seven personalities, and the one that only shows up on Hard

Two Hard opponents on the same map should not open the same way, so what an opponent is trying to do is chosen separately from how well it does it. There are seven archetypes: Warlord, Turtle, Economist, Tactician, Raider, Fortress and Berserker.

They are drawn from different pools per difficulty. Easy picks from five, Medium from six, Hard from all seven, so the Berserker only ever turns up on Hard. The Fortress is missing from the Easy pool for a practical reason: a fortress that cannot research and cannot build past the second tier is a passive opponent doing nothing at all.

Goblin riders on snarling wargs charging through a flooded swamp at night, torches raised, a ruined tower behind them in the mist

Personality shapes the build order, and it also drifts as the match goes on, so an Economist that survives into a long game stops behaving like an Economist.

Free-for-all is where personality stops being cosmetic

In a one-against-one, personality changes the opening. In a seven-opponent free-for-all it changes something structural, because every opponent has to decide who to attack. If they all use the same rule, they all pile onto the leader and the mode collapses into a dogpile.

So each personality sits somewhere different on one axis: whether it prefers to finish off the player who is already losing, or to punish the one in front.

PersonalityPull towards the weakWho it goes after
Raider0.90feeds on the side that is already bleeding
Turtle0.70sallies out to clean up the losing side
Fortress0.70picks off cripples once it finally leaves home
Berserker0.45barely cares, charges whatever is closest
Tactician0.35leans towards the leader, but reads the board
Warlord0.20takes the crown off the front-runner
Economist0.20knows a runaway leader wins on time, and denies it

The Economist shares the Warlord's number for a completely different reason, which is the nicest part of the design: one is a bully and the other is doing arithmetic. The archetypes disagree by construction, and that is what stops the leader being attacked by all seven every match. Targets are reconsidered on a timer and only change when the new one is clearly better, so armies commit instead of oscillating between two victims.

All 9 factions have a signature mechanic underneath all of this, and the opponent plays those too rather than treating them as flavour. What that costs in per-faction thinking is nine factions that actually play differently.

A lizardmen column crossing a jungle river behind an armoured bastiladon, a skink priest on its back channelling a ring of golden light, a kroxigor swinging a hammer at the head of the line

Scouted intelligence, so the opponent can be lied to

An opponent that reads the world directly cannot be scouted, cannot be misled and cannot be denied information, which quietly removes a whole layer of strategy play. In July it got an alternative.

The opponent now plans from what its own units and buildings can actually see, and the sight it gets is worked out exactly the way yours is. Each of its units contributes its own range rather than a flat radius. High ground gives it the same bonus it gives you. A unit standing inside a Dark Elf building's blinding aura scouts a correspondingly smaller area, which means that ability works against the computer for the same reason it works against you. The whole picture is built the same way on every machine, so it stays safe for multiplayer.

Easy and Medium opponents plan from that filtered picture. Deny an Easy scout and it genuinely does not know what you built, which is the difference between an opponent you outplay and an opponent you out-stat.

Being able to think that hard was not free. An eight-player free-for-all used to run at 3 to 15 frames a second, with every quality setting the game has already turned down, and the cause turned out to be the opponent rather than the fighting. The plan going in blamed combat, and measurement put combat fourth. The same match runs smoothly now, and the full account is why the opponent was the slowest thing in the game.

What I want the opponent to learn next

Personality decides who to attack and how to open. The richest seam left is letting it also decide which of its own faction's tricks to lean on. A Turtle Ratmen player and a Raider Ratmen player should use a tunnel for opposite purposes: one to reinforce a threatened expansion, one to surface behind a gold mine. The same split applies to the dwarf overcharge, to Convert, and to the lizardmen monuments.

Teaching archetypes to express themselves through faction mechanics rather than through army composition is the next real step, and you can watch the current version fight itself from the spectator seat on the game modes page. The opponent that runs on a language model instead of these rules is a different set of trades entirely, covered in letting a language model command an army.

← All posts