The shape you''re referring to is a cone!
![](smile.gif)
Anyway, here''s the simplest way: Keep track of a vector representing the direction the ai player is facing. Then, take the dot-product of that and the vector pointing towards the human player. If the angle is less than half of the field-of-view angle, then the player is in the field of view; otherwise he is not.
The dot product of two vectors, A and B, is expressed as follows:
A * B = cos(angle_between_vectors)*(|A||B|)
To find the angle between them, then you need to do this:
angle_between_vectors = acos((A*B)/(|A||B|))
The symbol |A| means the
absolute value of A. This can be calculated as follows:
|A| = sqrt(a.x
2+a.y
2+a.z
2).
This does not handle occlusion detection. What that means is that, if you are behind a wall that the ai player is looking directly at, then he can still "see" you even though he shouldn''t be able to. From the sounds of things, you should be able to ignore this limitation.
Good luck.