give your goals priorities
This post is for people who want to move their bot’s decision making beyond chains of if-then rules and hadn’t realized how easy it is to start.
As I mentioned in a comment a few days ago, I watched a game in which a protoss bot’s base was under attack by dark templar. The defender had a robotics facility and observatory, and it either had the smarts or got lucky enough to produce an observer during the attack. The new observer instantly set sail for the far side of the map to scout expansion spots, and the unopposed dark templar soon tore down everything, gg.
Well, maybe the defender didn’t how to use detection at all, but I want to draw a different lesson: Do the important stuff first. Defending your base is more important than finding out whether the opponent has expanded. Attach priorities to your goals.
From what I’ve seen, most bots make most of their decisions by if-then rules, and they do the important stuff first by checking the important rules first. And that’s a good start, but I think that adding a little more smarts can give a lot more adaptability.
Separate goals from their priorities. Every goal has an importance: Defending your base is necessary, it keeps you alive; scouting is less urgent, and so on. If you have an if-then chain, you can easily re-architect it as a goal priority calculation. Each rule, instead of performing its action, assigns a priority to its goal, or adjusts its goal’s priority. At the end, accept the top goal. Once you’ve done this mechanical code refactoring, your decision architecture is more flexible and you’re free to make decisions in more complicated ways without messing up your code.
I think of it as a simple kind of search. It’s a search over goals where the evaluation function tells you the goal’s importance. The evaluation function might do something complicated, but the decision architecture is easy to understand.
Once you’ve separated goals from priorities, a further step could be to separate goal priority from goal feasibility. Every goal needs some resources to accomplish. If you can figure out what those resources are, then you know how to divide your resources to accomplish multiple goals at once and move up to a whole new level of capability. Of course it can be hard to figure out the resources needed. What constitutes enough base defense? But if you can do it, then you can split your army in a principled way: These units to defend the main base, those split off to defend the new expansion—or those go to harass, or whatever. Or: This goal cannot be accomplished, give up on it. Or: These two minor goals can both be accomplished, and together they weigh more than the one major goal.
This goes, of course, for goals at all levels of abstraction: Strategic, tactical, unit control.
Tomorrow: Checking in on Zia again. After that: Novelty maps (a topic secretly related to this one, gnekh gnekh).
Comments