NPCs and Immersion

By Shamus
on Aug 31, 2006
Filed under:
Game Design


Quake 4: Strogg Base
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 that much-sought quality in videogames that will make the player think and act as if they were really there. Immersion is a prerequisite for any sort of emotional response. If a developer wants the player to be frightened by a situation, sad over the death of a character, angry about a turn of events, or excited about overcoming an obstacle, they first need to convince them that they are part of the game world.

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.

Quake 4: Medic Lab
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.
Here is a challenging task: Have the NPC follow the player. The player character is a vortex of unpredictable actions and random behavior. What will they do? Crawl around in the dark looking for secrets? Climb over things trying to reach a high ledge? Start gunning down their own teammates? Shoot stuff at random? Use explosives to try and catapult themselves up to high ledges? Stand in place for five minutes while the player walks away from the computer and makes a sandwich? Even when the player is doing stuff that doesn’t make sense, they still expect those NPCs to react to their insane actions in a realistic way.

“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.

Quake 4: Marines and signal flares
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.
Once you code all of this, you can have an NPC that will be able to perform the thrilling task of following a human being around without looking too stupid. After all of this work, it isn’t going to impress anyone. (Except geeks like me who obsess over this stuff.) The best you can hope for is to not have your NPCs make fools of themselves.

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.

Enjoyed this post? Please share!

17Just 17 comments.

From the Archives:

  1. Anonymouse says:

    Agreed. While most of the Half-Life 2 named NPCs (Alyx, Barney, etc) were okay, the fighting squads were mostly useless and got in my way. I was more immersed in the game when they were not around.

    Sometimes the NPCs do add to the immersion. One I remember is the Blast Pit level in Half-Life 1, where the Barney says, “Ssshhhh! That thing ‘ll hear you!”

    Also, a quick note on the site design: It looks nice, except that links should be blue and underlined, not just plain red. They could even be blue OR underlined, but just plain red doesn’t say “Click me.”

  2. Shamus says:

    Thanks for the suggestion on the links. I agree. Next time I update the theme I’ll make the links more… link like.

  3. Will says:

    Turning on the developer commentary in HL2: Episode 1 was what really alerted me to how much mind-numbing work goes into making the NPC’s (at least main characters) behave like actual human beings. Now if Gordon could only go all the places Alex can, they could make the game even less frustrating (at times).

  4. Steve C says:

    I agree with you Shamus on NPCs killing immersion but I know a game that is an exception to the rule: ICO (PS2). It was NPC following you around that made that game so good and really made you care about the characters. I’ve had the same attachment to characters in a book before, but never in a video game before or since ICO .

    Like you said, you need to use the proper controller for the type of game. In this case you have to play with a dual force vibration controller… it’s a must for true immersion in this game. It took 10 hours to finish (5-6 hrs the 2nd time) and given everything you’ve said Shamus about your personal gaming preferences, I think you would really enjoy it too.

  5. Brickman says:

    I’d say that, assuming that any NPC following the player around is a soldier (simply because an important NPC who can’t fight tacked onto the player is such a breach of fun that you don’t want it in the first place, an unnamed nonfighter who couldn’t be easily written out is rare and any sequence that doesn’t involve fighting is probably completely scripted anyways), have them cover the doors until they need to do something else. As in watch the door with their gun pointed at it, in a cautious or aggressive pose, and then occasionally shuffle a few feet over into a different position or to the other side of the doorway. Of course, you can’t do this ALL the time, but doing it at least some should do wonders for immersion and if they did it every room for ten rooms in a row it’d still be better than any other action all ten times. Still, this is the copout version.
    NPCs in story scenes that don’t involve combat should, of course, always lead the player, and if they don’t follow quickly wait for them tapping their foot and urging them to hurry up.

    Oh, and yeah, NPCs in Half Life were pretty ok, but it absolutely destroyed my immersion every time it came up that one of them could not jump, crawl or even climb ladders like Freeman could. Which was often, and especially bad in #1 (not only did they do less when they couldn’t follow you, but simply not being able to climb a ladder or jump was very, very often the method of choice for permanently leaving behind useful security guards at the end of the area the developers wanted them in, wheras the second used a logical explanation for leaving behind a squad even for a room or two).

    It’s only really a problem, though, if you’re using a 3D (or pseudo-3D) graphics thing and real time and so on. In other words, if you’re in an action game. I certainly didn’t find myself asking “Why is that guy just standing there” while playing, say, Avernum.

  6. I think the biggest pains in NPCs were Star Trek: Voyager Elite Force.

    My health is low. One shot and I die. My health won’t regenerate fully when I re spawn, it will stay low! I am leading a squad of Elite warriors. They absolutely feel like following me but there is no command to tell one of them, just one, to take the lead so I don’t take all the fire and die! I’m dying because these idiots, healthy as they are, won’t take single stun shot for their commander.

    Of course, the worse part of that level was the end-cinematic’s revelation that all my NPCS who died (as part of the plot) were still alive in stasis pods (as part of the plot) because the aliens wouldn’t just kill so wantonly. All the NPCs got teleported into pods. Well, whenever I died I didn’t get teleported into a stasis pod! I died! PERIOD.

    That level sucked! Great game.

    • WJS says:

      While I agree about the NPCs, I don’t get what you’re whining about regarding “I really die!”. Does it really matter if you’re literally killed or only mission-killed? Either way, you aren’t going to be completing the mission. Would it have been better if the game moved you to a pod and then just sat there, waiting for you to quit back to the menu?

  7. B. Kaveh says:

    It is hard to fault any games for trying to fill up the static space of a level with lots and lots of “interesting” NPCs; some of those NPCs are bound to get neglected in their design, animation, AI and dialog. I don’t think NPCs are a major factor in creating immersion, though as you said, sometimes they really contribute to breaking it.

    Immersion is a state where the player start to imagine his next move and the response of the environment to it, as opposed to merely think about it or plan ahead.

    Creating that state of mind is possible, and there are established methods to do so (look at Hollywood’s better productions). Creating a sense of wonder and awe, creating painful moments, unpredictably scary situations, fast-moving action, pacing (i.e. changing the speed of actions and scene changes in a pattern that has been proven to be interesting to most of the intended audience), etc. when done in a meaningful and interesting setting all contribute to immersion, be it in art, movies or games. Additionally, in games, you need to take extra steps like making the UI and controls totally invisible to the player, etc.

    Immersive gameplay can and should be analyzed through the study of the human psyche, and not through mere observation of what breaks it. If we want to understand the whole concept we have to see both sides of the coin: what makes it, and what breaks it.

  8. im a mapper for elite force, and recently ive been messing around with single player mission parts of my mapping program. now, as youve been saying, the allied NPC’s can be annoying, but isnt it nice to have them around in situations when there is an army of nasty reavers trying to rip your head off and feed it to you? you see a bot walking into the army and running round in circles shooting at the enemies. sure they are acting stupid, but you look at them and go, “ha, the things gone wrong! but i dont care, its stopping me getting eaten.”

    sometimes bot stupidity is fun to watch and helps you out alot.

    now, my problem is that when i make my own SP maps, only 1 kind AI appears, and thats the giant worms from the scavenger station. sure, they appear but they just sit there. they do nothing, even if i shoot them.

    if you know how to fix this problem please email me at

    =) i love bot stupidity

  9. Chris Arndt says:

    well, the bots are programed to not do my work for me.

    But just the simple command, “Take the lead” would help.

    “Be a human shield is fine”

    I mean X-Squad for PS2 had a “take the lead” sort of thing which allowed me to sacrifice my squad for the short-term advantages. But at the very least I’d like my Voyager Elite Force chumps to help me find health, or delay my death so I can find health.

    Although immersion in the game was seriously compromised when I found out that the fate of the NPCs if killed in that level was the opposite of my fate if same events had befallen me.

    That said, immersion has a varying definition for every game, and different sorts and levels of immersion are intended for every game, which was why Shamus’s review of Metal Gear Solid series was unfair. It was like taking shots at Mark Lowry for not being Lewis Black. Good job.

  10. Jeff says:

    Quake 4’s NPCs did rock, surprisingly.
    I liked to bind spawn commands to my keypad, and wander the game spawning them and letting them do the fighting while I watched. It was great fun.

  11. Andrew says:

    Here’s an idea for immersion: if you equip a full helmet in a medieval game, you shouldn’t just get a ” 3 defense, -3 accuracy”, or something like that. Your vision should be obscured by the helmet, just as your character’s is. Sounds should become muffled, and be in mono, costing the player the ability to accurately “hear” where an enemy is. If someone smashes your helmet with a hammer, the expected assault on your ears should ensue. If you try to use a sword, but lack the prerequisite strength, you shouldn’t simply be forbidden: you still can, but your character will have obvious trouble using it with the simplest swings. If you have no physique and want to use a crossbow, nobody’s stopping you; you’ll simply lose accuracy because you can’t absorb the recoil, and loading it will be either slow or impossible. Instead of a message box telling me I can’t do something, I should be given hints that allow me to come to that conclusion myself; or, if I’m really stubborn about wielding that Giant’s Sword Of Hugeness, I can equip it, and simply live with the penalties incurred. Elements like this are the sort of thing I really wanted in games like Oblivion, and although they would undoubtedly be a pain to implement, the added realism would drastically improve the game’s immersion factor.

    • WJS says:

      Spoken like someone who’s never worn a helmet in his life. Wearing a helmet does not make someone half-blind! The worst case is a little peripheral vision lost, and guess what? You don’t have that in a videogame anyway! Your FoV is already smaller than that of someone wearing a helmet.

  12. H.T. Black says:

    It’s a good thing you threw out that tidbit about Half-life 2 at the end; I would’ve had to use the magic words otherwise.

    …Alyx Vance.

  13. […] It could be a lot worse. The task of actually writing an intelligent non-player character is a very difficult one. But we are getting better at it. Before too much longer, we will have computer programs capable of […]

  14. […] It could be a lot worse. The task of actually writing an intelligent non-player character is a very difficult one. But we are getting better at it. Before too much longer, we will have computer programs capable of […]

3 Trackbacks

  1. […] NPCs and Immersion @ Twenty Sided […]

  2. […] It could be a lot worse. The task of actually writing an intelligent non-player character is a very difficult one. But we are getting better at it. Before too much longer, we will have computer programs capable of […]

  3. […] It could be a lot worse. The task of actually writing an intelligent non-player character is a very difficult one. But we are getting better at it. Before too much longer, we will have computer programs capable of […]

Leave a Reply

Comments are moderated and may not be posted immediately. Required fields are marked *


Thanks for joining the discussion. Be nice, don't post angry, and enjoy yourself. This is supposed to be fun.

You can enclose spoilers in <strike> tags like so:
<strike>Darth Vader is Luke's father!</strike>

You can make things italics like this:
Can you imagine having Darth Vader as your <i>father</i>?

You can make things bold like this:
I'm <b>very</b> glad Darth Vader isn't my father.

You can make links like this:
I'm reading about <a href="">Darth Vader</a> on Wikipedia!

You can quote someone like this:
Darth Vader said <blockquote>Luke, I am your father.</blockquote>