OK... this is one of the indications that our sliver of the industry needs to step it up a bit. Here's an article on GamesRadar that is chocked full of YouTube videos showing AI doing stupid things. Portrayed are some recurrent suspects such as Crysis, Assassin's' Creed, and Oblivion. And these aren't rarities. Just search YouTube for variations on "stupid AI" and you can keep yourself amused and horrified for hours.
The problem is, as AI programmers, we can generally instantly say "Oh, they should have simply done this..." And yet, as a whole we continue to ship product with pathetic exploits or autonomous behaviors such as the ones depicted here. Why is that? Sure, the combinatorial explosion of situational possibilities rivals the big bang making it difficult to even account for everything much less "solve" everything. And while those situations approach infinity, our funding and ship dates are usually far more restrictive.
Or is it something more? Who knows? All I know is that I don't want to be on the receiving end of the derision of the gaming community... and in the age of instant mass media, it's pretty simple to become famous.
I was pointed to an interesting little observation/rant/commentary on the AI of FPS games on Blogo Profundo. Just a snippet heavily trimmed down to his main points:
I'm no expert here, so maybe one of my forty thousand readers can chime in, but these are just some problems I've noticed.
... Over the years, FPS's have definitely evolved both in graphics and mission complexity. ... One thing that has always been subpar however is the computer characters' AI.
... First criticism is that they tend to act as solitary agents, and don't usually form up into squads and act tactically like a rifle-team. There's no covering fire, there's no flanking, there's no suppression and calling in air-strikes.
... Second criticism is that even when they are acting as solitary agents, they're dumb as hell. They usually don't hear you, they don't make basic predictions about what you're likely to do, and they don't use the terrain to their advantage.
There's more to it than that. In fact, he asks some excellent questions of the development community. Certainly, the suggested solutions are a bit simplistic but it does show what I believe is the consensus of our audience... that they are grumpy about our lack of progress and/or dedication to realistic AI.
AIGameDev Column: Why Not More Simulation in Game AI?
Time again for my weekly Developer Discussion column at AIGameDev.com. This issue is based off of some observations I made at the 2008 GDC. I was curious about how many AI programmers didn't know each others sub-field of AI. Sure, the field is getting bigger and therefore more specialization is needed in things such as animation AI, etc. However, I was concerned about how many people would say something to the effect of "I don't do simulations."
Why aren't people more interested in using "simulation" techniques in the AI of individual characters? It seems to me that the concepts that make up - or at least underlie - simulation would be the spells that we could all cast. Everything we as AI programmers do should be based on the idea of simulating something.
Wow. A dude by the name of Shamus Young wrote a great column on the AI of Starcraft on his blog, Twenty-Sided. In fact, it would be worth of a Post-Play'em entry and I almost toyed with writing this post over there. Anyway, he wrote a script that allows 7 AI players to battle it out with the 8th slot being left for the player to control no units but observe the entire map. Often, he would let the game run overnight and see what had transpired come morning. His observations were rather interesting and served to do two things:
Point out the various strengths and weaknesses of the different races
Point out that the AI is largely a rule-based engine with not a lot of forethought, planning or strategic processing... and definitely no learning capabilities.
While, as always, I encourage you to read his article at his blog, I do want to break down a couple of his observations here.
At first I just set the difficulty to "normal", but I found that the computer players were far too likely to consume all the resources on the map, go broke, and then just sit there. I'd start a game before going to bed, and when I came back in the morning I'd find the battle was down to three sides who couldn't make any fighting units. I changed the difficulty to "Insane", which auto-cheats by giving itself 2,000 minerals and gas anytime it goes broke, meaning the thing is always rolling in resources.
It is my opinion that this is a major failing of the game. He points out that on the "insane" difficulty level the AI just simply gives itself more resources if it runs out. Because of that, there is no "end game" scenario that the computer has to plan for. There is no timer ticking down for it. However, there certainly is for the player. You need to make your move before your resources go dry. However, the computer is still playing "as if" the resources are still important. Shamus goes on...
I dislike this auto-cheat for a number of reasons, mostly because it negates a lot of the strategy in the game. None of the players can go broke, but the AI still plays as though resources were important. The only true way to knock a player out of the game is to annihilate their core base with all the critical buildings in it. Expansion bases are (mostly) worthless in a game like this. Yet the computer still builds and defends expansions (because that's what it's programmed to do) and still wastes time attacking enemy expansion bases. This introduces a bit of luck into the game: Who wins depends a lot on positioning. The AI tends to attack the nearest base, not the most important one. Sometimes the nearest base is the core base. Sometimes the nearest is an expansion which is pointlessly destroyed and rebuilt over and over again.
Now, that may be by design. I don't know. From a mentality standpoint, the idea could be not to secure an expansion in order to secure the resources for yourself but rather to keep them from the player(s). That certainly makes sense. I doubt, however, that was the case. It is likely that the 2000 rule was simply a cheat to make things miserable for the player. *shrug* It's an RTS staple, I suppose.
Moving on, the next section reeks of a scripted build order.
Without the unpredictable actions of a human involved in the match, the AI fights like clockwork. Games have a perceptible rhythm to them. They all build their first couple of buildings within a few seconds of each other. Even these variations are probably the result of minor changes in the layout of each base. If the bases were somehow shaped the same, the players would probably all build in perfect unison.
They build an initial attack force. On insane difficulty this attack force is huge - probably sixteen or so zealots or the given race equivalent. On normal difficulty the force is smaller, but the behavior is the same. They all leave the base at about the same time, and (as far as I can tell) attack a foe totally at random.
That means there may be some sort of rule-based system in place. Age Of Empires/Kings did this exact same thing. All the AIs would seem like they were working in sync, but that was because there all had the same timer settings (i.e. "If Timer = 1500, launch attack").
For the most part, I can understand doing it this way. Short of putting together some sort of GOAP system in place to sequence individual actions into a cohesive plan, the only thing left would be a random build order... which would start to look silly. One thing that he didn't mention here is if the build order was always the same... especially in the middle phases. It would be nice to see that the computer doesn't play an individual race the same way every time. That would be something that, right out of the gate, would start to mix things up a bit.
The interesting bit is "attack a foe at random". I would say that is, again, just a simplicity cheat. It would be a little mathematically intensive to process it further. However, there may be something not accounted for here. Since all the AIs are in sync at that point of the game, if there IS a mathematical scoring system, they would all come out the same. Therefore, in case of ties, taking "the top of the list" may tend to look random. The obvious fix that was missing, though, is a proximity factor. This helps in two ways:
It's quicker and more manageable to wage war with a foe that is nearby
It's easier to recall forces into a defensive perimeter when your they aren't across the map
Shamus touches on this:
Nobody has any defenses at this point, so when an enemy comes knocking, their survival is a matter of luck: The defender has an attack force elsewhere on the map. Is that force still intact, and can it be recalled before the place is destroyed? Are there enough of them left to save the place?
Another artifact of this "shoot anything that moves" strategy is that the AI is truly engaging all 6 of the opponents at all times rather than focusing on one or two of the most threatening (by strength or proximity).
A player can also do really well if they are attacked by two people at exactly the same time - the attackers end up wiping each other out and leaving the buildings alone.
As he notes, that turns messy and wasteful when attacking an enemy. Sure, when defending your own areas, you will want to repel anyone that comes near, however, if you are across the map attacking a base, don't waste time with the other forces that happen to be in the area unless they attack you as well. Really, this could be handled rather well with an influence map that is laid down spreading from your buildings to determine whether you are in a "defensive" zone or not. If you are, attack anyone that comes in. If not, stick to the plan.
The AI seems to wait until this initial attack force is nearly all dead before entering the next phase: It builds defenses and another attack force. Again, this force is sent out. Once gone, the AI begins trying to build its first expansion base.
The rest of the game is a series of escalating attack waves. As they add more buildings onto their main base they work their way up to air units,
More evidence of a strictly scripted/rule-based system. There are obvious triggers here. If this is truly the case, this method could fall on its face in a number of ways.
For example, if the AI's attack force survives a battle with just enough units to NOT trigger the next build, but the force it defeated is now in the next build (because their unit count dropped below the threshold), the AI actually starts to fall behind. An exploit would be to NOT kill the AI's units off but just run them around the map for a while. You can build at will, but the AI is still waiting for the trigger to happen.
One interesting point that he made was regarding the difference in how the AI uses Protoss Templars vs. a human compared to vs. another AI. Check this out...
When I fight the AI Protoss, it uses the Templar Psi Storm with murderous efficiency. I'll have a tight group of units moving into its base when a Templar will appear in juuuust the right spot, drop a Psi Storm on my guys, and dart away before I can punish him for it. With a couple of Templar available he'll play hit-and-run with me all day, and do tremendous, infuriating damage to my forces.
Against other AI, the Templar are bumbling comic goofs. They will drop Psi Storm on single enemy units and hit a bunch of their own guys in the process. They will blunder through fortified territory attempting to reach a unit deep inside, and get cut down before they even get close.
I've come to suspect that the AI cheats a bit and detects clusters of units which have been grouped by hotkey by human players. This is very naughty if it's true. What's worse is that peeking at how my hotkeys are set up seems to be central to its decision making. Deprived of that bit of cheating info, the Templar is helplessly stupid. Boo. (empahsis mine)
Now THAT is interesting. Rather than write up some sort of grouping algorithm or process a very dynamic influence map, use something that the human player is going to likely use. If he doesn't use hot keys on his groups, he's a n00b anyway and could stand the help of an ineffectual AI. It would be interesting to try and play without hot-keying your forces and see if the AI Protoss can use those Templars effectively or not.
His complaints about how poor the AI is at playing Terrans are well-founded:
I'm note sure why the thing is so bad at utilizing Terrans. Aside from the issues I mention above, it just seems less aggressive overall. It also has a penchant for building base defenses (bunkers, towers) in places where a base should go, effectively rendering a viable expansion useless. It will attempt to lunch nukes without bothering to cloak the Ghost first. It will risk the painfully expensive Science Vessel in order to irradiate something of very low strategic value. It makes small numbers of all units instead of focusing on a few and using them well.
All of the above could be solved with some mathematical analysis of the units, the situations, the terrain, etc. It's a shame that wasn't done.
Now... keep in mind, this game was made 10 years ago. RTS AI was stagnant for the most part during that period. Age of Empires and Age of Kings had horribly inconsistent AI as well. It is my (less than perfect knowledge) opinion that RTS AI didn't turn the corner until Empire Earth (Stainless Steel Studios) in 2001.
Anyway, Shamus' project is fantastic and his analysis was very pleasant to read. I may have to find my Starcraft CD so I can download the zip file. I would be very interested to watch through these games and see what else I could see.
This time, I invoke Chris Hecker and his speculation on whether or not we will find "the Photoshop of AI". To quote from the column:
In his lecture entitled Structure vs. Style, he pointed out that the cusp in graphics presentation technology was when the atomic building block was settled on - that of the the texture-mapped triangle. [However], there is a major component of the game experience that hasn't yet found the spark for it's Big Bang of development such as the one that occurred in the graphics universe. Game AI has yet to find that "one thing" that their world can be reduced to. And, as such, there can be no "Photoshop for AI", as Chris put it. Yet.
If you are an AI developer or even just interested in game AI, please wander over and read the whole column... and then weigh in on the subject. What is that single core component that we need in order for AI to make the leap to the next level? Does it even exist?
Like many bloggers, I have some Google Alerts set up so that I get daily mailings about relevant topics. While it is sometimes frustrating to have to wade through articles and other blog posts about basketball player Alan Iverson (AI) and his "games" (= "game AI"), it is also very helpful to see a daily stream of what people are saying around the interweb thingy.
The fun starts when I see a series of articles come through over the course of a couple of days about the same game. Even just from reading the brief Google-like blurb attached to each entry, I can see trends. Sometimes, there is a string of similar gripes or a parade of praises. However, there are times when I see some of each. It's times like that where I wonder what people are really looking for in game AI... and if we will ever be able to satisfy everyone.
There's an example going around in the form of "Dark Sector". Here's some samples.
Lets face it people, the game does have some crummy AI and it doesn’t take long to see that, for example if you are in the middle of battle and you need to heal and you run alway the AI just stops and stands there. And if you didn’t know it’s not surrpost to do that.
AI is a hot potato these days, especially with the power that the PS3 can wield. Dark Sector's AI is set to offer evolving enemy tactics, because they'll be able to communicate amongst themselves, and therefore offer realistic repsonses to player actions.
It also doesn't help that enemy AI is also weak, with some soldiers standing guard as their comrade's blast away at Tenno, whilst others seemingly have a sixth sense with where our infected hero is. The inextricable ability to shoot through walls also doesn't help matters, and only serves to strength our belief that Digital Extremes could have done with an extra couple of months to polish up the Dark Sector experience.
There are several boss battles in Dark Sector, and all of them are very different. Variety comes courtesy not only of bosses that differ wildly in shape and size, but also of the weapons and abilities that you'll need to defeat them. None of the bosses are overly challenging if you take your time with them because, with only a few exceptions, their attacks just aren't powerful enough to kill you with a single blow. They'll hurt you, and the borders of the screen will flash red to let you know that you're injured, but Hayden regains health so quickly that getting into cover briefly or even simply performing a few evasive rolls is generally all you need to do to get back to full strength. That's not to say that all of the boss battles are easy, though, because they're not. It's just that often the tricky part is figuring out how to beat them rather than actually doing it.
Challenging AI - Players will employ special tactics while encountering new and different enemy combat tactics as the evolving AI communicate amongst themselves, take cover and offer realistic responses to player actions.
Get the point yet? Of course, the interesting thing is that the "good" comments read more like propoganda from the marketing department. Oh well. It's easy to see why AI programmers have such a difficult time. We have no idea what our users will think "good AI" is. (See my column at AIGameDev on "Good vs. Fun AI")
Wow... back-to-back greats posts from Ted Vessenes on his blog, Brainworks. In this one, he writes about a concept very close to my heart - that of mathematical balancing. In the post, Getting it Just Right he mentions two types of parameters - sensitive and insensitive numbers. From the post:
A sensitive number is extremely hard to tweak, because you won't see the right behavior until you get things "just right". If the value doesn't encode the right concept, then that "just right" state won't exist, but you'll never know that. You'll just see how all kinds of different values don't work in different ways.
And an insensitive number generally just has an impact when it crosses an important boundary (for example, driving 56 instead of 55, or your gas tank being 0% full instead of 1% full). There's often no indication where this interesting numerical boundary might be.
I mentioned on a comment I posted there that I wished he had written that a few weeks ago. The ideas he presents map very well into a couple of my recent columns over at AIGameDev. One, on Chaos Theory and Emergent Behavior hits a similar nerve as far as tiny changes having big ramifications. The other was about intelligent-looking errors. Both are applications of trying to get those parameters into the ever-elusive "sweet spot" - both in the short term (believability) and the long term (stability). I would have liked to quote him on those columns.
I'm definitely keeping an eye on Ted's blog from now on!
Ted Vessenes wrote a nifty little post on his blog where he compared designing and programming AI to being a parent. Here's the opening paragraph:
"Writing artificial intelligence is a lot like being a parent. It requires an unbelievable amount of work. There are utterly frustrating times where your children (or bots) do completely stupid things and you just can't figure out what they were thinking. And there are other times they act brilliantly, and all the effort feels satisfying and well spent."
I have to agree with a lot of the points he makes in his post. I would like to take the analogy one step farther.
I've occasionally made the point about both parenting and AI that your job is to not define what your progeny should do but convey an understanding of why. If, as a parent, you tell your child not to run in the street, they will hopefully carry that lesson into the future. However, they may not apply that same edict to driveways, parking lots or any other places where they could get plowed over by a car. This is analogous to the scripted AI methodology. However, if you explain the why of the situation - i.e. "be careful anywhere that cars are moving because the driver may not see you in time to stop and you could get badly hurt" - then the simple rule can be applied to any situation where there are cars (or even car-like objects). This, of course, maps over to rule-based systems or even planning systems.
However, going back to Ted's point, it is an interesting similarity to put all those rules into place and hope that your little bots realize the appropriate situations in which to use them. I actually wrote a column about this scary process on my weekly column over at AIGameDev.
Anyway, if you are an AI developer, I hope that you are blessed with many children who all grow up to be accomplished in their chosen lives (or deaths).
This time, I touch on the concept of Chaos Theory and how the AI buzzword of emergent behavior is actually cut from the same cloth. They are both entirely deterministic in that they are composed of a finite set of distinct rules - and yet their strength (and weakness) is in that they look complex... even to the point of looking random at times.
But is this good or bad? To pull a brief quote from the column:
So our agent-based models are really an implementation of Chaos Theory. That is, they are both complex systems that result entirely deterministically from relatively simple models. However, as Jurassic Park so elegantly portrayed for us, even deterministic models can spin wildly out of control. There are plenty of examples of very simple systems whose results can vary widely - almost looking “broken” simply because of the interaction of those simple rules.
And that is the rub. That is the beast that waits below the surface to reach up and wrap it’s combinatorial tentacles around our placid simulation and drag it down into the abyss of scathing reviews. And we never know if and when it will strike. Perhaps the name “Chaos Theory”, although not an appropriate term for describing the system itself, was an appropriate one after all for describing the potential results of that system.
Read the whole column over at AIGameDev.com. And please, these are discussion columns. If you have a comment, by all means leave it!