September 8, 2026

Building a StarCraft II Bot with My Agents

We started with an opening I play on the ladder. We ended up with bots for all three races.

I play StarCraft II, and I wanted to see whether my agents could help me build a bot that played it too. I had an opening in mind because it was one I used myself: scout the opponent, try a cannon rush, then move into Void Rays and attack once I had a few of them. It seemed like a good place to start. I could explain what I wanted, and I would know whether it was doing it when I watched a game.

I gave that description to Claude Code. By that afternoon, we had a bot playing StarCraft.

It wasn’t playing particularly well yet. The early version could get through parts of the opening and then leave itself with no army while it waited for units it couldn’t afford to build. Watching that happen was still pretty exciting. We had gone from talking about an idea to having something I could put into a match and watch. Now I could start giving it useful feedback.

Over the following weeks, that little Protoss experiment grew into three bots, one for each race, that could beat the game’s Elite AI. I never needed to read the code. I spent my time watching games, talking through what I saw, and deciding what we should try next.

Starting with a game I knew

Having played the game made this a fun project to work on with agents. I didn’t need a report to tell me that we were sitting on too much money or that an army should have attacked. I could see it happening. Explaining why something looked wrong was usually enough to give the agents a place to start investigating.

Our first strategy didn’t last long. Within a couple of days, we moved away from the cannon rush toward a more conventional opening that gave the bot room to build an economy and a proper army. The original idea had done its job: it got us into the game, and it gave us something concrete to improve.

I also wanted the agents to look beyond what I happened to know. I’d watched people explain other bots and had a rough sense of what was possible, but I hadn’t studied how they worked. So I asked the agents to do that research and bring useful ideas back into our project.

That led to work on estimating the opponent’s economy and remembering units we’d seen earlier in the game. Those are things you do almost without thinking when you play. If you scout an army and then lose sight of it, you don’t assume it has disappeared. We needed the bot to develop that same basic sense of what might be waiting for it.

We built on an existing StarCraft bot framework, ares-sc2, which already handled a lot of the mechanics. That let us spend more of our effort on how our bot should play. I could keep asking for behavior I understood as a player while the agents worked out how to make it happen.

Watching our bot learn to play

The routine became fairly comfortable. We’d discuss a change, the agents would implement it and run matches, and I’d watch replays when we had something interesting to look at. Sometimes that meant a loss. Sometimes it was a win that had taken much longer than it should have.

WarpgateWillie vs. Elite Terran on Magannatha. About 7.5× speed.

One of the most useful things we did was have the bot play against itself. Our first mirror match ran for twenty-seven minutes. Both sides kept fighting, but neither managed to reach the other’s base.

Watching two copies of our own work get stuck against each other made the problems easier to recognize. Some units were dancing around the edge of fights. A worker attack kept taking more workers until it had ruined its own economy. The army would start advancing, lose track of what it was chasing, and change its mind.

I could point to those moments and explain what I expected the bot to do instead. Then we’d work through them with the agents and run it again. The built-in opponent hadn’t exposed those behaviors nearly as clearly, so self-play became another useful way to see how far we’d come.

There were also games where the bot looked much too nervous. I’d be watching an army that ought to have been able to push, and it would stay home. We eventually found that its estimate of the enemy army was too high. It thought the opponent had far more units than were actually there.

To help investigate that, the agents built a way to compare what the bot believed during a match with what the replay showed afterward. I didn’t have to work through the logging code. I could ask why it was refusing a fight, and we had a way to answer with more than a guess. That was a useful addition to the project, and it came directly out of watching it play.

Getting from good fights to wins

As the bot improved, some of our most frustrating results were draws. We’d take the opponent’s main base, destroy most of its army, and then somehow run out of time.

From a player’s perspective, those games were already won. We just weren’t finishing them. The bot would hold its army around a base it had cleared while an enemy building survived elsewhere on the map. Once I pointed that out, we gave it a way to search the map and clean up what was left. It was satisfying to watch those games finally end the way they should have.

WarpgateWillie vs. Elite Terran on Incorporeal. About 8× speed.

We also made actual matches part of accepting changes. A passing code test couldn’t tell us whether the bot had become a better StarCraft player, so we required consecutive wins against the Elite AI, facing each opposing race on rotating maps. Elite is the strongest of the built-in opponents that doesn’t get cheating advantages.

That gave us something concrete to work toward. The agents could run the games while I did other things, and we’d come back to results and replays. When a change helped, we kept it. When it made the bot worse, we had a reason to back it out, even if the idea had sounded good when we discussed it.

Not every session ended with an improvement. We had one long stretch where successive changes kept making the results worse. Most of that work got reverted. The change that finally helped was getting the scouts to stick to their assignments instead of constantly choosing new destinations. My direction was pretty simple: make a decision and stop changing your mind every moment.

Those sessions were part of building it, but they weren’t the whole experience. More often, I was coming back to a bot that could do something it couldn’t do before. It was spending its resources better, committing to fights, or finishing off an opponent. The progress was visible on the screen.

Then we built the other two races

Once we had a working foundation, I wanted to see how much of it we could use for Zerg and Terran. Each race has its own economy and production rules, but a lot of what we’d already worked through still applied. We had ways to scout, move an army, choose fights, and close out a game.

Our Zerg bot went nine wins without a loss on its first full acceptance run. That was an early milestone, not its record forever, but it was a good moment in the project. All the time we’d spent getting the first bot to behave was paying off in the second one. We could concentrate on the parts that made Zerg different instead of starting over.

BanelingBarry in a Zerg mirror on Incorporeal. About 7.5× speed.

We ended up with WarpgateWillie for Protoss, BanelingBarry for Zerg, and SiegeSarge for Terran. All three could beat the Elite AI. Each had its own race-specific work behind it, and all three shared improvements we’d made along the way.

BanelingBarry vs. Elite Protoss on Torches. About 8× speed.

I’m pleased with what we built. I started with a strategy I knew how to play and a curiosity about whether we could turn it into a bot. The agents handled the research, programming, and repeated matches. I brought the game knowledge, watched what we’d made, and helped steer it toward the next improvement. That was enough to take the project a long way.

There’s still plenty we could do, and we haven’t tested it on the competitive bot ladder. I’d enjoy coming back to that. For now, I can load up a match and watch one of our bots play a game I’ve spent years playing myself. Building that with the agents was a lot of fun.

Building a StarCraft II Bot with My Agents
0:00
0:00