README

Better bots – one matrix at a time

Drekken

July 23rd 2025

Why hello Reader,

If you gave your bot 30 workers, 10 jobs, and 1 second to decide, what would it do? How does it know which unit to send where?

We’re deep into ProBots season, and this is when I like to scan the field for ideas worth stealing. One bot caught my eye and its approach to this core optimization problem is too good not to share.

🔁 In Case You Missed It

video preview

Coming up in ProBots, last day before we get into the Round of 8. There are some heavy hitters in these decider matches.

  • SharpenedEdge vs Caninana
  • Zozo vs TyrT
  • BenBotBC vs Aeolus
  • Ketroc vs GPT

I’d keep an eye on BenBotBC — their constant updates and containment strategies reveal a lot about how to trip up stronger bots.

Caninana’s rapid improvements over mu make for a masterclass in iteration.

Phantom Bot is an open-source Zerg bot competing in this season of ProBots. Their Dijkstra Zergling movement has become a pretty defining characteristic, but what we want to zero in on is this special trait:

“Uses linear programming to assign targets for harvesters, combat units and many other tasks. Only a reward function needs to be defined, after that such assignment problems can be solved efficiently by scipy etc.”

This is a classic assignment problem, and Phantom Bot builds a cost matrix that says: “Unit i → Target j costs c[i][j] (or yields reward r[i][j]). Find the one-to-one assignment that maximizes reward or minimizes cost.” If you look into their code you’ll be able to see them using it for Queens being assigned for Hatcheries based on distance.

The beauty: Once you define the reward function, you hand the matrix to the solver and get a globally optimal set of orders instead of a bunch of greedy heuristics.

So we could be looking at

  • “Send the closest worker to the nearest patch.” → “Distribute all workers so total travel + future congestion is minimal.”
  • “Focus-fire the weakest enemy.” → “Map every combat unit to the enemy target that yields the best overall damage-per-frame vs. risk.”

Once you have your cost matrix, you can just plug it into your solver. Use something like scipy.optimize.linear_sum_assignment or highspy to get the best unit-to-task match ups.

🛠️ In the Workshop

PiGBot: Completed the enhancement to the observers system, now uses multi-observers for additional vision, including surveillance mode. Who knew this bot would become such a peeper? 👀 (VOD)

🗒️ ./run Notes:

Want to use assignment logic like Phantom? Here’s how to steal the core idea:

Step 1: Build a cost matrix

Phantom does this by measuring things like:

  • Travel distance (for workers and Queens)
  • Enemy threat (for overseers and combat units)
  • Cool-down or value (for injects or transfuses)

Each row = a unit, each column = a task, each cell = cost or reward.

Step 2: Feed it to a solver

Phantom uses highspy under the hood, but you can start simple with:
​scipy.optimize.linear_sum_assignment​
It gives you the best overall mapping of Units → Targets, not just local best guesses.

Step 3: Replace your greedy logic

Instead of:
“Send the closest Queen to the nearest Hatchery”
do what Phantom does:
“Assign all Queens to Hatcheries so total travel is minimized and no target gets double-booked.”

Same for drones. Same for stalkers. Same for any unit with targets.

P.S as I was writing this I was thinking that this might make a good episode of Bits of Code, even though its about optimi. Your thoughts?

Community Wisdom

Email Preference:
Unsubscribe | Update your profile | 113 Cherry St #92768, Seattle, WA 98104-2205