on Aug 31, 2006
|All alone: This place can be pretty unnerving. It would be much less so if I had an NPC following me around looking relaxed and staring into space. The best way to keep NPCs from messing with immersion is to leave them behind.|
Immersion is one of those qualities like creativity or morale: There is precious little you can do to enhance it, and a million ways you can kill it. If the player is terrified while crawling through the enemy base, fighting foes in dimly-lit corridors while the walls breathe steam and the machinery casts threatening shadows onto the walls, he’s immersed. Then let’s imagine that something stupid happens. Maybe he finds some critical item like a key or a weapon just laying around or (worse) on display and free for the taking. Suddenly he’s pulled out of the game and remembers that despite the steam and shadows, this is still more or less a tenth-generation copy of the original Wolfenstein formula of gunning down bad guys and rounding up their key[card]s.
The quickest way to kill immersion is with non-player characters: NPCs. Friends and allies and such. I mentioned before about how your companion in Resident Evil 4 was such a goofy distraction that she killed any sense of fear the game was trying to build.
If an enemy monster is stupid (because its “brain” is just a couple of hundred lines of computer code running on a personal computer that is busy doing a lot of other stuff) it isn’t too bad. Hey, it’s a monster. It’s not supposed to be smart. But when a human character shows up the player expects him or her to act like a human. Then when they walk into the player’s line of fire, get confused by doorways, get caught up on scenery, or utter the same phrase for the tenth time, they are exposed as a fraud and the illusion of the gameworld is broken. NPCs have so many ways they can break immersion that it’s difficult to enumerate them all. I’ve written about AI mishaps in the past and how simple things can go absurdly wrong, but you don’t need AI to go haywire to break immersion. When dealing with NPCs, immersion can be destroyed even when everything is working right.
|On display: Players might throw stuff at your NPC. Shove them. Stand in the middle of their conversation. If you want NPCs to fill in the game world but don’t want to deal with all of the strange things players might do to them, just stick your actors behind a glass wall and let them read their lines when the player strolls by.|
“Following” is one of those things that seems obvious but is maddeningly complex in implementation. In old games, the follower would always be four steps away, which was annoying. As you wandered around the NPC would hover over you, dogging your steps and staring at you. What it needed was to stop once it entered a room and stand nearby while the player explored. Fine. But this means NPC’s have to understand rooms and spaces, which is a tricky concept. I’ve seen implementations where the NPC will simply try to keep the player in view. If it can see you, it stands still, if you move out of sight, it will move to catch up. Good plan, but you also need to take other factors into account. If the player had to navigate through something dangerous to get where they are, the NPC probably shouldn’t attempt to follow. If the player jumps into a deep hole, the NPC needs some sort of justification for continuing to follow this suicidal idiot. Fine buddy, you wade through the slime and brave the jaws of that big stamping machine. I’m staying here.
But what does the NPC do while waiting for the player? Stand still? If you don’t want the NPC to seem like a complete jerk, it needs to sense when the player is trying to walk though and step out of the way. More importantly, if the NPC is going to stand around, what should it look at? Having them look at something exceedingly dull with their backs to interesting scenery is no good. (Like turning its back on a huge window with stunning scenery to look at an air vent or a wall. This looks odd and people notice.) The same goes for staring into a pitch dark corner. However, the logic needed to sort this out is very complex. It’s a lot of work to just figure out which way to look, which is just step 1 of solving this problem. When they aren’t busy, people tend to move around, fidget, make conversation, or find someplace to lean / sit / rest, so NPCs ought to do the same. This translates directly into the need for more detailed models, more animations, more voice acting, and more scripting.
But we’re not done yet. The NPC needs to run to the player’s side if a battle starts. They need to be able to make the subjective judgment about friendly fire: Did the player just shoot me by accident or on purpose? That’s tricky. And then the NPC needs a proper response for each.
|Strike a pose: Another danger of having NPCs hang around is that if you’re not careful they will all assume identical poses. This can be distracting when they are standing close to each other. It looks like these guys are about to lock arms and start kicking in unison like Rockettes.|
People ask why AI sucks so bad? This is why: It’s hard, it’s expensive, and when it’s working right people don’t notice because they only notice when the thing screws up. The developer can spend money making the gameworld bigger, or spend money adding lots of detail to some inconsequential NPC just so it doesn’t kill immersion.
Half-Life 2 did a pretty good job with NPCs, although there were many habits they had that I found annoying. Quake 4 is even better, with squads of men working together for prolonged periods of time, who have speaking parts, and who pull all of this off without making obvious fools of themselves.
It may seem like a small detail, but in my book it’s a big leap forward. My hat is off to the AI coders / scripters at Raven software. Nice one guys.