111
\$\begingroup\$

Are there any recommended blogs or whitepapers that talk about making the AI in an RPG game feel more real? (Specifically in turn based combat.)

I know something must be out there, but I am only finding papers that talk about algorithms behind the AI. I am looking more along the lines of "this is what makes a computer opponent feel alive". Taking risks, going easy, retreating, etc....


So many awesome answers, and I wish I could accept several of them. Thanks everyone!

\$\endgroup\$
5
  • \$\begingroup\$ If the computer comes up with a strategy, that makes it feel more alive. FEAR's AI was praised because it would flank the player (among other things) (though I believe much of that was actually scripted) \$\endgroup\$
    – thedaian
    Commented Aug 29, 2011 at 18:50
  • 10
    \$\begingroup\$ Its death animation. Bang. No but seriously, using the environment against you. And making mistakes -- but clever mistakes. Right? Like someone who has foresight, only he made the wrong assumption at some point in his chain of reasoning. \$\endgroup\$
    – Engineer
    Commented Aug 29, 2011 at 18:59
  • \$\begingroup\$ It is not clear if you want that the computer characters feel alive or that you may have the impression to fight against another human player just like you that controls all computer characters? \$\endgroup\$
    – Nikko
    Commented Aug 30, 2011 at 13:35
  • 4
    \$\begingroup\$ How to make a computer feel alive : watch Bladerunner again ... \$\endgroup\$
    – Kheldar
    Commented Aug 30, 2011 at 14:36
  • \$\begingroup\$ You might want to read this. It uses fuzzy logic over a decision tree. \$\endgroup\$ Commented Nov 29, 2011 at 10:22

10 Answers 10

114
\$\begingroup\$

Mistakes. Nothing is worse than an AI opponent who can headshot you from fifteen miles away, or always picks the perfect winning strategy. It breaks the immersion and makes it apparent that you're playing a routine. Mistakes can make the AI seem more human.

Many FPS games force the AI to miss with its first few shots, warning the player that the AI is there, before going for the kill.

Strategy games could sometimes select a suboptimial strategy, or when evaluating threats may purposefully ignore some proportion of them.

A racing game I worked on calculated when the player was nearby, and then rolled a dice to make the AI cars in front of him understeer through the corner or blow a tyre. It was praised for its realistic AI.

However creating imperfect AI is still something of a challenge. You have to make convincing mistakes, at a convincing rate, rather than perform perfect action after perfect action until making a ridiculous blunder. That can be even worse than playing just a perfect AI. For instance, the programmer working on the racing AI above spent a lot of time on modelling how a car understeers, and what inputs the AI needs to make to cause a convincing understeer. As always, playtesting is vital.

Here's a good article on what goes into producing these kind of mistakes: http://www.gamasutra.com/view/feature/3947/intelligent_mistakes_how_to_.php

\$\endgroup\$
6
  • 42
    \$\begingroup\$ "Many FPS games force the AI to miss with its first few shots, warning the player that the AI is there, before going for the kill": In GURPS we called this Imperial Stormtrooper Marksmanship Academy training. \$\endgroup\$
    – chaos
    Commented Aug 29, 2011 at 21:17
  • 4
    \$\begingroup\$ Too many mistakes and it's a dumb computer. \$\endgroup\$
    – LarsTech
    Commented Aug 30, 2011 at 2:27
  • 33
    \$\begingroup\$ Infinite energy is created by placing a bunch of red-shirt guys in a jail cell next to a bunch of storm troopers. The storm troopers can't hit their target, and the red-shirt guys have to die. \$\endgroup\$
    – zzzzBov
    Commented Aug 30, 2011 at 4:58
  • \$\begingroup\$ I do get the point of the answer and I think about the line between perfection for a computer and perfection for a human being. What does change? A great quake3 player like fatality in what is different from a cpu at nightmare level? \$\endgroup\$
    – Pitto
    Commented Aug 30, 2011 at 13:41
  • 1
    \$\begingroup\$ I calculate all possible moves an AI can take, assigning weight to moves based on the circumstances and the AI's assigned personality traits (such as bloodlust, afraidOfDeath, anger, etc). This works great for scenarios like: you and the AI are about to die, a straight-forward AI would shoot you then grab the health pack, but an AI high in afraidOfDeath will try and beat you to it. Unless they have high anger or bloodlust, then they just shoot until one of you is dead. \$\endgroup\$
    – user9313
    Commented Aug 31, 2011 at 20:40
46
\$\begingroup\$

Others have talked about AI, logic, planning, and the importance of making mistakes. And all of these are good and useful in the development of AI.

But the question was about what makes a computer opponent feel alive, and that isn't achievable through AI. It just isn't. Players don't judge a character in a game based upon their strategic level choices; they judge it based on much smaller things.

To make a computer opponent feel alive, what you need is a comprehensive set of high-quality animations and sounds (vocals, especially) for the opponent. The player can't see the AI. He can't hear it, he can't experience it, he can't know what the opponent is thinking. The appearance of "this character is a living entity" is presented to the player entirely through the animations playing on the character, and the sounds being produced by the character (which again, will mostly be vocals).

It's important for the character to react to stimuli around him; to look at things nearby, to touch objects nearby (when appropriate to do so), to appear startled when surprised, and to show other emotions when appropriate.

When talking about these things, it's important to minimise repeats. If the character uses the same "attack" animation every time he attacks, he's never going to feel alive. If he plays a single looping "idle" animation when he's not doing anything else, he's not going to feel alive. If he says the same voice quip twice (especially consecutively), that breaks the illusion that the character is alive.

And that's pretty much it. If the opponent that you're trying to make seem alive is physically present in your game, then your success at making them seem alive will mostly be determined by the graphics and sound shown to the player.

If the opponent that you're trying to make seem "alive" isn't actually present in the game, as is the case in Chess and StarCraft, then feel free to disregard this reply; your best bet is to follow the AI-focused replies.

\$\endgroup\$
8
  • 4
    \$\begingroup\$ Reminds me of all the enemies in Mass Effect shouting "ENEMIES EVERYWHERE!" every 2 seconds. \$\endgroup\$
    – Dashto
    Commented Aug 30, 2011 at 19:01
  • \$\begingroup\$ I wish I could up-vote this SO MUCH MORE. I've worked on two triple-A FPS's and can't emphasize how important quality animations (peeking, gesturing, moving) and audio (saying intent, questioning, conversing) are to creating a great environment. AI isn't about beating the player, it's about conveying realism, a huge portion of realism is how we move and sound. \$\endgroup\$ Commented Aug 30, 2011 at 19:14
  • 1
    \$\begingroup\$ +1, good points. Made me think of Oblivioneque games where your attempt to interact with an NPC sometimes is hindered by them sitting up in bed, turning sideways, standing up, and finally facing you, before finally acknowledging your presence... that always messed with my immersion. \$\endgroup\$
    – zenzelezz
    Commented Aug 31, 2011 at 13:34
  • \$\begingroup\$ Agree that this makes a more immersive gameplay, disagree that it makes it more human. Ever watched how many HUMAN players behaves in most multiplayer games? In some games, half of the players are jumping around for no purpose and the other half are spamming the voice chat with the same voice clips twenty times a second. The bots are often better behaved than the humans. \$\endgroup\$
    – Lie Ryan
    Commented Jun 14, 2013 at 3:47
  • \$\begingroup\$ One of the way you can make an AI looks human is probably to make them ragequit if they keeps getting killed. Or attempt to trick a new player into trading expensive items for useless bling. That wouldn't be a fun game to play, but at least the AI will feel "alive". \$\endgroup\$
    – Lie Ryan
    Commented Jun 14, 2013 at 3:51
33
\$\begingroup\$

Here's a list of some simple concepts that can make your opponent more vivid:

  1. Intent
    Give the player some way of divining the 'intent' of the AI. This could be as simple as having them yell out "Quantity over Quality" before attempting an accurate headshot attack, "Flank him" while attempting to get behind you, or "Take the leader, nothing else matters" before attacking the protagonist. You could also get more complex, for example, have them give some sign language to their teammates, then change the behaviour of those teammates.

  2. Desperation
    As the opponent gets closer to death, you can give them a sense of desperation. Change their tactics at certain health milestones. Make their later stages more panicky, with greater risk taking on their part (going for the hail mary, rather than slow chipping). Visually communicate this as well (more exaggerated animations, pulsing veins, etc).

  3. Go out with a Bang.
    Give them a death that makes the fight with them something worth repeating. Grunts keel over animatedly. Bosses soliloquize. If it's a proud character, make them refuse to give you the kill, and deal the last of their damage to themselves. You get the drift.

\$\endgroup\$
6
  • 4
    \$\begingroup\$ Hi. You really do not have to write you qualification into your answer. Fill into your profile and if somebody is interested if you know what you are talking about, hi clicks at your name. That's it ;). \$\endgroup\$
    – Notabene
    Commented Aug 30, 2011 at 7:04
  • 1
    \$\begingroup\$ The intent point is a good one. A good strategy is to have your AI teammates (if they exist) call out what the opponents are doing - "they're flanking!", "they're reloading!" etc. In fact this strategy is quite effective even when the enemy AI are doing no such thing. :) \$\endgroup\$
    – tenpn
    Commented Aug 30, 2011 at 9:49
  • 1
    \$\begingroup\$ @Notabene, not disagreeing with your comment, but as a note - you have the rep to edit out the extraneous information yourself. :) I just did the edit, but it's "subject to review" for me. :) \$\endgroup\$
    – Cyclops
    Commented Aug 30, 2011 at 13:05
  • 2
    \$\begingroup\$ @Cyclops. Yes i considered that. But it could feel pretty rude without proper comment and i wanted to let Jordaan to decide on his own about it. I mean that friendly of course. But lets stop destroying good answer with of topic comments :] \$\endgroup\$
    – Notabene
    Commented Aug 30, 2011 at 14:29
  • 3
    \$\begingroup\$ Hey. Just to let you all know, I included the Bachelor Degree line as a form of self-deprecation. Here in Australia, a Bachelor of Games degree is not worth the paper it's printed on. There was no intent to brag. "Here's some obvious advice thats the culmination of my wasted $30,000 and 3 years of study". Sorry if I didn't convey that correctly. \$\endgroup\$ Commented Aug 30, 2011 at 23:53
23
\$\begingroup\$

I do recommend this google IO talk it is about google doodle pacman. At cca 18:00 they start to speak about personality of ghosts in pacman. It is really stuning how simply you can put personalities into the simple path finding.

Google I/O 2011: The Secrets of Google Pac-Man: A Game Show

Whole video is worth watching. I really recommend it.

\$\endgroup\$
2
  • \$\begingroup\$ Not really answer the question, but could be inspiring... (i guess) \$\endgroup\$
    – Notabene
    Commented Aug 29, 2011 at 20:40
  • 12
    \$\begingroup\$ I'd say it's a valid Answer. The Question was about how to make a computer opponent feel "alive", and designing the ghosts' personality does exactly that. \$\endgroup\$
    – Cyclops
    Commented Aug 29, 2011 at 21:26
14
\$\begingroup\$

I don't know about any such blogs, but since a tactical turn-based RPGs is my second favorite genre right after roguelikes, I'll write you a blog post. From my experience, it was not a difficulty of tactical AI in a RPG or RTS which often put me off, but its opposite: AI's complete short-sightedness and absence of team decisions. Human will never play like this.

Back then, when I still viewed JRPGs as a pinnacle of game design, I once tried to make a "typical japanese TRPG" with heavy focus on tactical turn-based combat like Final Fantasy Tactics. As always, it became just a tech demo for pathfinding and AI, so I'll share my thoughts on the subject.

Most of these TRPGs don't bother with AI much. Player's fun out there comes not from a complex tactical or strategical challenge, but from general farming and abusing AI in a funny way. So it doesn't matter much that their AIs do things no human would ever do. Usually it's sufficient to have a stupid AI and balance it out with game design in way that it never needs to see more than one move in advance and only use best short-term moves. Of course it never feels real, but who cares? This just feels wrong, I want to believe it is possible to create fun based on a battling complex AI actions instead of farming and steamrolling. Unnecessary maybe, and time-consuming as well, but possible.

Remembering original Final Fantasy Tactics and its hardcore mod FFT 1.3, I set the following goals for human-like and fun to play AI:

  • AI must create a challenge, but a fun challenge and not a "human full search" challenge. This fun challenge should be often expected by player via overall context of a current mission. Usually thats where scripts come into play creating a one trick pony AI.
  • AI should be clever, but not deep Minimax clever. Different types of AI should have different flaws, just like different human personalities would. It's a rare thing to encounter in games, Advance Wars had scripted personalities for generals, for example, but units can have them too.
  • AI must avoid looking dumb when it is not intended. Obscene stupidity completely ruins any illusion of intelligence, always winning strategies do so as well. And loopholes created by careless scripting, those are the worst.

I thought that I will tackle #1 with emergent behaviours, #2 with different personalities and human-like "semi-random" strategy choice, #3 with keeping hard-coding to a minimum and a careful testing.

So what are these behaviours I'm what talking about, is it a scripted sequence of abilities to use? A top ability from a weighted list? Nope, what I had in mind was a combination of a desired intelligence, personality type and a role derived from currently available abilities and weapons. You can describe this combination as a "stupid berserking damage dealer" or "smart defensive healer". So AI specializations, like classes or professions, e.g. an Archer AI which uses bow to shoot arrows with some set of predefined generic archer ability combos like Take Aim or Arrow Shower, become logically emergent instead of hard-coded.

Basically, it is important to detect and operate on these roles: damage dealer, damage soaker, disabler, skirmisher, healer, buffer/debuffer, area of effect'er; usually, one character will perform at least two of these roles.

To make a tactical fun out of this we want for behaviours to handle several cases solidly:

Simplest case. A lot of weak goblins ambush our heroes. Perceived threat is obvious, goblins will try to overwhelm player with each goblin having a stupid berserk personality with some primitive melee abilities, perceived weakness is also obvious, like baiting goblins to a single armored and fire-resistant character, then casting a series of fire-based AoE spells in that general direction. Find a damage soaker, find an AoE'er, specialize the damage soaker for AoE'er damage type, send the damage soaker to the goblin mass, cast a damaging AoE spell when goblins group around.

Usual case to test out simple team interactions. Player encounters a knight, an archer, a mage and a cleric. Perceived threat is now more complex, various interactions become available. YOu can already see possible roles and its combinations. Cleric will buff and heal, mage will dish out complex but high-damaging magic things, knight will either charge someone or defend a mage, archer will help knight by sniping those who try to run away from him or making his defence strategy more comple, this will depend on knight's choice. Personalities for enemies may be decided randomly turning the same encounter into unique experience. Player will have to decide what is the best strategy with units he currently has, and if AI would try to do the same on the other side of the screen, it would be interesting.

Complex case to test out team interactions and strategic planning. There is a battle where you confront a gang of four assasins (clever careful damage dealer+skirmisher). Few in numbers, with menacing appearance, their perceived threat lies in skillful and deadly attack, and perceived weakness is that it's easy to reduce overall strength with just a single assasin killed. So naturally they're clever, they use abilities that work well with each other and can focus fire player's most dangerous characters; seriously injured ones retreat, heal and buff themselves to rejoin the battle. Obviously, player will try to nuke one of them first, and assasins will have to soft-counter this easy strategy, so it will be a less dominant.

Hard case for lots of strategy. There are several squads of enemies with each squad leader deciding best local tactical moves, and then a best global strategic decision is selected to benefit all squads.

Impossible case. Add a general to decide a strategy, and have squad leaders implement it to the best of the squads abilities.

It's a lot of letters already, so long story short, implementation was a mess and I never got past a "hard case", but even then this approach to a fun tactics felt doable. I started with FSMs but had to abandon that approach quickly, it became an entangled mess of states and transitions impossible to debug. After a while I settled with semi-autonomous ability perception based characters as in "sense-think-act" paradigm with behaviour trees for possible individual actions, a global strategy affecting possible team actions based on possible individual actions, also a bastardized version of something like N-Gram statistical prediction was tossed in.

How has this worked out? Surprisingly well, AI even read my mind several times, but I grew tired and abandoned it since there were more than enough convincing flaws:

  • The biggest flaw was that sometimes the entire AI operation was just weird and chaotic, even though I punished quick change of strategies. Probably either strategy logic or wrong personalities were a culprit, but I never found out. Yep, code architecture was horrible.
  • Fine-tuning desired scenario by a careful selection of available abilities and personalities is tedious.
  • Ability tagging for roles should be done very careful, or some wacky combos would appear.
  • Same for personality tagging, but instead of wacky combos you would see careful casters buffing for frontal assault.
  • It was hard to decide on a "cleverness" level for a given ability.
  • Some seemingly stupid decions which were required for a level-design like "hold this castle wall no matter what" had to be implemented in a hackish way.
  • Planning for units to perform a time-based attack was also a hack.

I guess my approach was mediocre at best, if not outright bad, and AI was buggy and pain in the ass to develop further, but even then I had some really fun time playing against it, almost as if playing with a distracted kid, which is still better than Tactics Ogre :)

\$\endgroup\$
5
  • \$\begingroup\$ I found some of your ideas quite stimulating, and with some tweaking, may improve the AI on a sim I'm working on. \$\endgroup\$
    – jumpnett
    Commented Sep 1, 2011 at 18:10
  • \$\begingroup\$ @jumpnett Good to know, I was hoping that at least a general idea could be understood :) As a bonus you get to hear more of my crazy thoughts, now on your sim. Imagining a real-time sim, I think one of the most important choices would be a tidy task scheduler logic. I guess I would've tried to organize tasks that way: There would be main tasks with priorities, a "strategies" like "build a house" with prerequisites like "4 workers; 4x4 square of free nodes at point 10,10; 10 wooden planks; 20 stone slabs". Strategy will be considered done when all prerequisites are met. \$\endgroup\$
    – EnoughTea
    Commented Sep 1, 2011 at 20:13
  • \$\begingroup\$ Each prerequisite would spawn a sub-task to achieve corresponding prerequisite; sub-tasks can be parallel, sequential or even mutually exclusive. When task ends successfully, set it's prerequisite as complete. For example, "10 stones" task is sequential for "4 workers" and "4x4 place" tasks, since you can't gather stones without workers, and you can't place stones without a place, but it would be parallel to a "20 stones" task, since you don't want a situation where you have lots of stone but no wood, and your workers are just standing around waiting for wood instead of using stone first. \$\endgroup\$
    – EnoughTea
    Commented Sep 1, 2011 at 20:13
  • \$\begingroup\$ Thinking about tasks in terms of prerequisites is generally very useful, like when a new strategy task is placed in a scheduler, you may want to know whether it can be started immediately or not. With this system you can easily gather all incomplete prerequisites of tasks with higher priority and check whether new task's prerequisites are conflicting with them. \$\endgroup\$
    – EnoughTea
    Commented Sep 1, 2011 at 20:14
  • \$\begingroup\$ The main bottleneck here is a resolution of sub-tasks which can not be completed. These comes in two kinds: 1) can't complete now and 2) can never be completed. generally for a #1 you'll want to create a new strategy with higher priority which will help previous strategy, and for #2 you'll want to abandon strategy forever. Thing is, it's hard to distinguish between these 2 kinds, can't really say much here. Well, maybe your approach is already like this, but maybe you will scavenge for some more ideas :) \$\endgroup\$
    – EnoughTea
    Commented Sep 1, 2011 at 20:15
5
\$\begingroup\$

Don't always make it respond to your action X with action Y. As you evaluate each potential action add a random fudge factor so the AI doesn't always pick the same option but it chooses something reasonable.

Evaluate if an attack has a reasonable chance of succeeding or at least doing meaningful damage. Too many games simply have scripted attack routes that a human can learn and use to ambush the AI over and over.

\$\endgroup\$
3
\$\begingroup\$

One thing I see suggested a lot is to have the AI communicate its "thoughts" to the player in some way. This is often done in first-person shooters by having the enemies (unrealistically) shout out their plans to the player (i.e. "flank him!", "he's over there!", etc.).

At the end of the day, players know they're playing against an AI, so anything smart that the AI does without first informing the player can just be dismissed as cheating.

\$\endgroup\$
2
  • \$\begingroup\$ In assasins creed When you were chased the pursuers would yell out "He's over here!" or "Where's he gone?" or some such to other pursuers. So IMHO: it can be realistic. \$\endgroup\$ Commented Aug 30, 2011 at 3:36
  • 1
    \$\begingroup\$ True, it does make sense in many cases, and it can depend on the context of the game. The guards in Assassin's Creed would have different ways of communicating than, e.g. a modern-day SWAT team. And often the realistic solution isn't necessarily the most fun; it can be frustrating to be constantly flanked by the AI with no warning. \$\endgroup\$
    – mrohlf
    Commented Aug 31, 2011 at 15:53
2
\$\begingroup\$

When talking about game NPCs most people associate liveness with intelligence, but emotion would probably be a much better indicator.

A hostage NPC in a bank robbery might just be sitting on the floor not doing anything "intelligent" but trembling, crying, holding a picture of family would bring an otherwise dull NPC to life.

The same thing is true for enemy NPCs. They would get enraged or fearful if you keep headshotting his pals. If you're sneaking around you could hear some rookies that are hesitant in going into combat. You could overhear their leader doing an inspiring speech to get the morale up.

Take a look at the Heider-Simmel Illusion where a psychologist shows that people have a tendency to see human-like behaviour everywhere, even in super abstract shapes. The video has no realistic animations, audio or models, but it has emotion.

\$\endgroup\$
1
\$\begingroup\$

Often, we think of "how do we create A.I.?"

That is skipping the big question, "What IS A.I. ?"

This talk from TED.com that I watched some years ago, shared a very inspiring approach to the definition of Artificial Intelligent.

If you want your players to feel that the enemies are "intelligent" then this will provide a high-level answer, and essentially a whole new way of thinking about A.I., which is the "ability to predict"

http://www.ted.com/talks/jeff_hawkins_on_how_brain_science_will_change_computing.html

\$\endgroup\$
1
\$\begingroup\$

To me, "feeling alive" means that the character act as you would think it would in real life.

People in real life have needs, motivations, fears, flaws. They talk, they react with each other if it is a group, they flee because they care for their own life.

If they are military or trained, they have tactics.

So maybe you should check in the field of human behavior, so in human sciences, not in computer sciences.

\$\endgroup\$
2
  • 1
    \$\begingroup\$ Hmm not sure about this. Above everything the AI has to be fun. Is it fun for enemies to flee? Surely it's more fun to fight them, since the whole point of the game is to fight? \$\endgroup\$
    – tenpn
    Commented Aug 30, 2011 at 13:20
  • \$\begingroup\$ It depends what fun you want. People find fun in simulations , others in arcade games... what's the one that feel more on par with real life? \$\endgroup\$
    – Nikko
    Commented Aug 30, 2011 at 13:24

You must log in to answer this question.