### Author Topic: Implementing Stealth Mechanics  (Read 1347 times)

• Member
• Posts: 51
• Karma: +0/-0
##### Implementing Stealth Mechanics
« on: Sun, Oct 27, 2013 »
Hi!

I'm currently doing a stealth game and these are the mechanics I want to implement:

1) Field of View- I want the enemies to have a cone FOV and detect the player inside the cone.
2) Detect sounds- if the player makes some noise within an area enemies will detect him

How should I go about doing this?

Thanks!

-Tristan
Check out my game journal: http://alternatdev.wordpress.com

#### datorum

• Active Member
• Posts: 165
• Karma: +0/-0
##### Re: Implementing Stealth Mechanics
« Reply #1 on: Mon, Oct 28, 2013 »
Assuming a 2D game.

1) either right your own algorithm for checking if the player is in the cone "area" or using an existing algorithm. I guess using an existing is the way to go, I remember once doing my own and spent many hours, either I had a real BLOCK in my brain back then or these algos are less than trivial. Let's assume you use a map in tiles, you check with tiles your enemy can see and then check if the player is on one of the tiles. My answer is very general/abstract, because I don't know what underlying game mechanics you wanna use.
2) same as the above, but the area will be a "circle" around the enemy, hence you just need to determine the distance between the player and the enemy after the player created a sound. In 1) you check "all the time" (for each enemy, if he is active) in 2) you check only if a sound was created.

hope that helps

• Member
• Posts: 51
• Karma: +0/-0
##### Re: Implementing Stealth Mechanics
« Reply #2 on: Mon, Oct 28, 2013 »
Thanks for the response!

Would you happen to know any good algos for this? Basically my game is 2D and the gameplay will be that the player will be controlling one character at a time( while the other two follow) and have them accomplish goals in the level without being seen by the enemies. If you're familiar with Commandos for the pc then the gameplay will be like that except 2D.

-Tristan
Check out my game journal: http://alternatdev.wordpress.com

#### datorum

• Active Member
• Posts: 165
• Karma: +0/-0
##### Re: Implementing Stealth Mechanics
« Reply #3 on: Tue, Oct 29, 2013 »
Hi Tristan,
probably one of the best source I know is this:
http://roguebasin.roguelikedevelopment.org/index.php?title=Category:FOV

as far as I remember Commandos it was 2d btw. I guess it had maybe different "height levels", but the whole thing was 2D.
Probably some elements were 3d like the terrain, but I think most of the calculations were done in 2d.
This is important to understand if you develop games.
Doom had 3D levels only to certain degree, as far as I remember it was not possible to have a room above a room etc. so basically the game was a 2D game with some 3d representation. You only aim horizontal in doom. The first "real" 3D shooter was Quake if I am not mistaken.

hope that helps