Stealth ELements, how?

Grab your favourite IDE and tinker with the innards of game engines

Stealth ELements, how?

Postby Yamato57 on Sun Apr 24, 2011 9:46 pm

Hello everyone, I'm new to modding games. I have a question, im trying to make a stealth fps game and i cannot find any source code or examples on how to create NPC enemy stealth detection. I want to make it simple like MGS where they patrol back and forth; if they see you in their detection range, they will attack you. Can someone give me tips on how to do that?

THanks alot! :D
Yamato57
Dumpling
Dumpling
 
Joined: Tue Apr 07, 2009 12:14 pm

Re: Stealth ELements, how?

Postby Smurftyours on Sun Apr 24, 2011 9:51 pm

I'm pretty sure NPCS already have detection coded to them. All you should need to do is make them patrol and crouching players will be able to sneak up onto them from behind.
jangalomph wrote:Wise words from a wise man. ^
User avatar
Smurftyours
Senior Member
Senior Member
 
Joined: Tue Aug 04, 2009 6:11 pm
Location: California, US.

Re: Stealth ELements, how?

Postby Yamato57 on Sun Apr 24, 2011 9:55 pm

oh sweet, that's awesome. I'm assuming i can either make a script for them or make a patrol sequence in the Hammer editing tool.

thanks for the speedy reply!! :D
Yamato57
Dumpling
Dumpling
 
Joined: Tue Apr 07, 2009 12:14 pm

Re: Stealth ELements, how?

Postby stoopdapoop on Sun Apr 24, 2011 10:12 pm

yeah, all npc's have a coded eye position, field of view, and view distance, you can view them with certain console commands, but I forgot what they were (I'll look them up when I wake up, if you want)

also, any time your character makes a noise, including footsteps, npc's can hear it, depending on the volume of the sound, and how close the npc is. There is also a console command to show the audible range of all sounds made. It's kinda cool actually.
I'm Brown
Image
User avatar
stoopdapoop
Veteran
Veteran
 
Joined: Sun Aug 21, 2005 2:14 am
Location: Ann Arbor, MI

Re: Stealth ELements, how?

Postby Gradius on Sun Apr 24, 2011 10:13 pm

Well you'd need to change their behaviour or they'll spot you far to easily. The game was never designed to be stealth so unless they're looking directly away from you and are not in an alert state they won't find you... but should they so much as glimpse you out of the corner of their eye for a milisecond it's on.
User avatar
Gradius
1337 p0st3r
1337 p0st3r
 
Joined: Thu Aug 27, 2009 2:52 pm

Re: Stealth ELements, how?

Postby stoopdapoop on Sun Apr 24, 2011 10:18 pm

that is true.

yamato, if you have coding experience it probably wouldn't be too difficult to make detection time dependent on distance and the player's light level.

also, it's an easy fix, but npc's don't investigate sounds that they can hear but cannot see, they just turn to face the sound, this can easily be fixed in the code as well.
I'm Brown
Image
User avatar
stoopdapoop
Veteran
Veteran
 
Joined: Sun Aug 21, 2005 2:14 am
Location: Ann Arbor, MI

Re: Stealth ELements, how?

Postby Ark11 on Mon Apr 25, 2011 1:47 am

Perhaps you could make it that when the player is in the 'stealth' position (maybe crouching?) that you fire a console command of 'notarget 1' which makes npc's ignore the player and when the player is no longer in the 'stealth' position you fire a console command of 'notarget 0'
"Drop kick me Jesus, through the goalposts of life." - Robert Bare
User avatar
Ark11
Senior Member
Senior Member
 
Joined: Mon May 24, 2010 10:02 pm
Location: Sydney, Australia

Return to Programming

Who is online

Users browsing this forum: No registered users