Awareness is a key feature of enemy AI in Sneak 'Em Up (working title). Once a player is detected (see the last post), the guard's awareness "meter" fills (there's no visual meter for each guard's awareness but this is something I plan on testing eventually). Awareness starts at 0 and goes to 100.
Both the detection system and awareness system are designed to be target-agnostic--in other words, the AI does not solely respond to the player. This is to allow for emergent or systemic gameplay, in which the player manipulates the game world indirectly. The AI for each character is seeking out, not just the player, but anything that is suspicious, alerting, or on a different "team." The player will be able to use this to their advantage by arranging for opposing factions to fight it out, luring wild animals near enemies, or perhaps mind controlling enemy guards to cause mayhem.
The rate at which awareness raises is based on several variables. Visibility (formerly called Size) is a variable on every character or notable item in Sneak 'Em Up. Highly visible objects, like the standing player character, raise awareness faster than small objects such as a pack of cigarettes tossed to lure enemies. To mimic human sight, the target's speed is a major factor in awareness as well. Finally, distance to the target raises the awareness rate exponentially. This way, if the player runs up on a guard standing around the corner, the AI will go to 100% awareness almost instantly, but a distant player will cause a slow creeping awareness.
Each enemy type has a "Suspicion Threshold" and an "Alerted Threshold", which define at what Awareness level a character will go check out a suspicious sight, and what level they will become alarmed and search the area. An alerting sight that the enemy identifies as a character from another team will be met with hostility.
One way to test and tweak my AI was to build a "playground" level where I could test enemy detection and awareness at different distances and with the player character in different states such as prone or hiding in tall grass. Initially enemies had a detection area that was circular in shape (see the enemies on the left in the above screenshot). However, through playtesting my own levels and watching users try the game out, I realized that the enemy was often able to see the player before the enemy was even on the screen, causing frustration for players.
In the illustration above, the grey rectangle represents the aspect ratio for the vast majority of PC game players' monitors: 16:9. With a circular detection radius, guards who are to the left and right of the player work as expected, meaning they can't see you from off screen. However guards above or below your position can see and attack the player from off screen, which feels frustrating. The solution, after much tweaking, was to make the detection shape a capsule shape:
Even though a player's expectation is that guards see in an even circle around them, this caused a lot of frustration and instead, a capsule shaped vision area feels more fair to the player.