Tuesday, May 11, 2010

Designing Emergent AI, Part 6: The "Tempo," and AI vs. Player Agency

In the fifth installment of this series, I talked about the reasons for not over-engineering AIs and thus letting them fall into traps by making them too predictable. That was intended to be the final article in the series, unless more questions came up that I needed to address. Recently a new topic has arisen, however, in the form of a question about player agency and why the AI in AI War is deviously reactive rather than taking matters into its own hands too much. This post is actually as much about game design in general as it is about AI design, but those two areas often go hand-in-hand.

Why Does The Human Player Always Have The "Tempo?"

Q: In AI War, you've made the AI play by different rules to the player. Much of this works, but the bit that I think is a bold red, font 100 minus is what seems to me could only have been a conscious decision to make it a passive, reactive and predictable creature.

In the classic pvp strategy games, after the learning curve, each player knows at least roughly how well each of their units do against their enemy's units. At the macro level, the core game is about out-thinking your opponent, deploying the strategy that counters the opponent's current strategy, aware of the likely reaction from the opponent because of your current strategy, and being prepared to change your own strategy in the near future to stay one step ahead. It is about acting and reacting. It is this dynamic which keeps people playing, which explains why Chess and Starcraft are still going strong.

A pvp game inherently has a huge imperfect information mechanic: you don't know exactly what your opponent is going to do. Since AI War is played against an AI, one which does not actually have a macro strategy, which only reacts to the player's moves, never initiating any, you don't have this mechanic or depth. I'm hoping to get across why I think AI War's gameplay is lacking that special something to get it from 'very good' to 'excellent'


Response from Chris Park, AI War's Lead Designer:

AI Modifiers and Other Existing Features

Are you aware of the AI modifiers for cross-planet waves and no wave warnings? A lot of what you are looking for is accomplished by that alone. You may even want larger waves on in order to tailor the experience even more that direction. The macro AI is actually quite devious in terms of what it does with ships once it has a bunch of them free as threat -- a lot of what you are describing happens already in those circumstances, but if you're effective at keeping the AI Progress too low then you wouldn't see that much; it's entirely possible you're on too low of a difficulty there.

Thoughts On the Tempo, And Why The PVP Model Is Not The Goal Here

Beyond that, though, you are entirely correct that the human players are given the "tempo" in this game. That makes it much less like the AI is a full opponent, as you are noting, and more like it is a cross between an opponent and a "game master" in terms of a pen and paper RPG or similar. This, as you might guess, is by design -- this game is about the player, and what they want to do. The AI does indeed throw in some monkey wrenches from time to time, and will kill you if you're not careful, but it's not as independent-acting in a macro strategy sense (most of the time having very few free Threat ships), because that's simply not the goal.

And why not have that as a goal? Well, here's why I hate pvp RTS games, as a blanket statement: the other player is doing stuff invisibly, I'm doing stuff invisibly, and then we finally see what we are doing when we meet, and whoever randomly did the best thing wins that encounter. If you built lots of horsemen and I built lots of pikemen, I win. If I built regular foot soldiers, you win. Then, depending on how unmatched we were, one of us might completely kill the other, or the losing player might scrape by and survive and battle back. Repeat.

To me, that's all those games are, and it hasn't been fun for me since Age of Empires II when I realized what the deal was. I was very much a fan of pvp RTS in the Warcraft II, AOE, and AOEII days, and even to a smaller extent with Empire Earth, but round about that time I was done with it and haven't looked back, and have been eking out an existence in a sort of scaled-down co-op purgatory against the AIs since then. I've had a ton of players write me to say that they haven't played any RTS since the Warcraft III days or similar, but then got back into strategy games via AI War, and I think this is a large part of the reason why.

Player Agency, Comparisons To Espionage Games and Tower Defense

Because, in the end, AI War is as much a puzzle game as anything else. It's a very complex puzzle that changes slowly over time and has some ability to throw monkey wrenches at you every so often, but overall it is an engine for letting you devise very complex and long-term plans, and then see them out. Of course you have to change your plans as the AI grows and the situation changes and such, but in the main it's about you and your team's cleverness in a complex scenario.

Think of it like one of those espionage games where you play as a team of commandos that has the building schematics where the terrorists are, and you plan out a route and then go busting in to save the hostages. The terrorists react and move around and generally foul up your plan, but if you plan is well designed then overall it still goes vaguely like you had hoped. The fun parts are the initial planning, the ongoing adaptation that the monkey wrenches cause, and that feeling of satisfaction at having bested the scenario.

Actually, that's what is great about the best tower defense games, too, like PixelJunk Monsters. And it was the thing that kept me going with all the other RTS games that I played over the years, from AOEIII to Rise of Nations, etc. The AI might be doing whatever on those maps, but overall it was just a matter of finding your way through the puzzle of their stock behaviors to grind them down. That was always very fun, to a point, but once the AI became too predictable and once I had my build patterns down, I was done.

How AI War Blends All That Together, And How It Has Grown

AI War was therefore built around having the players constantly off balance and having to adjust their strategies, and having much deeper and longer-term strategies compared to the "comp stomping" in those other games. That said, the AI is always growing an changing, too -- layering on many sorts of complexity in its behavior makes for a more interesting and varied experience, and makes it more effective at surprising the player.

There was a time when the AIs just had waves, special forces, guards, and "free" ships that ran right at you most of the time. Then Cross Planet Attacks and retreat/regroup behavior was added, and a lot of the finer mechanics were tuned. Astro Trains have always provided another layer of AI behavior, but they've had mixed popularity at best. Then we added minor factions of various sorts, which shook things up almost as much as the CPAs. The recent Border Aggression feature is another major step for the AI, adding on a lot of potential complexity for them in the later game in particular.

And we're planning further minor factions and have that new "entourage" behavior for starships and fortresses and similar in the works, which should also make things varied in yet another way.

All of these things combine to create an AI that is varied and that can surprise players, and that is always getting better and doing so. It has a lot of various emergent activities at this stage that genuinely surprise me when I play, because I never programmed anything of the sort in, and it's fascinating to me to see how that sort of thing comes out of those layers of complexity based on multiple simple overlapping rulesets. That's why I keep focusing on adding more rulesets as much as possible, because that leads to even greater variance. And having more ships with varying attributes and gameplay mechanics attached is also related to that. It's something that has to be done pretty carefully over time, though.

Even So, The AI Won't Have The Tempo, And Here's A Better Example Of Why

And, of course, none of that is ever really going to lead to an AI that has the tempo, as that's something I studiously avoid for the reasons noted above. There's a reason that the terrorists in Rainbow Six don't use squad tactics and come flanking you and executing deep strategies -- that would take all of the fun parts of the strategy away from the human players in those games. I've played many other FPS games where the AI adversaries do indeed use much more strategy, but since those strategies are largely invisible all it tends to affect is how many guys you wind up facing at a time, and where.

Perhaps my favorite example of great FPS AI is Far Cry 2, because they act like real people and respond intelligently (most of the time) to what I do, but I'm hiding in the bushes and moving around sniping them off, creating distractions, and so forth. If I make a mistake and break cover that will be my death, and if I do something stupid like rushing straight into the camp with guns blazing, then they will also kill me. Heck, if I approach a camp and just sit in one position firing on them, they'll flank me and kill me, so I have to keep moving and really act like a guerrilla. Come to think of it, Red Faction: Guerrilla did much the same sort of thing, too, and I really enjoyed that there. But in both of those games, as long as I keep hidden and/or behaved so that I'm not noticeable, the AIs are entirely no real threat to me. I have the tempo and can do recon, decide when and how to strike, and then am left with the challenge of dealing with the hornet's nest that I've just kicked.

AI War is like that -- that's the intended design, and it would be a pretty fundamental thing to change it and give the AI the tempo. If the bad guys in Far Cry 2 were constantly prowling the jungle on high alert for me, that would have just made it Half Life 2, which I found to be a wonderful game but much less satisfying tactically.

In Conclusion, The Tempo Thing Is Neither An Oversight Nor Accidental In The Design

Starcraft and Age of Empires and all those other games do what they do for good reason, and in a pvp type arena they provide a lot of what I used to enjoy in both Warcraft II and Counter-Strike. There is value in that, and I'm glad that other developers continue to make games of that sort, even if I'm not specifically interested in them myself anymore. But trying to bend the Rainbow 6es, the Far Cries, the Red Factions, and the AI Wars to be more like them is not something I'd want to do.

I hear what you're saying, but it isn't like it's accidental that AI War is crafted the way that it is. I think the reasons that you mention that hold it back from being "excellent" to just being "great" is what makes some people consider it really excellent at all.

AI Article Index
Part 1 gives an overview of the AI approach being used, and its benefits.
Part 2 shows some LINQ code and discusses things such as danger levels.
Part 3 talks about the limitations of this approach.
Part 4 talks about the asymmetry of this AI design.
Part 5 is a transcript of a discussion about the desirability of slightly-nonideal emergent decisions versus too-predictable "perfect" decisions.
Part 6 talks about player agency versus AI agency, and why the gameplay of AI War is based around keeping the AI deviously reactive rather than ever fully giving it the "tempo."

No comments: