archive by month
Skip to content

separate, independent unit control for micro

I notice a lot of bot authors want to control each unit independently for micro decisions, to make it an agent with a mind of its own. There are good reasons to write a bot that way.

  • It’s simple. Fewer bugs and less implementation effort are strong reasons.
  • Being simple, it can run fast.
  • Frame-accurate control depends on each unit’s exact state at each frame. It seems much easier to handle unit by unit.
  • Units can sidestep the stupidest behaviors, like moving too much without shooting. Each unit can act efficiently under its local circumstances.
  • Cooperation: If a squad still gets orders from above, then the squad still acts together for higher-level goals.
  • Cooperation: Units can still work together on low-level goals like focus fire by simple means like preferring targets that are already hurt. Cooperation occurs as an emergent behavior.
  • Cooperation: At a cost in simplicity and speed, units can look at each other’s targeting and movement plans or expectations, to get more effective focus fire, to reduce overkill, to kite better, and so on.
  • And hey, you can call it an agent architecture, which sounds great.

It doesn’t make sense to me. My micro plans in Steamhammer call for reducing the independence of units, calculating more things centrally at the squad level and leaving less for individual units to decide. For focus fire and avoiding overkill, I want a data structure in the squad to keep track of assignments of shooters to targets. For kiting and fleeing, I want a near-term prediction of when each of my units is likely to die, based on the rate it is taking damage or on the approach of enemy melee units. A planning algorithm can look at all the data to decide, “You, shoot at that” and “You, pull back.” It’s not as simple, but I expect it will have a higher ceiling in practice, because it is easy to change out the planner. And I think that, done right, it can execute fast. Units act frame to frame, but the squad-level planner needs to execute only about once per cooldown period, and it can be out of synchrony with unit actions.

That’s general micro, but there are also important micro skills that bots don’t have and would benefit from. I’ve never seen a bot do any of these effectively.

Zergling surrounds. Watch a bot attack zealots with zerglings: Each zergling heads for where the zealot is now, and the lings pile up. With fast zerglings and slow zealots, if the zealots flee then the zerglings end up trailing behind and getting a hit in now and then, and mostly waste their time getting in each other’s way. Arrakhammer does modestly better by predicting the zealot’s future location, react to the future style. Then watch a human do it: The zerglings move into or around the formation of zealots, then attack all at once. If the zealots are fleeing, they get surrounded and have to find or make a way out before they can escape. Any intermediate zerg player knows this micro.

I’m seriously considering implementing zergling surrounds in Steamhammer with human-like control, at least as a first cut. It’s 2 commands total for small fights with up to one control group of zerglings: Command lings to move as a group, command lings to attack as a group. Choosing the destination for the move command is the tricky part.

Dragoon backstepping. Like most bots with a combat simulator, Steamhammer mostly attacks or retreats, and doesn’t know anything in between. But watch what happens in a human game when a strong terran early timing attack moves out and faces forward dragoons: The dragoons will lose if they stand and fight, they must step back... and back.... But if vultures pull too far in front of the tanks, or if any sloppy movement isolates a few terran units, the dragoons may suddenly stop and fire. The terran force must move slowly or be whittled down—usually some of both. Protoss gains time for more dragoons to take the field.

Related situations are common. FAP doesn’t understand vultures versus zealots, so if there are too many zealots, Steamhammer’s vultures will retreat in terror instead of pulling hit-and-run attacks. If an opportunity comes up, take it even if you weren’t intending to fight. I think the decision is best made at the squad level, so that the squad behavior stays coherent. I often see Tscmoo lose squad coherence and disintegrate; I want to avoid that.

Getting out of each other’s way. A large group of ranged units arrives to fight—hydralisks, say. The closest hydras get into range and stop to fire, and the ones behind maneuver around the sides to get into range (that is inefficient already). The ones behind those... push and shove, but can’t get into range and achieve nothing. Any human above beginner level will move the front hydras forward so that all can get into range, but bots don’t.

Climbing a ramp is similar. Bots see targets at the top of the ramp and stop to hit them, blocking the way so that the rest of the force is stuck below. Steamhammer is clever enough not to siege tanks on the ramp, but sieges them above the ramp and blocks the path anyway. Humans keep the front units moving until the whole force can get up. The difference in DPS is huge.

These decisions can be made by individual units, swarm intelligence style, but I find it hard to design good emergent behaviors. I think it is better to make the decisions at the squad level. It should be more efficient and more effective.

Trackbacks

No Trackbacks

Comments

krasi0 on :

Quote: "I often see Tscmoo lose squad coherence and disintegrate;" - that is interesting. Could you elaborate on that and provide some examples?

Quote: "Steamhammer is clever enough not to siege tanks on the ramp, but sieges them above the ramp" - that may not always be optimal against some cleverly positioned (static) defense - e.g. 3+ enemy siege tanks or 4+ enemy sunkens / cannons having the ramp in vision and weapon range. If you try to move your whole army up the ramp by default, you're going to suicide everything while inside the chokepoint.

Jay Scott on :

1 Tscmoo: I’ll find an example or two and make a post.

Jay Scott on :

2. Suicidal movement: Yes, all decisions must be continually re-evaluated. But we both knew that. Scouting before you commit to running up the ramp does seem important.

Arrak on :

I think there's a combination of squad-level and individual-level improvements that need to be made, and arguably the biggest gains are in strategy, rather than pure micro, although you might guess that perfect bot micro interests me more. There definitely needs to be shared information, and more localized combat decisions. My sunken colony targeting code calculates (crudely, every frame) the projected damage by fellow sunkens to avoid overkill and factors in enemy HP and damage, and I'd been thinking of adding similar functionality to all my units. --- However, regarding large-scale zergling surrounds and stuck hydralisks, I think there needs to be good flocking, which I consider an individual-level fix. When humans move units as groups, they're taking advantage of Starcraft's built-in flocking, which is passable short-term. Steamhammer has no such flocking, so all movement devolves into conga lines. --- The main thing I needed for flocking, was pathfinding the shortest path from unit to target location - specifically, I needed initial direction of movement and path length. Per frame, the unit's current direction, and the direction to target location, are not necessarily the correct direction to go, after all (unless the unit is a mutalisk, which I've had more success with). My zerglings would end up dancing in some corner of the map. --- Getting out of another unit's way is the easy part. It's not always the case that the frontmost hydralisks should move forward even in the absence of enemy melee units, lest they walk into some siege tank fire. Sometimes, one wants to form a concave instead. What's more, even then, it's not a good idea for units to walk around without shooting the entire time just to form a concave, or get out of the way of another unit. If the enemy is faster and running away, or attacking, it could be the wrong decision. This is the problem that gave me pause, and it is probably indeed a squad-level decision. --- But let's say that problem was solved, and we do want to spread out for, say, a zergling surround. How do you do it efficiently and non-situationally? My plan was, essentially, use potential fields. Conga line is obviously the worst case scenario, so imagine a conga line. We want some sort of concave-like formation for a surround. Factoring in terrain limitations, and assuming for each unit we have the correct "primary direction," as soon as enemies are sighted (perhaps even earlier), the front units need to move tangent to the primary direction, the back needs to move straight, and the middle needs to do some linear combination of these. Even if the front line has started fighting, the back end might still need to do some form of this, so I imagine it's generally useful.

IMP on :

I understand your concern regarding unit-level micro and higher-level cooperation. But Independent agents are just a different paradigm that can ultimately implement the same behavior as a centralized decision maker. Take your hydra micro example: the centralized decision maker would correctly assess the complete situation and move the first hydras further into the enemy fire to make space for hydras in the back. Independent agents achieve the same behavior as follows (simplified): each hydra moves towards the enemy until in weapon range, unless it detects own hydras behind itself. Then it moves a bit further. Check e.g. https://www.researchgate.net/profile/Damon_Daylamani-Zad2/publication/320254420_Swarm_intelligence_for_autonomous_cooperative_agents_in_battles_for_real-time_strategy_games/links/59d7aa80458515bbfee8dec5/Swarm-intelligence-for-autonomous-cooperative-agents-in-battles-for-real-time-strategy-games.pdf

Jay Scott on :

It’s not about what’s possible, because everybody in the room is Turing equivalent. It’s about what’s easier and better, and this is my opinion. In my view, swarm algorithms excel at fast approximations to infeasible solutions, and micro is an example, so it’s good that people are looking that way. Also in my view, swarm algorithms are indirect and it is more difficult to reason about changes to them, which makes them less suitable for a continuous improvement process. To me, that’s key.

IMP on :

You argue that you want a data structure in the squad to keep track of assignments of shooters to targets and near-term prediction of when each of my units is likely to die. I might just not understand the issue, but I see no problems implementing this via a public board as mentioned in the article I linked.
With regards to continuous improvement: It's probably a matter of opinion. When moving towards reinforcement learning (as opposed to "hardcode" our human knowledge into the micro-algorithm) it might not matter much (see e.g. https://arxiv.org/pdf/1706.02275.pdf). An interesting fact to consider: The U.S. army has moved away from centralized planning to more individual situational awareness and adaptive decision making in their "micro".

Jay Scott on :

Yes, it is a high level project management decision, and a matter of opinion.

Dang on :

[1] Lots of thoughts here. The core one is that squad-vs-individual control is a continuum, not a dichotomy. Randomhammer micro is heavily squad oriented... but still kites with Dragoons individually. PurpleWave is very individual oriented... but still forms concaves and collective fight/flight decisions. McRave's are almost equally both. Ultimately, there's no inherent reason why the ideal set of orders should involve units doing the same thing, so having them do so is largely a tradeoff sacrificing optimal order selection for ease of implementation. Which is a reasonable tradeoff to consider. But if you can solve the issues that arise from individual unit control -- say, by having mechanisms for coordinating across units -- you have access to a higher ceiling of unit behaviors.

Hannes Bredberg on :

I do agree that there is something to be said about FAP not understanding micro situations at all, while I think that is a more spanning issue of it in general, you can actually use it for some of the smaller things you mentioned.
FAP actually lets you poll the state of the simulation at any point, and by default uses IDs consistent with BWAPI. You can use it to predict when a unit is going to die, where it dies and so on.
I'm not sure how I'd like to go about the micro situations for FAP. If anyone has a suggestion for it, I'm all ears.

Jay Scott on :

It is a good reminder: The combat simulator has untapped potential.

Hannes Bredberg on :

So I've also been thinking about the modelling of how you could use FAP for the vulture like situation. I think that it's wrong that you do the full simulations for the entire combat. Simulate a time of about

Jay Scott on :

Ack, your message got cut off right before the good part!

Hannes Bredberg on :

Hahaha weird, I wonder what did that. What I wanted to say was to use shorter simulation times. Try testing if you are able to poke against the enemy army. If you are making gains for the next 0.5 (or less) seconds, you should poke, otherwise retreat. As long as you are feeding FAP with the cooldowns for your units, this should be good. I'd actually say that you probably should base your commitment on how long it takes until you are no longer gaining anything from the battle.

Jay Scott on :

Good idea about cutting simulation short. As for the truncated comment, maybe you were trying out a new theory about cutting messages short?

Jay Scott on :

It would be nice to be able to simulate the disengagement after the engagement, to see whether it is safe to run away. That would help in cases where shorter-ranged units are fighting longer-ranged units: If the zerglings find more marines than they expected, but fleeing gets them all killed anyway.... Or when you suddenly find yourself surrounded, and want to know if you can escape, or if you have to make a last stand.

Jay Scott on :

I’m thinking of trying a different termination condition: Simulate until each side has lost at least 1 unit, or some other fixed measure of losses (or until one side is wiped out with no losses to the other). The hope is to capture just enough of the fight to assess its risks. I see advantages and disadvantages to all the options.

Hannes Bredberg on :

Yes the running away simulator is planned and hopefully coming very soon. I think that is the only thing that FAP would need to add to get the behavior that any bot creator would be looking for.

Jay Scott on :

More difficult would be a runby simulator: Can the enemy units block me from running past them? It seems to require accurate simulation of units physically blocking each other.

Hannes Bredberg on :

Well I guess you could use the retreat test mechanic for that too - just retreat behind enemy lines?

Jay Scott on :

I’ll be sure to try that!

Jay Scott on :

A case that is especially valuable for zerg: Can this overlord escape, or is it destined to die? Steamhammer tries not to make excess overlords, so it needs more effort to avoid being supply blocked.

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.