BWAPI and information leaks
One of the goals of BWAPI is information fairness: Don’t provide information to a bot that a human player in the same situation would not have. It makes a serious attempt. BWAPI won’t tell you about an enemy unit that you do not have sight of. But it also leaks information through many channels. BWAPI is an unofficial add-on, and the game was not designed to include a programmatic interface. I think it’s difficult to design an interface that provides everything necessary and nothing extra.
Here are some of the leaks that stand out to me.
• Screen visibility. A human player sees what is in the minimap plus what is visible on the screen, which shows only a small part of the whole map. A bot does not look through a peephole, but sees everything visible at once. It makes bots easier to code, so it is a correct tradeoff for early days.
• Cloaked units. A bot cannot overlook the presence of a cloaked unit in its vision. By design, humans can easily miss seeing the blur, either by not putting the screen over it or by missing the subtle visual cue—even pros sometimes lose all their workers at a base before realizing that a dark templar has sneaked in. I don’t know how to implement this in a way that is 100% equal between humans and bots, because bots do not have the complicated perceptual apparatus. But something could be rigged up to make it approximately fair.
The same goes for other events that are easy to miss: Nuke targets marked by a tiny red dot, scans marked by an conspicuous but fleeting swirl of sparkles.
• Unit IDs. BWAPI labels enemy units so you can tell them apart. A human player sees a mass of zerglings, a bot sees a mass of zerglings each of which has a name. A human may be able to distinguish units in certain cases, by hit points or because the unit shows a visible effect like ensnare, but in general, one unit of a given type looks like any other. A non-leaking design would give fixed IDs to your own units, and for the enemy provide a bag of units distinguishable only by their properties, with temporary IDs and/or unit pointers that remain usable only while the unit remains in view. The change would add complexity.
In practice, bots use the extra information to draw inferences that a human player cannot draw. “I saw these units standing guard over that entrance—now I see them here. They are no longer guarding the entrance.” A human player might guess that, the bot knows for sure.
• Unit orders and targets. Mutalisks sweep in and notice an SCV scurrying across the terran base. Where is the SCV going? Will it construct or repair, or is it only moving? A human player has to see the SCV start to build or start to repair to be sure; a bot knows the SCV’s orders immediately. Steamhammer (like many others, no doubt) exploits the information to target SCVs that have important tasks.
When a unit wanders past in the middle of the map, a human will guess (or at least wonder) where it may be going. A bot knows where it has been ordered to go—though that may not be its ultimate destination. In a fight, a human can judge which enemy unit is targeting which friendly unit when the enemy fires, or sometimes as the enemy prepares to fire. A bot knows as soon as the order is given, or as soon as the enemy comes into sight range.
Lesson for bot authors: Tell your units to move to their destinations before handing down their orders about what to do there. You give away less information to enemy bots. Also, make long distance moves with intermediate waypoints, so that the enemy doesn’t know your ultimate destination (though mineral walking has to be an exception). Alternately, you can actively deceive the enemy by ordering a destination where the initial path is the same as the path you want, then changing the destination after that.
Information fairness is of course only one form of fairness. A computer with a programmatic connection to a computer game enjoys direct perception that humans can never match; it is intrinsically unfair in other ways too. You can get perfect fairness of a certain kind if the computer has to use a camera and robot hands, interacting with the game as intended by the game designers. But that’s no scene for students and hobbyists. I think that BWAPI is a good compromise for now between being fair and making bot coding easy. As bots become stronger, the fairness issues will loom larger—and bots are getting stronger fast. We ought to be thinking about it.
Do you have a favorite information leak that I didn’t mention?
Comments
Dan on :
There's also information from outside the game which humans incorporate but to which bots lack access in current tournament settings, such as your record, your opponent's record, and what they've done in games against other opponents. A bot can't tell whether or not their opponent knows their race or whether they entered a game as random.
Ultimately unless you've got a bot that plays by firing muscles in a human body holding a keyboard and mouse -- and perhaps even then -- there will be arguments to be made about fairness. No arrangement will satisfy everyone.
Jay Scott on :
IlIllIllIIlIlIIIll on :
(At least I think this is possible, but if it is, not ethical :))
Jay Scott on :
Ideally, unit IDs should be randomly generated. And they sure don’t look that way.
IIlIlIIllIlllIlI on :
Type | ID |
Terran_SCV | 154 |
Terran_SCV | 156 |
Terran_SCV | 158 |
Confirming the potential exploit.
From the unit ID's one can also infer how many unit the opponent has at the start (e.g. inferring if the opponent is Zerg or not if it spawned as Random).
Bwapi5 should randomize units ID's for sure
lIllIIlIlIlIIlIIl on :
Type | ID |
Terran_SCV | 154 |
Terran_SCV | 155 |
Terran_SCV | 156 |
Jay Scott on :
Jay Scott on :
Jay Scott on :
https://github.com/bwapi/bwapi/issues/799
Marian on :
Antiga / Iruian on :
Jay Scott on :
MicroDK on :
krasi0 on :
The only new finding here is the Zerg case where IDs leak information which could be addressed by Unit IDs randomizations (while still maintaining uniqueness). For now, we could add a rule to each tournament that bans such uses of Unit IDs.