View more

View more

View more

### Image of the Day Submit

IOTD | Top Screenshots

### The latest, straight to your Inbox.

Subscribe to GameDev.net Direct to receive the latest updates and exclusive content.

# How do you handle NPC vision in 3d ?

Old topic!

Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

### #1Ingenu  Members

Posted 13 April 2000 - 11:09 PM

Designing a fantastic game, I''m thinking of the NPC. They must saw the PC, but how do they detect him, or environnment modifications ? I''ve thought of making one or more list containing the objects that have been moved and the characters. Using quadtree I might put the list as a ''cube'' var. Using portal I might put the list as a ''section'' var. The NPCs will check the objects in the list against their view frustrum and reacte appropriatly. Is there another faster/easier/best solution ? -* Sounds, music and story makes the difference between good and great games *-

### #2Kylotan  Moderators

Posted 14 April 2000 - 04:24 PM

For spotting the PC, I would consider some sort of ray-casting algorithm. If you cast a set number of rays from the NPC each time, this also accounts for characters being less obvious if they are further away (if that is what you want). Alternatively, cast a ray from the PC to the NPC and see if (a) it reaches without hitting something else first, and (b) it hits the NPC within their field of vision.

As for ''environmental modifications'', I think the simplest way would be to just set a flag, to say whether something is modified or not. Then assign a probability of detection dependent on the size of the object, how obvious a modification would be, and how close/how aware the NPC is. You can use the above method or some other to determine if it''s visible or not.

Not that any of the above ideas reduce the benefits of sectors, quadtrees, etc. It''s always good to be able to trivially eliminate a large amount of your database.

Old topic!

Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.