When the Numbers Lied

In one of our test matches, two armies fought for 114 minutes without either side advancing. No castle took damage, no building was lost for good, and troops kept being born, marching and dying on the same stretch of ground.
No person would play until minute 114. Only a lab would get there.
Feel doesn't scale
In chapter 2, the economy added up on paper. And a game's first line of defense is someone playing it: in our two-person team, that's the one who plays everything again until they find where it breaks. One person finds a lot. But some problems only show up in match number eight hundred.
So we built a lab. The simulation runs without graphics, far faster than real time, and pits the AI against itself as many times as we want. Each match uses a fixed seed, so any strange result can be replayed exactly. And every proposed change has to survive a fresh batch of matches before it stays.
The first round, of about a thousand matches, already showed that the game was not what we thought. The castle barely mattered: matches were decided in a single giant fight between two armies at the troop cap, and everything else was a consequence. The fix was a package, not a knob: pricier entry buildings, lower kill rewards and the troop cap dropping from 110 to 90.
Matches that never end
Then the opposite problem appeared. We ran every faction matchup ten times, 1,050 matches in all:
- In 21% of them there was a stretch of ten minutes or more with no progress at all. In a typical stretch like that, 547 troops died.
- 18% reached the 30-minute limit.
- With the limit removed, 3.8% were still tied after two hours.
Before changing any number, we spent 3,880 matches finding out why. Three causes stood out. The troop cap turned into a wall: with both armies stuck at the maximum, extra gold no longer turned into pressure. Area damage only played at home: 99% of the troops killed by spell buildings died on the side of whoever built them, so whoever pushed walked out of their own umbrella and into the enemy's. And the AI didn't know how to get out of the deadlock. We also ruled out suspects: fewer than 2% of troops ever got stuck on the path, and the test map with the narrowest bottleneck was the most decisive of all.
If so many matches were going all the way to the time limit, the tiebreaker had to pick the right winner. So we replayed the timed-out matches without a limit and checked who each rule would have named:
| Tiebreaker | Picked the one who would really win |
|---|---|
| Rescues saved, when they settled it | 76% |
| Rescues, then buildings destroyed, then the front line | 68% |
| The rule we were using | 55% |
| Coin flip | 50% |
| Income alone | 44% |
The most obvious criterion, income, lost to a coin.
The reason is that rebuilding a destroyed building adds income again, so the side that's taking the beating often ends up earning more.
The soldier who walks in place
Another strange number was hidden in the fights. When two armies met, the melee troops in the back pressed against their allies' backs and walked in place. Each one went straight for the nearest enemy, usually the same one the soldier in front was already fighting, and the rule that keeps troops from overlapping pushed it back at every step.
We built a copy of the simulation where only the movement rule changes, and tested 13 rules. The failures taught us a lot. "Stop if an ally is fighting in front of you" ended the problem, but fights lasted twice as long, because nobody from the back ever arrived. What worked was the patient route: the troop picks a target that has a free attack position, plots a short path to it and, if it gets stuck, re-plans or waits.
| Time spent walking in place in combat | Before | With the patient route |
|---|---|---|
| Open ground | 26% | 5.6% |
| Narrow corridor | 35% | 6.8% |
| AI-versus-AI matches | 9.7% | 1.3% |
A rule like this makes melee much stronger. So we pitted every faction against every other, 1,050 matches with each rule, on the same seeds. Win rates stayed in the same band: 44–60% before, 42–57% after. The first run of this test used a lab with a small bug that made some matches diverge from the game, so we fixed it and ran everything again before trusting the result.
Then some troops got wings, and win rates spread out from 38–58% to 22–82%. One faction dropped 34 points, because almost all its troops could only hit the ground. Another dropped 20, because it still had no flyers at all. The fix wasn't changing numbers. It was giving each one the answer it was missing: for the first, a building that fires a barrage at flyers; for the second, a flyer of its own. In the next round, every faction went back to between 42% and 57%.
The economy that was too rich
Remember the end of chapter 2? We measured the pace of our matches against what's expected of a game in this genre. Troop production was right. The money wasn't: the game ran three and a half to four times richer than it should, and every match turned into a flood. So we tightened everything:
- A tighter start: 250 gold and 5 income from the castle, instead of 300 and 14.
- Income dies with the building. Before, a destroyed building kept paying. Now losing your base really hurts.
- A reward for building first: the first players to finish a building get a gold bonus.
Not every attempt moved forward. Walking across the arena took too long, and the first idea was to speed up the whole game clock. It worked, but it changed how fights felt and disturbed the balance we had already tuned. So we undid it and sped up only the walking: troops and workers move 1.5 times faster, and everything else stayed as it was.
Reading the original, line by line
The most basic question remained: were our numbers really the Castle Fight ones? To answer it, we read the map's script function by function, 32 for troops and 34 for buildings, and checked them against the data from a second version of the map. Of the 105 numbers we could compare, 91 matched. About 30 values that had been our own estimates got the right value.
Today every number in the game carries the mark of where it came from.
Evidence, cause, options
If this chapter has one lesson, it's the order of things. First the evidence. Then the cause. Then a list of options, each with its risks: does it keep comebacks possible? Does it punish a legitimate defense? Does it erase a faction's identity? Only then do the numbers change.
That order saved us more than once. Rewriting from scratch the way the AI chooses buildings made everything worse. A one-line change to the logic that already existed cut the matches reaching the time limit from 18.1% to 11.0% in the lab, without tipping the balance between factions.
Not everything is solved. The new economy, the AI and the larger field are in the code, but the factions still need to be recalibrated on top of them, and everything will ship together, in one version. Balance never ends. But now we know where to look.
Still, a balanced game has to be learned by someone who has never played it. And that was the next problem.
— The team





