archive by month
Skip to content

chokes and regions

BWTA provides 2 main features that Steamhammer relies on. Other features are minor and easy to replace. 1. It figures out where the bases are on the map. I’m implementing this myself right now (I have the basics written, but it doesn’t work right yet). This accounts for most uses of BWTA in the code. 2. It figures out regions and chokepoints between them. Steamhammer uses both, though not for many purposes. Later, when the bot starts doing tactical analysis, the feature will become critical. I’m always thinking ahead, so today I’m pondering how to implement regions and chokes.

The usual way of breaking the map into meaningful regions is to first identify chokes. A choke is meaningful in itself, because it is easier to defend than open ground where the enemy can come at you from every direction. Then a region is defined as a walkable area which is connected to other regions only by chokes. You end up with a graph of regions that you can use for pathfinding (as BWEM does), for recognizing threats (“there’s an enemy in my base region!”), for planning tactics (like MaasCraft), and no doubt more.

So we earn a high return if we know what a choke is. But what is a choke? Suppose we think of a choke first as a more defensible narrowing of the terrain. If you have a large army, then even a slight narrowing of the terrain makes an area more defensible. In the early game when you have only a few units, a wide choke is hardly different from open ground. If the potential choke is a ramp, then being on the high ground side makes it more defensible no matter what, while being on the low ground is sometimes worse than standing on open terrain. The defensibility of a choke is valuable information, and defining regions in terms of their defensibility seems useful, but it is also slippery. Defensibility depends on context.

Bots that are too rigid in defining a choke make characteristic mistakes. For example, on Andromeda many bots recognize a choke between the main base and the in-base mineral-only. The terrain is a little narrower there.

a main base and mineral only on Andromeda

Bots that want to defend at the first choke and recognize the first choke as being between the main and mineral-only will misplace their defenders. Zia does this when in the upper left start position, as one example. It’s better to defend at the ramp, which is nearly as close, much narrower, and offers high ground to the defender.

Any rigid definition “this narrow or narrower and it is a choke” will cause this kind of mistake on some maps, or else the opposite kind where the bot fails to recognize a good defensive location. Of course you can tweak it so it works well on a given set of maps, like the SSCAIT maps. To completely solve it, you want to do a topological analysis of the map to find single points of defense, which is easy if you have the graph of regions. To guard the main on Andromeda, there are 3 single points of defense: The wide choke between the main and mineral-only, the ramp, and the outer choke between the gas natural and the rest of the map. Defending any one of those spots protects the main from ground attack. Of the 3, the ramp offers by far the best defensive location, which you might recognize by a score including the width, whether you hold a ramp down from high ground, and maybe closeness to the defended area or to production buildings. Of course if you want to guard both the main and the gas natural, there is only the outer choke.

For Steamhammer, I definitely want to be able to score every choke that the bot might care about during the game, whether I use it to divide regions or not. I’m thinking of scoring every tile on the map for width-between-walls, the length of the shortest bar you can place that blocks a path. I see a simple algorithm that I think is likely suitable. With that, you can decide “is this a good place to siege up, or will it block my other units?” With that and a knowledge of ramps, it should be possible to score any place on the map for “is this a good spot to make a stand?”

I haven’t decided what to do about regions. If I think of good uses, I might go with multiple sets of regions using different definitions of chokes. For example, I can imagine it might be useful to change the regions used for tactical analysis during the game. “I have a lot of tanks now, might as well treat this whole area as one big choke.”

Trackbacks

No Trackbacks

Comments

Antiga / Iruian on :

What about having 3 "flags'?. One for the pixel width of the natural choke, One for the width of the natural choke and one for low, high and reversed mains. That then the bot author could tune strategy selection based on these features.

I'd like someday a flag to tune strategy selected certain strategies based on these features, or the ability to manually turn off / on strategies on a map by map basis.

For humans generally they take a look at the map at the start then cross off the strategies that are weak below certain threshold cutoffs , and then select from the remainder.

Luna is a great example of this. It drastically increases the strength of some openings especially goons due to the reverse low ground main / high ground natural.

Jay Scott on :

Map analysis is definitely something I want to get into. Eventually, Steamhammer should be able to play on any map that’s not too crazy (Outsider and Gold Rush but not Crystallis), and it should be able to find good strategies and tactics. That has to happen by machine learning. Your suggestion is a good idea, though. There can be an intermediate stage which allows hand-tuning to important map features.

Jay Scott on :

I suggest tile width of the main choke, tile width of the natural choke, and main-to-natural is level/up-ramp/down-ramp. Does that cover what you want? I don’t want to implement choke widths until I get that far, but the ramp flag is easier. The question is, how should it be represented in the configuration file? Map size is represented with the “Weight2” values and so on. It doesn’t make sense to have both “Weight2” and “WeightUpRamp” options—unless we figure out what it means if you specify both. Do you have a suggestion?

Antiga / Iruian on :

Tile width of the main choke, Tile width of the natural choke, and main-to-natural is level/up-ramp/down-ramp. Definitely covers it I think!

Hmm thinking about it. What about something like:

twmc (tile width main choke)
twnc (tile width of natural choke)

mainheight 1 (low main), 2 (high main), 3 (low main w/ high nat)

What if for a strategy selection for a value it looked like with the flags being optional:

Something like? :

{ "Weight" : 20, "Strategy" : "10-15GateGoon", "Twmc" : 30, "Twnc" : 50, "MainHeight" : 1,2,3}

Jay Scott on :

So “Twmc” means what exactly in your suggestion? The main choke must be no more than this wide, or the strategy is rejected (because the opening is dangerously wide)? And each flag given is an independent way to reject a strategy? I’m sure you don’t mean 30 tiles: That is 30*32 = 960 pixels. Buildings are placed by tiles, which is why tiles seem like the right measure to me.

Antiga / Iruian on :

Yup, essentially using the tile widths as cutoffs for selection for the main / natural width. So if wider than whatever selected that specific strategy is disallowed for selection. Either by tiles or by pixels would be fine to use I think.

jtolmar on :

What if the last applicable weight in the list wins? So if I want to 9pool more on 2-player maps, constantly if the choke is too wide for a forge fast expand, and never on 4-player maps, then I'd say something like { "Weight" : 20, "Strategy" : "9Pool", "Weight2": 30, "WeightNatChoke8+" : 90, "Weight4": 0}

Simon Prins on :

One of the things I would really love to implement for my bot (if I ever find the time) is the Explicit Corridor Map (ECM). It is a structure that can be used for pathfinding. It has been invented by someone at Utrecht University where I studied and there is a lot of research being done for it there.

It creates a graph of walkable regions, similar to what you describe. One of the features of the graph is that you know at every point along the way how wide the corridor is. This could be great for finding chokes/ defensible regions as well.

Jay Scott on :

If anybody wants to read about it: http://www.staff.science.uu.nl/~gerae101/pdf/ecm.pdf

MicroDK on :

Why do you want to get rid of map analysis libraries and do it yourself? Someone did all the hard work for you and made these nice map libraries for you (BWTA / BWEM). Adding scores or flags to choke points seems to be a good idea though. :)

Jay Scott on :

The short answer is that they don’t do what I want. I wrote about it: http://satirist.org/ai/starcraft/blog/archives/311-map-analysis-plans.html

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.