Balancing the fleet with robot battles
You can't summon twenty people to stress-test a new game mode on a Tuesday afternoon. But the naval AI now fights a real fleet action all by itself — so I let it. A headless harness runs dozens of full AI battles and prints the numbers, and the numbers found three things wrong that no amount of staring at the code would have.
The harness
It's a test you run on demand, not in CI: it builds the naval world, steps a dozen-plus full matches at simulation speed with nobody watching, and tallies what happened — team win rates, how matches end, how long each class of ship survives, how often the cap changes hands, how much of the score comes from sinking versus holding the cap, and whether the fleets even meet. No graphics, no network, just the authoritative simulation running flat out and reporting on itself.
What it found
Three problems, all invisible from the code alone:
- The battleship wasn't a battleship. It survived about as long as a cruiser despite three times the belt armor. The reason: hull health is capped on the wire, so the battleship and cruiser have the same health pool, and armor only resisted armor-piercing shells — high explosive, fire, and flooding sailed right through it. So I made the belt shed part of an HE shell's blast too. Now a destroyer's thin plating barely helps, a cruiser's middling belt helps some, and the battleship shrugs off roughly half of incoming HE — and it's now clearly the hardest hull to put under, the way it should be.
- The fleet was turning into all battleships. When a ship sank, the patrol picked the replacement's class by a counter that happened to favour the heavy hulls, so over a long match the destroyer screen quietly vanished. Now it replaces whichever class the fleet is shortest of, so the mix of destroyers, cruisers and battleships stays balanced.
- Ships were aground 10% of the time. One hull-tick in ten was spent grinding on an island — the AI's look-ahead was too short for a big, slow hull to answer its helm in time. Widening the margin and easing the throttle earlier (then crawling when a shore is right under the bow) cut that in half, and as a bonus the fleets now actually find each other 97% of the time instead of 85%.
Where it landed
After the fixes the numbers read the way a fleet action should: the win rate is even between the two sides, destroyers die fastest and battleships live longest, the capture zone changes hands constantly instead of sitting idle, and matches run a few minutes of genuine back-and-forth. The harness stays in the tree, so the next time I touch a ship's armor or a gun's reload I can run a dozen battles and see what it did before anyone else does. The best part of an AI that can fight its own war is that it can also be its own playtest.