Sign in to follow this  
jefferytitan

Making smart-seeming NPCs

Recommended Posts

jefferytitan    2523
Hi all,

I was just pondering on what aspects of a humanoid NPC make them seem smart/dumb. Personally I find that the moment an NPC loses believeability I stop treating them like a character and start treating them like an obstacle, a puzzle or a resource to be mined. It also becomes frustrating because I tend to lose my suspension of disbelief. What aspects do you think make the most difference? I have a few examples below:
[list]
[*]Bad pathfinding
[*]Lack obvious abilities, e.g. climbing stairs or fighting
[*]"Forget" that they know you
[*]Completely predictable
[*]Repeatedly fall for the same moves
[*]Bad/no gaze tracking, including talking to where you were when you walk away
[*]Lack of context, e.g. will talk to you about the weather when in danger
[*]Keep to script even when it makes no sense, e.g. talking to a dead comrade
[/list]
Look forward to hearing your responses.

JT

Share this post


Link to post
Share on other sites
jbadams    25676
A big one for me is repeating the same canned phrases too often, especially if those phrases are shared by multiple characters.

A lot of this comes down to simply adding more content to the game, or designing systems such that the content can be varied slightly and used only when it is appropriate to do so.

I'm not sure if this is really a question for the AI forum -- although it involves both NPCs and path-finding, it seems more of a design topic -- but as I'm not sure at this point I'll leave it here for now and the AI forum mod can move it if appropriate.

Share this post


Link to post
Share on other sites
jefferytitan    2523
I was unsure too. I could see the Game Design people batting it back here. [img]http://public.gamedev.net//public/style_emoticons/default/wink.png[/img] However I judged that it would touch on enough technical topics to fit here.

Share this post


Link to post
Share on other sites
3DModelerMan    1173
This article had really good information. It's applied to open world NPCs but I don't see why you couldn't learn from it for other genres.
http://gamasutra.com/view/news/174231/5_tips_for_making_more_believable_open_world_cities.php#.UFYbG41lRX8

Share this post


Link to post
Share on other sites
jefferytitan    2523
Dave, I'm a bit astonished at your reply. What I heard was "there's a bunch of tools in the toolbox, but let's not discuss what any of those tools are or how easy they are to use". You have been in the industry a long time. I have not. I literally don't know what half the tools are. I only read about gaze tracking quite recently. I could ask game designers to dream up something random that they want, but that would be ignoring (what I hope is) a wealth of existing techniques. Bang for buck I'd rather look into existing fields than strike out alone.

Share this post


Link to post
Share on other sites
IADaveMark    3731
[quote name='jefferytitan' timestamp='1347831686' post='4980720']
Dave, I'm a bit astonished at your reply. What I heard was "there's a bunch of tools in the toolbox, but let's not discuss what any of those tools are or how easy they are to use". You have been in the industry a long time. I have not. I literally don't know what half the tools are. I only read about gaze tracking quite recently. I could ask game designers to dream up something random that they want, but that would be ignoring (what I hope is) a wealth of existing techniques. Bang for buck I'd rather look into existing fields than strike out alone.
[/quote]

You completely misread/misinterpreted my reply. The discussion was whether or not we should kick this thread over to the design forum or leave it here. Reread my reply in that context.

[quote]Designers can come up with all sorts of things on their wish list... that's not the problem. The issue becomes how implementable are these wishes and, of course, how do we do it?
Let's leave it here for now.[/quote]

Makes a little more sense now, eh?

Share this post


Link to post
Share on other sites
jbadams    25676
[quote name='jefferytitan' timestamp='1347831686' post='4980720']
Dave, I'm a bit astonished at your reply. What I heard was "there's a bunch of tools in the toolbox, but let's not discuss what any of those tools are or how easy they are to use".[/quote]
I think you might have interpreted Dave saying "let's leave it there" as dismissing the topic, but I believe he was responding to me and electing to keep the topic here in the AI forum rather than moving it to game design.

I think it might currently be a bit open-ended though: it's hard to suggest appropriate techniques when such a wide variety of problems are being discussed all together - it might help to choose and focus on one problem at a time.

Share this post


Link to post
Share on other sites
jefferytitan    2523
Apologies, I did indeed misinterpret Dave's statement. I thought it was directed at me.

Let me rephrase the question: What techniques are there, and what is the bang for buck? I think there's no need to drill down into the individual details (although any linked papers would be appreciated). If I don't understand the details I can post a more specific question.

Thanks.

Share this post


Link to post
Share on other sites
Steve_Segreto    2080
This is a great topic ... pathfinding is the most obvious and mathematical problem to solve, but even with 100% perfect pathfinding, AI doesn't seem to improve considerably, especially in the face of the other problems that the OP posted.

I was just recently tinkering with Skyrim again and one thing that breaks immersion for me is when I'm in someone's house, they are sitting down and talking to me about the main plot line and other residents of the house wander around spouting their pre-canned responses.

Another immersion break is when someone is talking and I'm obviously not listening, because I'm running around jumping on the tops of their tables and counters throwing all their objects on the floor or bumping into them to try to push them down stairs. Its not aggression by Skyrim's definition because I haven't drawn my sword and taken a swing at anyone.

And a final gripe is the simple binary definition of "theft" that Skyrim has. I enter an Inn or a quest NPC's house and simply pick up an item from a counter or table (maybe accidentally or just to move it or get a better look at it) and suddenly I'm labelled a thief and immediately attacked :)

Share this post


Link to post
Share on other sites
Telcontar    1554
It may be helpful to break these up into actual logic problems (pathfinding, learning from experience, etc) and more cosmetic effects, such as gaze tracking. There are many games in which gaze tracking has no meaning. The idle chatter problems mentioned (such as talking about weather when fighting) might fall a bit under both, though.

In fact, as far as the problem goes, I think I would approach it by thinking about it first from action-only perspective. That is, I will not be worrying about immersion-only effects like chatter, gaze tracking, or variable dialogue. Unless we are talking specifically about Skyrim or other Elder Scrolls games!

One of the primary drawbacks of many games for me is when I start seeing discrete "types" in my enemies, and then am able to easily exploit this knowledge. Once I've played enough to be able to tell what AI scheme an enemy has - and thus predict exactly what they'll do under any circumstances - the experience starts to fall apart for me.

Share this post


Link to post
Share on other sites
adam4813    729
One way to make pathfinding a tad more "real" IMO is that when paths change, the NPC doesn't automatically know the new best route. Unless they can see ahead that the path has changed, why should they do a path check?

Share this post


Link to post
Share on other sites
IADaveMark    3731
[quote name='Steve_Segreto' timestamp='1347899509' post='4980930']
I was just recently tinkering with Skyrim again and one thing that breaks immersion for me is when I'm in someone's house, they are sitting down and talking to me about the main plot line and other residents of the house wander around spouting their pre-canned responses.

Another immersion break is when someone is talking and I'm obviously not listening, because I'm running around jumping on the tops of their tables and counters throwing all their objects on the floor or bumping into them to try to push them down stairs. Its not aggression by Skyrim's definition because I haven't drawn my sword and taken a swing at anyone.[/quote]

http://intrinsicalgorithm.com/post-playem/2011/12/skyrim-pardon-the-interruption/

[quote]And a final gripe is the simple binary definition of "theft" that Skyrim has. I enter an Inn or a quest NPC's house and simply pick up an item from a counter or table (maybe accidentally or just to move it or get a better look at it) and suddenly I'm labelled a thief and immediately attacked [img]http://public.gamedev.net//public/style_emoticons/default/smile.png[/img]
[/quote]

http://intrinsicalgorithm.com/IAonAI/2011/11/we-cant-think-of-everything/

Share this post


Link to post
Share on other sites
IADaveMark    3731
[quote name='adam4813' timestamp='1347905320' post='4980970']
One way to make pathfinding a tad more "real" IMO is that when paths change, the NPC doesn't automatically know the new best route. Unless they can see ahead that the path has changed, why should they do a path check?
[/quote]
While I agree with you in principle, that's actually not quite a clear as one would think. Many players gripe that an agent will continue on a path even when it is "obviously no longer valid." Players have a hard time separating out their own knowledge of the world from that of the agent.

Share this post


Link to post
Share on other sites
adam4813    729
[quote name='IADaveMark' timestamp='1347911778' post='4980996']
While I agree with you in principle, that's actually not quite a clear as one would think. Many players gripe that an agent will continue on a path even when it is "obviously no longer valid." Players have a hard time separating out their own knowledge of the world from that of the agent.
[/quote]

Good point. As mentioned though I was hinting at more "real" and not smarter [img]http://public.gamedev.net//public/style_emoticons/default/smile.png[/img].

Share this post


Link to post
Share on other sites
IADaveMark    3731
[quote name='adam4813' timestamp='1347915582' post='4981018']
[quote name='IADaveMark' timestamp='1347911778' post='4980996']
While I agree with you in principle, that's actually not quite a clear as one would think. Many players gripe that an agent will continue on a path even when it is "obviously no longer valid." Players have a hard time separating out their own knowledge of the world from that of the agent.
[/quote]

Good point. As mentioned though I was hinting at more "real" and not smarter [img]http://public.gamedev.net//public/style_emoticons/default/smile.png[/img].
[/quote]
Which is exactly the point of vast swaths of my book... solving a mathematical equation doesn't simulate what real people tend to do.

Share this post


Link to post
Share on other sites
jefferytitan    2523
I have a few thoughts on some of the Skyrim-style bugs. I'm just spit-balling here, so there may be better techniques or massive flaws, but here goes:
[list=1]
[*]Trust - trust can be earned or lost various traditional ways. Also if a crime occurs while an NPC isn't present, they will apportion blame proportional to existing distrust of the major suspects (e.g. people seen in the vicinity of the crime shortly before or after). Trust/distrust will slowly decrease over time to x% of the maximum historical value.
[*]Aggression - will have a range of values. These can be expressed in ways such as rudeness, refusal to talk, refusal to trade, non-lethal fighting or lethal fighting. Causing aggression in a neutral/good character could be considered a minor crime.
[*]Personal space - NPCs try to maintain personal space. A non-trusted party (or one already aggressive towards) invading their personal space will increase aggression.
[*]Situational awareness - NPCs try to maintain sufficient information to meet their goals. For example, if expecting combat they will seek a good viewpoint to spot enemies. If a shop owner they would try to keep an eye on their goods, especially when untrustworthy people are around. There would be some measure such as the value of an area vs how long since it was last viewed. If they are unable to fulfil this their aggression would go up (a little, with capped increase). This would need to be balanced against goal seeking.
[/list]
How would this help? Well, as Dave Mark indicated, unless there's a "remove bucket from head" action, it won't fix everything. But what would it achieve? Well, you approach shopkeeper A with the bucket. They try to maintain their personal space. You forcibly invade their personal space, causing some aggression. The bucket reduces situational awareness. Over time this increases their aggression more. Shopkeeper B isn't aware that putting a bucket over a head is a bad thing, but senses the growing aggression of shopkeeper A and partly blames you (and potentially others) due to proximity. You are probably blamed more than others because invading A's personal space reduced trust in you. Bucketing B would be harder because of the aggression and distrust. But say you achieve it. Then you steal goods. Hoorah. But when you take the buckets off, both shopkeepers are aggressive, the losses will be noted and partially attributed to you, and a fight or refusal to serve may ensue.

Is this bullet-proof? Heck no. If your chosen role in life is to de-bucket bucketed shopkeepers, you're going to get a lot of flak. And I'm sure many other bad behaviours could spring from it. But is it worth investigating? And if not, what is?

Share this post


Link to post
Share on other sites
Daaark    3553
The problem with some of the things in the first post is that a lot of things are queued up, and then they go down the list and act on every action item in their list. The dead NPC was alive and a valid object when the action was queued up, but somewhere along the line they died, or became invalid. You have to draw the line somewhere, and you can't have an infinite loop of validity checks.

A lot of games run on scripts now that fire off when their triggers are toggled, but all these scripts and events are only self aware, and have no idea that it is not an appropriate time for them to be playing. This happens in games like Red Dead Redemption, or Skyrim.

A lot of RPG NPC characters try to do way too much these days anyways, and they end up as an annoyance instead of having a good effect on game mechanics. They just need to stand behind a counter and talk. They don't need to sleep, wander around the town square, go to the tavern, etc... If I walk in at midnight, just have him say a line about how I woke him up or whatever. In Skyrim they are either out on errands, or stumbling around their shops like drunks and knocking everything over due to an over zealous physic system. Everything they do other than standing behind their counter and selling me stuff is counter productive and lessens the experience.

Path finding is a flawed concept. Go stand around in a crowded public place and watch how well actual living creatures are able to path find. We are too distracted with whatever else is on our minds or smart phone screens. Even animals bump into or walk over each other! But when NPCs in a game do this, we call it unrealistic.

Path finding in 3d spaces is very time consuming, and it's often done very crudely just to keep the game running at a good speed. Pathfinding functions will often give up if they are taking too long, and then try again in a second or two. You'll end up with a NPC running in place against a wall until then!

Share this post


Link to post
Share on other sites
Ashaman73    13715
Well, this is more of a game design view, or even art view, but I think that AI will suffer from the [url="http://en.wikipedia.org/wiki/Uncanny_valley"]uncanny valley effect[/url] even more than art. Games like Skyrim have made (arguable) great progress in AI compared to games a decade ago, still many people think that it is bad or [i]funny[/i].

A game design approach to this problem is some kind of stylization. Think of zombies, they are dumb and the current state of AI is able to simulate them good enough to be [i]believeable[/i]. An other game design approach is a rule based game. Communicate that the NPCs wil react or interact to certain rules and the player will be happy enough.

Share this post


Link to post
Share on other sites
Daaark    3553
I've played well over 500 hours of Skyrim, and I don't see anything that makes the NPC AI good or special. They just walk around on schedules and play back pre-recorded lines. It's all marketing speak!

Follower NPC AI is among the worst ever. Edited by Daaark

Share this post


Link to post
Share on other sites
IADaveMark    3731
[quote name='Daaark' timestamp='1347989095' post='4981301']
I've played well over 500 hours of Skyrim, and I don't see anything that makes the NPC AI good or special. They just walk around on schedules and play back pre-recorded lines. It's all marketing speak![/quote]
Their focus was no on making completely compelling villagers... there were more important things to do on a project of that size.

Speaking of which...

[quote]Follower NPC AI is among the worst ever.[/quote]

That is actually a fairly ridiculous statement. [img]http://public.gamedev.net//public/style_emoticons/default/dry.png[/img]

There is plenty they do very well. The problem is, the better AI gets, the less you notice it precisely because it looks normal.

For example:

[url="http://intrinsicalgorithm.com/post-playem/2012/01/skyrim-ai-weapon-selection/"]Weapon Selection[/url]
[url="http://intrinsicalgorithm.com/post-playem/2012/01/skyrim-points-of-interest/"]Points of Interest[/url]

Sure, there are things they could have done better... but "worst ever?" Not even remotely. Edited by IADaveMark

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this