Tactical AI Kit: Alertness and Sense of Hearing
by Bryce · 11/10/2008 (3:04 pm) · 11 comments
Hello Community!
I added a feature to the Tactical AI Kit that I'm quite proud of, so I decided to post an update to see what you all think.
Is it just me, or are stealth-based games becoming more and more popular? (Probably) the Quantum of Solace game, some of the Bourne Conspiracy, the sniper mission in Call of Duty 4, Metal Gear Solid 4, and the Splinter Cell series use gameplay that requires the player to avoid detection. There are also a ton of stealth game projects that some GarageGames members are hard at work on. Being a Splinter Cell addict, I personally love stealth-based games.
I came up with some ideas Saturday about how non-player characters should behave in a stealth-based game and implemented those ideas. NPCs should know how to behave when:
--they hear an enemy moving around
--they hear gunfire
--they spot a dead/dying teammate
Detecting Player Movement
When a Tactical AI Player thinks, it now does a check for objects close enough that are moving fast enough. If we detect something wrong, the NPC enters a new state that tells it to investigate the possible threat (cheating is used so they only react to enemy players, so it is technically never just a possible threat, but they act like it is). When we enter this state, we slowly walk out to where we heard the player, have a quick look around, then walk back to where we were before. Players who move slowly enough (moving while crouched or prone, in my case) won't be heard, providing that vital ability to sneak up on unwary NPCs!
Hearing Gunfire
I also added a variable in the AI Player's object that determines its alertness. An alert level of 0 means the NPC isn't expecting anything out of the ordinary, and alert level 1 means we know there's danger out there and should be on the lookout. In alert level 0, the view and hearing distance is reduced. This is a good alert level for a typical patrol or guard, as it is unrealistic to have a player that must be ALWAYS aware of everything. Alert level 1 is good for a sniper or assaulting squad, as they know they are going up against something and should be always on the lookout. An AI Player at alert level 0 is upgraded to alert level 1 when we hear gunfire (friendly or unfriendly, so getting into a firefight will alert everyone else), see a dead teammate, see a teammate with an alert level of 1, or come under fire.
An alert level system adds more value to the player using silenced weapons, as they won't alert everyone when killing enemies, making it easier to win the level.
For example, a game that has a mission with a hostage situation could have a guard variation that is set to kill hostages if alerted, forcing the player to be as stealthy as possible.
Finding a Dead Teammate
If an NPC comes across a dead teammate, they will raise their alert level and react as they would to gunfire (taking cover if we have an idea of where the threat is). Pretty simple, but all of these features combined can create some pretty interesting situations; if you snipe an enemy in the head, whoever finds the body can alert everyone else, making it realistically more difficult to make kills as everyone is taking cover and looking for any sign of movement--the next shot could give away your position!
Thanks to everyone who is reading my blog posts! BTW, just because I know somebody is going to ask this, we can expect a release hopefully in mid '09.
Video!
www.youtube.com/watch?v=IlAQPmrU2UU
Rate and comment this or I'll send my AI Players to find you...
I added a feature to the Tactical AI Kit that I'm quite proud of, so I decided to post an update to see what you all think.
Is it just me, or are stealth-based games becoming more and more popular? (Probably) the Quantum of Solace game, some of the Bourne Conspiracy, the sniper mission in Call of Duty 4, Metal Gear Solid 4, and the Splinter Cell series use gameplay that requires the player to avoid detection. There are also a ton of stealth game projects that some GarageGames members are hard at work on. Being a Splinter Cell addict, I personally love stealth-based games.
I came up with some ideas Saturday about how non-player characters should behave in a stealth-based game and implemented those ideas. NPCs should know how to behave when:
--they hear an enemy moving around
--they hear gunfire
--they spot a dead/dying teammate
Detecting Player Movement
When a Tactical AI Player thinks, it now does a check for objects close enough that are moving fast enough. If we detect something wrong, the NPC enters a new state that tells it to investigate the possible threat (cheating is used so they only react to enemy players, so it is technically never just a possible threat, but they act like it is). When we enter this state, we slowly walk out to where we heard the player, have a quick look around, then walk back to where we were before. Players who move slowly enough (moving while crouched or prone, in my case) won't be heard, providing that vital ability to sneak up on unwary NPCs!
Hearing Gunfire
I also added a variable in the AI Player's object that determines its alertness. An alert level of 0 means the NPC isn't expecting anything out of the ordinary, and alert level 1 means we know there's danger out there and should be on the lookout. In alert level 0, the view and hearing distance is reduced. This is a good alert level for a typical patrol or guard, as it is unrealistic to have a player that must be ALWAYS aware of everything. Alert level 1 is good for a sniper or assaulting squad, as they know they are going up against something and should be always on the lookout. An AI Player at alert level 0 is upgraded to alert level 1 when we hear gunfire (friendly or unfriendly, so getting into a firefight will alert everyone else), see a dead teammate, see a teammate with an alert level of 1, or come under fire.
An alert level system adds more value to the player using silenced weapons, as they won't alert everyone when killing enemies, making it easier to win the level.
For example, a game that has a mission with a hostage situation could have a guard variation that is set to kill hostages if alerted, forcing the player to be as stealthy as possible.
Finding a Dead Teammate
If an NPC comes across a dead teammate, they will raise their alert level and react as they would to gunfire (taking cover if we have an idea of where the threat is). Pretty simple, but all of these features combined can create some pretty interesting situations; if you snipe an enemy in the head, whoever finds the body can alert everyone else, making it realistically more difficult to make kills as everyone is taking cover and looking for any sign of movement--the next shot could give away your position!
Thanks to everyone who is reading my blog posts! BTW, just because I know somebody is going to ask this, we can expect a release hopefully in mid '09.
Video!
www.youtube.com/watch?v=IlAQPmrU2UU
Rate and comment this or I'll send my AI Players to find you...
#2
11/10/2008 (3:37 pm)
I am really looking forward to seeing this as a pack for sale. This would be extremely useful!!!
#3
Your bring up some really cool ideas here.
Refering to your Alert level idea!
Ive been playing Gears of War2 and the AI is simple but effective for the game.
It has an overall rating you can set through an easy, difficult, hard, and (..i think) advanced setting.
I was just thinking today that I would like to make the AI im currently using
based on a diffuctly setting. Because AI shouldnt just be perfect.
The AI should show imperfections too!
Keep up the good work!
11/10/2008 (5:43 pm)
I downloaded your earlier demo and thought it was great.Your bring up some really cool ideas here.
Refering to your Alert level idea!
Ive been playing Gears of War2 and the AI is simple but effective for the game.
It has an overall rating you can set through an easy, difficult, hard, and (..i think) advanced setting.
I was just thinking today that I would like to make the AI im currently using
based on a diffuctly setting. Because AI shouldnt just be perfect.
The AI should show imperfections too!
Keep up the good work!
#4
AI difficulty could be adjusted very easily. There are a lot of global variables that can be tweaked to control aiming accuracy, starting health, and you could disable cover searching if you'd like as that really makes them easier to kill
11/11/2008 (5:26 am)
@Surge:AI difficulty could be adjusted very easily. There are a lot of global variables that can be tweaked to control aiming accuracy, starting health, and you could disable cover searching if you'd like as that really makes them easier to kill
#6
11/12/2008 (9:02 pm)
Wow... Nice work on this. Not sure how you are alerting the aiPlayers with sound. I was looking for way to pull that off a few months ago but no luck. Guess I'll have to wait for the kit. Why so long... I want it now!!!
#7
This way you don't have all NPCs running straight for the player every time, some will fall back.
11/12/2008 (11:26 pm)
Getting close to what I am looking for. But I would rather see about 5 alert levels rather than 2 or maybe 3at the min. 0 = idle, doing nothing, talking, duty 1= coward, scared, hiding 2= guarded, scanning, observe while in position 3=alert 4= high alert, investigate, cautious, 5= chase,pursue. I think more levels give more realism. Also, need a random generator to determine skill level of the NPC. Skill levels below a certain level will only pursue a player maybe 20% of the time and instead hide, others will take cover and the reast will give chase. This way you don't have all NPCs running straight for the player every time, some will fall back.
#8
@Randy: The alert levels are just at 0 and 1 for now, I'm planning on adding more. I am going to implement them and have them called based on the nature of the threat, e.g.
Lvl 0: Do nothing
Lvl 1: Hears suspicious movement, investigate, and if nothing is found, back to alert 0. This is for threats that we aren't sure are really threats
Lvl 2: Knows something bad is out there. For NPCs who hear gunshots that aren't close. After reaching this alert level, we don't go back to 1 or 0
Lvl 3: For NPCs that hear gunshots that ARE close or hears/sees a teammate under attack. Lvl 3 means we may be in immediate danger. If nothing happens after a period of time, we go down to Lvl 2 (but we still never go lower than that)
Lvl 4: Attacking or under attack. Go back to lvl 3 when we kill a visible target
The skill thing is also something I've wanted to implement. Cowardly NPCs will stay behind if they notice a threat, braver ones will go out to investigate (those in between will investigate, but will move very slowly to seem frightened)
11/13/2008 (5:10 am)
@Ashley: The AI Players technically don't hear sound. They do a radius search for players around them, checks to see if they are close enough to hear, checks their team (so we don't react to friends moving around), and sees if they are moving fast enough to make "sound".@Randy: The alert levels are just at 0 and 1 for now, I'm planning on adding more. I am going to implement them and have them called based on the nature of the threat, e.g.
Lvl 0: Do nothing
Lvl 1: Hears suspicious movement, investigate, and if nothing is found, back to alert 0. This is for threats that we aren't sure are really threats
Lvl 2: Knows something bad is out there. For NPCs who hear gunshots that aren't close. After reaching this alert level, we don't go back to 1 or 0
Lvl 3: For NPCs that hear gunshots that ARE close or hears/sees a teammate under attack. Lvl 3 means we may be in immediate danger. If nothing happens after a period of time, we go down to Lvl 2 (but we still never go lower than that)
Lvl 4: Attacking or under attack. Go back to lvl 3 when we kill a visible target
The skill thing is also something I've wanted to implement. Cowardly NPCs will stay behind if they notice a threat, braver ones will go out to investigate (those in between will investigate, but will move very slowly to seem frightened)
#9
11/14/2008 (1:51 pm)
If you need any testing help I'd love the put the ai thru the ringer.
#10
11/14/2008 (1:57 pm)
@Ashley: When I make a beta announcement, email me at tgebryce@yahoo.com so I remember to put you on the tester list :-)
#11
I've been waiting for a resource of this magnitude as well as the community im sure,
keep up the good work bryce, we're all behind you!
p.s. Can't wait till beta testing!
11/17/2008 (10:57 am)
Good Job Bryce,I've been waiting for a resource of this magnitude as well as the community im sure,
keep up the good work bryce, we're all behind you!
p.s. Can't wait till beta testing!

Torque Owner Christian S
Oak-Entertainment
It keeps surprising me what ideas you get for improving the application, keep the spirit high :P