A minor pet-peeve about computer games - NPCs with 'knowledge' of your actions.

Ah, that’s a complicated tale.

Before WoW had any expansions, Hemet Nesingwary was out in Stranglethorn Vale, in the “old world” continent of the Eastern Kingdoms. Then the Burning Crusade expansion came out, and Nesingwary couldn’t resist the lure of new things to hunt. He relocated to the new world of Outland, settling down with a crew in the region called Nagrand, and left his son behind to continue the hunt in Stranglethorn Vale.

Now with the expansion of Wrath of the Lich King, the senior Nesingwary somehow manages to hunt both out in Nagrand (on another world, remember), and to have relocated to the newly-explored continent of Northrend on the original world, where he’s set up a hunt camp in an area called Sholazar Basin.

Barring the world-hopping tactics he’s undertaking (hey, if I can do it, so can he, right?), I like to non-canonically resolve the PETA-parody quest line with the friendly Nesingwary by saying that former associates of his have split off from his group, driven to madness by the lust to kill (why else would they attack other people on sight with no provocation?), and he doesn’t mention them out of embarrassment for ever having been associated with these madmen. Meanwhile, the Animal Huggers don’t realize there’s been a schism, especially with the killers still claiming to be Nesingwary’s hunting crew (a certain glamour became associated with being that skilled to hunt with him), and have targeted a more dangerous group while missing entirely where the old leader really is.

I’ve got two for WoW.

Last night, flying around Icecrown, a sentry dragon suddenly appeared next to me. Of course, being an NPC, it’s allowed to fly and shoot at me- and eventually it knocked me off my mount, so I fell to my death.

Okay, now I know. The next time I run into one, I’m flying close to the ground, so that if I get jumped by another sentry dragon, I can just land so I won’t die. It doesn’t work, though. I got jumped again, and managed to land before it knocked me off… and then it kept hovering out of melee range, shooting at me!

I’m playing a Death Knight- so I’ve only got, realistically, one method for dealing with ranged critters: Death Grip (which grabs the enemy and yanks him over to you). However… Death Grip can’t grab anyone who’s flying!

sigh. So I ran over a ridge, to try to break line of sight, to force him to come closer to me… and the bastard keeps shooting me *through *the terrain! Worse, his shots are ice bolts- they slow me down. I don’t even have a chance to run away. I die again.

So, basically, the damn things are just going to kill me. I’m forced to hug the canyon walls, and hope none of them get close enough.

However, there’s another “cheat”, one which I guess more than makes up for the cheating bad guys. With the proper video settings, I can see mobs a long way, sometimes out to the horizon. At least as long as a creature doesn’t just spawn on top of me, I’ve got plenty of warning so I can avoid him or plan my strategy.

The bad guys, though, are incredibly myopic- they can only see me if I get within their aggro range… which is typically about 50 feet or so. That particularly bugs me in instances- if the two guards sitting at a gate are sufficiently far apart, you can walk between them and they won’t even see you, even though you’re standing right in front of them. You’d think they’d have a better vision plan, in their line of work…

Games do all sorts of different things to handle the problem efficiently. A typical solution is to have a weighting fuction that determines how often individual enemies perform LOS checks. The function factors in things like distance from the player and alertness level. If an enemy is being shot at their alertness level should spike and trigger high-frequency LOS checks.

That’s overkill, though … no pun intended. :slight_smile:

Half a dozen rays traced to different parts of the player character’s bounding volume is good enough for almost every situation. Often a single ray to the center of mass is good enough.

LOS checks are one of those things that intuitively feel like they should be trivial for a computer to do, but actually are a lot of work. In the real world if I look out the window it’s obvious if I can see someone or not. But in a game LOS is determined by tracing a line from the AI to the target and comparing it to every single polygon in the scene to see if they intersect. If there are 10,000 polygons in the world geometry you need to test your line against each one every time you perform a LOS check.

(There are all sorts of culling strategies that can be used to keep this number as low as possible. For example it’s common to organize world geometry in groups surrounded by bounding boxes. You check to see if your line intersects the bounding box first, and if it doesn’t you ignore all the polygons inside.)

Alternatively, as **Projammer **points out, you can use the rendering pipeline to render a low-res version of the scene from the viewpoint of the AI. Either way you’re often talking tens of thousands of operations just for a single check.