“Make sure you don’t get into a situation where you have a bad economy and you can’t macro.”
– Day[9]
You can’t micro your way out of a bad economy. When human players are deciding to expand, they’re basically weighing three questions:
Do I have enough income for the army I want?
Idle production time is a clear signal bot.state.score.idle_production_time tells you the total time any structure capable of producing a unit is sitting idle. Long idle times mean your bot doesn’t have the resources to spend effectively.
Am I running out of available resources?
A quick and dirty way to check is comparing workers to mineral patches. Once you’ve got more than two workers per patch, it usually means some are just waiting around instead of mining. Next, count the fields in range of your base with bot.mineral_field.closer_than(10, townhall) (rule of thumb: 8 at a regular, 6 at a gold). Then check how much is left with .mineral_contents (each field starts at 1500). Repeat the same for gas.
If you want to go deeper, track the collection rate (bot.state.score.collection_rate_minerals + bot.state.score.collection_rate_vespene). A shrinking slope in that curve is your early warning sign that income is about to decline.
Is it safe to expand?
Knowing if it’s safe to expand means your bot needs situational awareness. Start with a simple count: how many bases do you control versus what’s available on the map? Next, look at vision, how much of the map your bot can see. Finally, compare army strength. A combat simulator or checking the enemy’s army value will tell you if you’re ahead enough to defend a new base.