archive by month
Skip to content

mining gas at full efficiency

How many workers does it take to mine a gas geyser at full efficiency? All bots that I’ve seen, including Steamhammer, assume that the answer is 3. In reality, it depends on the relative positions of the geyser and the resource depot (the command center, nexus, or hatchery that you return resources to). In some base layouts, you only get full gas income with 4 workers. On a professional map, like all the SSCAIT maps, the main bases are designed to mine gas at full efficiency with 3 workers. But expansions may be different. On original Blizzard maps distributed with the game, anything goes.

Also, exceptional situations can come up. It’s fairly common for bots to manner their own gas (meaning partially block it so that workers go around the obstacle). In that case you need more workers to maintain income, unless you’re smart enough to remove the obstacle. If a spider mine is blocking a base position, Krasi0 may offset the command center instead of clearing the mine. There are other reasons to offset a resource depot; maybe you’re trying to hide a base that the enemy won’t scout. If the primary hatchery at a base is destroyed but zerg has another hatchery at the same base, mining can continue. Or you might just be long-distance mining the gas.

How is a bot to judge the number of workers? The details are complicated.

Precompute it. One way is to make a table of relative positions. Go through all the maps and find the relative positions of the gas geysers and the resource depot for each base. On pro maps, I think the total set of relative positions is not large. Or enumerate all the relative positions up to some short distance. For each possible relative position, measure the number of workers needed to fully mine the gas. At runtime, the bot can look up the number of workers to assign in the table. Maybe you can find a rule, or a rule and a small set of exceptions, to make it more compact. It should be simple and fast at runtime, but it’s rigid and it doesn’t account for exceptional situations.

Figure it out on the fly. Assign 3 workers at first. Once they’ve settled into the task, check the geyser to see whether it is idle. I haven’t looked into the details, but the check is something like: There is no worker inside and it’s not in a latency period with a worker entering or leaving. If the geyser has idle time, or has idle time above some limit, assign another worker (at least if you need the gas income). This doesn’t have the advantage of instantly doing the right thing in known cases, but it does adapt to exceptional situations.

Human players do both, of course: They know what common positions need extra workers, and they notice unusual situations that also call for more workers. For Steamhammer, I think I will eventually add the on-the-fly method. It’s not high on my list, though.

I don’t know of any bots that are smart about the number of workers needed to mine gas, but maybe there are some. AILien, for example, will use fewer workers to mine if it is short of workers, but I’ve never known it to add above 3. Can anybody enlighten me?

Trackbacks

No Trackbacks

Comments

LetaBot on :

IIRC it has to do with pathing. If you use the same algorithm I use for the mineral gathering path improvement on the gas geysers that normally need 4, you can get it down to only needing 3 again. My bot however already uses too much apm, so I didn't include it in LetaBot yet.

Jay Scott on :

Hmm, that’s interesting.... If so, then with mineral locking (even without path smoothing) plus path smoothing for gas, you know ahead of time exactly how many workers you need to run an expansion at full efficiency. Long-term macro planning becomes simpler.

MicroDK on :

How big is the different on using 3 workers where you might need 4?

Jay Scott on :

Not that big by measurement, but it is enough to delay a gas-intensive build order. The effect depends on how much you need the gas.

Jay Scott on :

According to a Team Liquid post, the difference is a drop from 300 gas per minute down to 280 gas per minute—not that large. In practice, you have to ask: Is the current build mineral limited, or gas limited? If gas limited, the extra worker is worth it.

MicroDK on :

Yah, the extra 20 gas could be important... :)

Antiga / Iruian on :

A key part that seems to be missing in my eyes is using building placement to improve gas mining pathing. Almost all professional human players use a supply Depot, core or pool for a 5% bonus roughly to gas mining speed. How much this affects bots is really hard to say. Humans generally use 3 but if the gas is to the left of the CC they are likely past the early game to use 4.

Jay Scott on :

That is an excellent point. Buildings can do path smoothing for free in some cases, including common cases. Pathing is complicated and bots don’t understand it. They most often place buildings where they get in the way instead of helping—I saw a game yesterday where an academy at the right of the refinery caused every 3rd or 4th worker coming out of the gas to take a long path around. Making workers spawn closer to the minerals is another common thing humans do.

Xilmi on :

AILien won't use more than 3 workers ever. It computes a gas:mineral-worker ratio based on it's gas-bank and total worker-count though.

I made some modifications to that after the start of the tournament to allow for some low-gas all-ins.

krasi0 on :

I should finally get rid of that simple workaround (offsetting of the resource depot) and implement a proper solution :)

Jay Scott on :

You could start the command center offset, clear the mine at your leisure, then lift the command center into place. It might be clever to start the command center just outside the mine’s vision range....

Ankmairdor on :

Gas always takes exactly 37 frames to harvest, unlike minerals. Record the round trip time (in frames)of the first regular(ie. end to end) harvest at a geyser and divide by 37 to get a pretty good estimate for the number of workers. While there are lots of pathfinding variables/randomness, especially with adding more workers, which will slightly alter the timing this result should be at least 95% accurate so long as a building doesn't later alter the route. The advantage is that this method is extremely cpu efficient. The disadvantages are that you won't know the number until you try and updating the estimate with multiple workers already active is rather tricky, due to stalling for access to geyser. Although, it's possible to monitor geyser utilization instead to monitor effective efficiency in such cases.

Jay Scott on :

Thanks for the tip! It seems to me that pathing is a tricky variable. As you hint, workers don’t follow exactly the same path to and fro each visit.

Jay Scott on :

I think the natural way to get the end-to-end timing is to count frames from the first entry into the refinery to the second entry. That way you skip the initial segment where the worker is just assigned and will be moving differently, and measure the timing as early as possible.

Add Comment

E-Mail addresses will not be displayed and will only be used for E-Mail notifications.

To prevent automated Bots from commentspamming, please enter the string you see in the image below in the appropriate input box. Your comment will only be submitted if the strings match. Please ensure that your browser supports and accepts cookies, or your comment cannot be verified correctly.
CAPTCHA

Form options

Submitted comments will be subject to moderation before being displayed.