Whenever I watch Starwars movies, I have this nagging feeling that R2D2 might just be more intelligent that C3PO, a fact that few others seem to agree with! The way I see it, it is R2D2 who normally gets everyone out of trouble, and it is him who provides the more practical solutions to most problem. Why then is it that we are encouraged to think of C3PO as the more intelligent robot? Is it merely his exterior humanoid shell, as opposed to the embryonic egg-like shape of his beeping brother? Or is it the fact that he makes such a show of his emotions all the time? And what is “intelligence” anyways? Do C3PO’s angst attacks qualify as intelligence?
O….K! I almost opened a can of worms there, but I do want to make a point- that problem solving and adapting to new situations (R2D2) are probably a big part of any definition of intelligence…while depression and angst (C3PO), while indicative of some sort of internal world-view simulation, don’t necessarily constitute intelligent behavior. Despite this fact, I argue that creating a semblance of the latter in your NPCs, i.e. simulating a C3PO-like behavior, makes for a more believable AI than does simulating R2D2-like AI.
As I mentioned, it is hard to define “intelligence”, let alone “artificial intelligence” without sparking a whole lot of philosophical debate, and though there is plenty of disagreement on the two terms among cognitive science researchers, game developers seem to have reached a common understanding of what AI means within the context of games. Among game developers, and most people who play video games, good AI is defined by its ability to come up with strategies for winning a game that offers a large set of possible decisions, in a way that a human opponent would. Here we will be discussing the “human” element of AI behavior in games…
There are a few key issues regarding human-like AI that specifically pertain to the world of video games:
1. The game must have a large set of possible tactics. A game of chess is a good example, because even though the set of rules is very limited, the number of strategies that you could pick at each stage is huge. Entire books can be, and have been written about the possible opening strategies in chess, and that is just the first few moves. Most video games of today offer a relatively “loose” set of rules, meaning that the player’s moves are not limited too much and there are multiple decisions he can make. E.g. in Team Fortress 2 you can pick your class which in itself offers tons of game-play variations, pick whether you want to attack or defend, and entering the playfield you can pick your direction of movement, weapon, target opponent, ad infinitum. As a result, the number of tactics and strategies to win the game, though they are sometimes lumped together under terms such as “camping”, “base defense”, “Tanking”, etc. are incalculable. Now, AI can certainly be applied to a game such as tic-tac-toe, but in order for it to be “believable” and “interesting” it needs to make the player feel as if it too has a hard time figuring out the optimal tactic… which brings us to the second point.
2. “Optimal Solutions” are a curse to human-like AI. Human minds, and indeed nature itself, as can be seen in the process of evolution, never search for optimal solutions to problems. When asked to navigate a room and get to the other side, no one will calculate the absolutely shortest path. They will take note of the biggest obstacles, and just head in a relatively uncluttered direction trying to avoid those obstacles, and indeed, sometimes they just get stuck, and try a new direction! It should be the same with game AI. If the player is to believe that the platoon of soldiers that he is fighting, are “real”, he needs to observe that they are picking “good enough” solutions; not more, and not less. Some AI designers approach this problem by finding the perfect solution/strategy, and then dumbing it down. This is a sad waste of computational resources in most cases. The fact that a heuristic for a problem doesn’t exist, should not drive us towards dumbing down the optimal solution, but rather motivate us to come up with new heuristics!
Now, it is true that the AI should not be picking optimal solutions, but it is even more essential that the human player actually observes and understands this fact, which brings us to the third and most important aspect of human-like AI.
3. Presentation is everything. You can come up with the most complex dynamically learning evolving neural network-based agent for your game, but if the player for a single moment feels that you are using a simple repetitive algorithm, or that your agents are “cheating” (e.g. they have 360 degree vision) the immersion bubble will burst, and players will feel cheated, nay even disgusted by game AI! I have had many such moments in gaming, when I figured out exactly how the game AI would calculate its next strategy, and were it not for the fact that many of those games had a network and internet play option, I would have never continued playing against those machine-like enemies!
Now that I explained what I mean by “presentation”, let us discuss an example and see how it can be done right. We will take the game F.E.A.R. as an example, which has a simple, but fairly fun AI. In F.E.A.R. enemy combatants seem to use multiple senses to locate you. At every point, they evaluate the cost of running any one of many possible tactics, and switch to it.
World design and the need to find cover during firefights create interesting effects, such as when enemy soldiers seem to flank your position or even run away from you in an attempt to lure you into an ambush! F.E.A.R. AI does address the first point I mentioned well because it does not go for the global minimum cost, but rather picks the first best tactic whenever it has a need to do so. The fact that the enemy does not seem to be 100% sure about your location and snipe your brains out, and that enemies can be caught off-guard sometimes or shoot in all directions from behind cover, addresses the second point. FEAR developers, by allowing AI soldiers to yell for help, or issue orders and directions to their platoon, successfully created the illusion that the AI actually depends on these exchanges of information. This is a clever technique, and it works quite well if you want to make your AI to appear more human than it actually is.
However, making the AI look cleverer is just part of the deal. It is a lot more important to present the AI in a way that makes it look “more human”. There are several ways to do this with currently available technologies, and FEAR, and indeed most other games that depend on AI for their game-play have not used any of these methods efficiently. It is imperative to understand that human behavior, unlike most computational AI, has a deep layer of emotions used both as inputs to the system, and as masks which will ultimately define how the output is presented to the world. Because communicating this layer via subtle facial gestures, or speech intonation is not technically feasible in today’s games, we need to find other means of communicating its effects to players. This can be done in a number of ways:
a) Voice-over: The easiest and probably most neglected way to communicate emotions to players in the heat of combat is voice-overs. Having AI controlled enemy and friendly characters shout out emotionally loaded instructions and tying those in to AI tactics that are actually implemented is the easiest way to make your AI look “human”. E.g. if you have AI code that makes enemy troops call for an air strike when you overpower them, let the player hear them shout orders such as “Commander! We are under heavy fire! My boys are dropping like flies here! Please, we need that air strike. NOW!” If this is recorded by professionals and played back to the player when he gets close to the enemies’ command bunker, right before the actual air strike, it will definitely add to player engagement and the emotional depth of the game. The important point to remember is that the voice over has to be emotionally charged and non-repetitive, and it must tie in into real tactics that are available to the AI characters.
Having a boss character face you and tell you “Are you running away maggot?” when you are low on health and trying to escape (e.g. in an MMORPG) makes you feel that the AI is aware of your decisions, and this contributes to immersion. In FPS games, the more the enemy platoon members talk to each other the better. E.g. hiding behind cover, the player might overhear them talking about how scared they are to die, or that one of them has a young wife and child he wants to go back before they run for cover in a different position.
b) Animations: Traditionally combat game developers create a multitude of animation for movement and attacks, but animations that show actual emotions, such as covering from fear, attacking in a frenzied self-destructive way, and everyday motions and actions such as smoking when nervous, or looking around nervously when hearing sniper shots (from the player) etc. are neglected. Calling these animations at the right moment can make all the difference between a robotic enemy, and a human one.
c) Narrative: The narrative behind the game has to explain the behavior of AI opponents. In many games, the narrative and the AI strategies are, sadly, diametrically opposed. E.g. in an RTS game where your opponent is introduced as a group of fanatics, having them make sound combat decisions at all time and trying to evasive maneuvers will simply look bad. Let them run at you head on blasting their way through with shots in all directions. The AI code for such an opponent must support tactics such as jumping on the grenades you throw in order to save their comrades, fighting out in the open, etc. this adds character to the enemy NPC’s and creates immersion. Always include a sound emotionally charged reason why the enemy wants to kill you within your narrative.
d) Gameplay: In many cases, deep human emotions such as angst, melancholy, fear or love can be used directly as gameplay elements. An enemy that has been under fire for a long time might go nuts, of get scared. Such enemy AI should start to behave erratically, e.g. by a frontal assault on the overpowering player! Hate-lists are used extensively in MMO games nowadays, but unfortunately, actual hate is not presented as an emotion. The player knows that getting into aggro range or attacking an NPC will put him on the hate-list for that NPC/faction, and that’s all about it; there is no deeper gameplay meshing into this. There are precedents of using faction reputations to modify these hate lists, though. For example, a bad reputation that spreads from NPC to NPC, and that can be regained by bribing people with gifts or sweet talk is a simple attempt at creating an emotionally understandable explanation for hate-lists.
It would also be interesting if NPC’s actually differentiated between different levels of “hate”. A weak attacking NPC could cause them to run a script that just does a few weak blows, while answering to any new player attacks, while sustained damage to the NPC would send them into a frenzy mode, throwing everything they have at the player!
e) Actual AI: Ironically, the actual AI code is the hardest place to communicate emotions to the layers, because the AI code is rightly hidden from the players, and should be. The less intrusive and obvious the decision making process of the AI system is to the player, the more fun they will have figuring it out! However, there are ways to make your AI code behave more human. E.g. instead of calculating your main parameters (need, next state transition, etc.) in a single cycle and then applying them, try to come up with mechanics that allow for a smooth transition. Consider an FPS game with human NPC opponent.
Instead of calculating how much an NPC “fears” you and applying that right away, you could incorporate a buildup time during which the NPC will behave more and more “fearful”. At some point, the NPC will start the slow transition into panicking and do all kinds of random things, before it settles for the decision to run away from you. By blending these states slowly into each other, your AI will look a tad more human-like, though it might not be obvious to players at first. Enemies hesitating before they make their final decisions are another interesting vista that should be explored. Also, try adding random behaviors to the repertoire of the NPC AI, e.g. the NPC should occasionally just run away for good, or beg for mercy, and on rare events even betray that mercy. Do not make this a common game mechanic though; use it sparingly.
To Sum up, putting the “human”, or rather the C3PO into the AI code is probably the hardest solution to pull off, so you might want to go with solutions (a)-(d) before you try your hand at it. As always, comments are most welcome. Let me know if you know of other methods to get a semblance of “humanity” into games, and if you think that players would actually prefer a C3PO-style NPC over R2D2 practical “intelligent” problem solving or not.



Comments
Leave a comment Trackback