Sneaking past guards

Blitz3D Forums/Blitz3D Beginners Area/Sneaking past guards

Kinkobal(Posted 2006) [#1]
Hi all

I'm making a small fps shooter game and I want to have guards patrolling at different places in the level. How can I make guards detect the player when he is within the view of the guard?
I can imagine something like checking angles (if the guards view is 45 deg for example) but I can't for the life of me figure out how to check if the player is within the guards view...

It would be great if the solution took occlusions into account (so you could hide behind a wall)

Thanks in advance


b32(Posted 2006) [#2]
On this link I found a nice example for using EntityVisible:
http://www.blitzbase.de/befehle3d/entityvisible.htm


Gabriel(Posted 2006) [#3]
You could create a mesh shaped like a cone, hide it and place it at the guard's eyeline. Finally, parent it to the guard's head bone. Now you have a real cone of vision, which even follows the animation of the guard moving his head.

Then you can just create a sphere which approximates the size of the player and see if that sphere intersects your cone of vision, the player can be seen. If not, he can't. Should be plenty fast and accurate.


(tu) sinu(Posted 2006) [#4]
You should be able to find a few posts on the matter with included mesh cone object in one of the forums.


Shambler(Posted 2006) [#5]
You could place a pivot at the enemies eyes and then point it at the player.

Do a linepick from this pivot to the player and if the line pick succeeds compare the yaw of the pivot to the yaw of the enemy mesh.

Finally test if the yaw angle is below a certain value and that would mean the player is within the enemies lateral field of vision.

That is the simplest, if maybe not most efficient way I can think of.


(tu) sinu(Posted 2006) [#6]
try this link:

http://www.blitzbasic.com/Community/posts.php?topic=59805#667611


Kinkobal(Posted 2006) [#7]
Thanks Guys, the problem is solved


Sir Gak(Posted 2006) [#8]
Just curious, but what was the solution that worked for you?


Kinkobal(Posted 2006) [#9]
I used the canSeeEntity() function from www.blitzbasic.com/Community/posts.php?topic=59805#667611

Worked porfectly


Nebula(Posted 2006) [#10]
A loud footstep would be hearable, while a soft or unhearable sneak walk would not hearable. We have ears. Volume and distance are important as is light level and clock nose angle.
You could also the harddisk to see if the player is quiet. The hardisk is a recorder and a sound box as well. It records vibrations and stores this. So if a player is frustrated he would get caught. However this is profesional programming(book C++).


(tu) sinu(Posted 2006) [#11]
You could set distance sound checks based on a radius, if the player is within a few metres and walking the guard will hear his presence even if behind depending on the surface ie hard floor, if he is running it can be a larger distance.


jfk EO-11110(Posted 2006) [#12]
One more thing: you may consider to implement a light detector as seen in splinter cell. It's kind of a single sensor for global illumination, gathering how bright the players location is lit. So if he's sneaking in the dark, the guards should ignore him.