Take the 2-minute tour ×
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

I'm thinking of stealth games where an object has a certain field of view that you want to avoid otherwise game over.

The field of view may be linear or circular or any arbitrary group of pixels/tiles.

If I don't consider obstacles (for example, if you're standing behind a wall, they can still see you), I can determine whether the player is within an object's field of view using simple geometric properties using the two object's positions and range. This can be done efficiently, though it kind of assumes the objects are points.

However, to make it realistic, you should be able to hide behind a wall or a tree without being seen.

How is this problem usually solved?
What are some articles that I can read to understand more about this problem?

share|improve this question
add comment

1 Answer 1

up vote 3 down vote accepted

Basically, you're going to be doing raycasting to figure out where exactly the vision gets blocked. The complexities come in with trying to make that clean and efficient and fit with how you're managing the actual scene. Other people have done a much better job explaining everything than I can, so I'm just going to reference them.

Amit has a fantastic overview here, and there's another great one here. For the second, there's also some relevant discussion here. Note that these are for 2D games, but the concepts are still the same for 3D.

share|improve this answer
    
Briefly looked at the visibility-related articles and look pretty good so far (with nice images as well). I'm focused on 2D at the moment so this would be perfect. –  MxyL Mar 25 at 18:08
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.