archive by month
Skip to content

when the enemy unit is out of sight

If you have watched a game of Steamhammer versus Stone, then you have seen Steamhammer’s zerglings chase SCVs all over the map. The lings don’t seem to have the idea that they should find the enemy base and tackle the problem at its source.

if I don’t see you, you’re not there

If Stone’s base has been found, then the zergling squad actually does have orders to go to the enemy base. Why doesn’t it happen? The weakness is in micro targeting: When the squad chooses targets for each zergling to attack, it only considers visible targets. Against Stone, some SCVs are almost always visible and the base rarely is, so the zerglings become infinitely distractible and run hither and yon, chasing whatever pops into view. Eventually some zergling stumbles into the terran base and makes it visible, and then the squad is able to assign things in the base as targets.

The fix is, of course, to choose targets from a longer list that includes the enemy command center or mineral line, even if it hasn’t been scouted yet. I’ve been planning this fix for months, and it has never risen to the top of the list. Steamhammer beats Stone in the end, even if it looks silly doing it. But I can’t put it off too long, because the weakness does lose games against other opponents.

Another curious behavior you may have seen is that, if the zerglings are chasing an SCV that disappears up a ramp, they instantly lose interest and switch to chasing another target. The reason is the same: As soon as the SCV is out of sight, even for a moment, it is not a target. Steamhammer has object permanence and knows that the SCV is still there; it has a system (inherited from UAlbertaBot) which remembers the last known location of each enemy unit. But it can’t use its memory for micro targeting.

if I once saw you, you’re still there

Steamhammer does use its memory to feed the combat simulator with remembered units. If it runs into sieged tanks, it is important to remember them after we retreat out of sight range, so that we don’t immediately turn around and run back into tank fire. There is a curious flaw, though. Steamhammer uses the remembered location of an enemy unit even if it can see that location and the unit is not there! It only updates the location of a unit if it sees the unit again; seeing an empty spot where the unit used to be tells Steamhammer nothing. This is the cause of some strange retreat behavior, where the bot seems to shy away from invisible dangers.

This is, of course, also on my list to fix. I’m not sure what the fix should be. Sometimes shying away from invisible dangers is good, because the enemy units have not moved far. I may add an “it’s gone!” flag to the record for each remembered unit, if I can figure out how to update the flag efficiently (looping through every remembered unit or every visible tile each frame doesn’t feel like a good use of cycles). Then I’ll experiment. I might end up ignoring units which are gone, or using them if they’ve only been gone a short time. Or something.

For now, I added a flag to each squad “fight visible only”. If the flag is false, the squad behaves as now. If the flag is true, the squad does not include remembered enemies in the combat simulation, except enemy static defense, but only visible enemies. Setting the flag makes the squad bolder and more inquisitive; it will also run back into tank fire as soon as the tanks go out of vision. I think it’s suitable for scouting squads. The change is one of my improvements to scouting for the upcoming version.

Trackbacks

No Trackbacks

Comments

Ankmairdor on :

For checking non-visible units, why not check only a small portion of the unit records per frame?
The game only resets visible tiles when (frame count % 100 == 99), so the average exposure time should be about 50 frames if randomly revealed. So long as you perform roughly (n >> 5 + 1) checks per frame and rotate which unit records are updated, it should take no more than 32 frames to check all records. Also, the check doesn't seem that costly to me. I haven't checked but I assume something like this should work.
if (!unit->exists() && BWAPI::Broodwar->isVisible(BWAPI::TilePosition(unitRecord.position))) unitRecord.position = BWAPI::Positions::Invalid;

Jay Scott on :

Oh yeah, tiles remain visible for a while after you have passed, so you don’t have to check as often. Excellent point. The reason I am worried that it might be slow is that updating unit positions is already one of the most time-consuming things Steamhammer does. When the code is done of course I’ll benchmark it instead of trusting my intuition; maybe no speedup tricks will be needed.

Ankmairdor on :

It's been a long time, but recently I found out that my statement "The game only resets visible tiles when (frame count % 100 == 99)", wasn't entirely correct. When a medic's optical flare blinds a unit it changes the tile update timer to 1, which results in an update on the second frame after blinding. Not only does this mean that the update interval can change, but potentially it could be used while attacking from a cliff to refresh fog of war at any time. For instance a bot could limit return fire against siege tanks on a cliff to only 1 or 2 frames, though at the cost of medic mana.

Jay Scott on :

Wow, that’s an obscure one! So it works no matter what unit you blind? You could blind a neutral unit or one of your SCVs? I imagine the Blizzard developers thinking, “It’ll be fine, nobody will ever notice.”

Ankmairdor on :

Indeed, any valid target unit works(neutral units are invincible on new maps, so they can't be targeted by spells). I think it was added as quick way to make blind feel responsive for combat use. Unfortunately it adds a potential headache when tracking vision when against bio-Terran.

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.