Pathnode Flags

DONT_LINK
- Marks the node as not linking into navigation. Conserves memory and cpu usage.

DUCK
- Tells the AI to duck at this node. Currently only used with cover nodes.

COVER
- Tells the AI that this node is potentially a cover node. The definition of cover is that the enemy cannot see me. The AI will only consider cover nodes that satisfy leash, mindist, and maxdist constraints. This can target one or more nodes for the AI to randomly step toward when it is ready to attack the player again. If there are no targeted nodes, the AI will try to step out along a path to it’s enemy.

CONCEALMENT
- Acts just like COVER, except that no sight trace is done to validate that it is in fact cover. This is useful for foliage and short walls and other things that provide some partial cover or make it harder for the player to see through. It can be used with any of the other cover flags, though it really shouldn’t be used with anything except DUCK and possibly CRATE.

CORNER_LEFT
- Never used with any other flags, except possibly COVER. The COVER flag is assumed, so it is not necessary. Tells the AI to do special corner attack behavior. The corner is to the AI’s left with his back to the wall. The center of the node should be 16 units in from the corner and 16 units out from the wall. The node’s angles should point away from the wall; ie, the way the AI would be facing with his back to the wall.

CORNER_RIGHT
- Never used with any other flags, except possibly COVER. The COVER flag is assumed, so it is not necessary. Tells the AI to do special corner attack behavior. The corner is to the AI’s right with his back to the wall. The center of the node should be 16 units in from the corner and 16 units out from the wall. The node’s angles should point away from the wall; ie, the way the AI would be facing with his back to the wall.

SNIPER
- Currently only works with turret attack behavior. Never used with any other flags. Tells the AI that this is a good place to stand still and shoot people. Use at windows, for example. Can also be used to encourage guys to go inside a building to attack a guy shooting out of a window.

CRATE
- Never used with any other flags, except possibly COVER. The COVER flag is assumed, so it is not necessary. Tells the AI to do special over-the-top attack behavior, as if he were behind a crate. The center of the node should be 16 units back from the crate. The node’s angles should point towards the crate.

AI Parameters

This is not an exhaustive list, but is most of the common parameters.


Leash

Leashes reset under the following conditions:

The AI can leave their leashes for the following reasons:

Enemy Selection

The AI picks the current best enemy to attack based on distance to the enemy, the number of other AI that are attacking that particular enemy, the enemy’s weapon, whether or not that enemy is completely visible, and whether or not that enemy is in pain. The AI prefer to not switch enemies, but they will if the new enemy is of enough higher threat.

When an AI changes enemy, he transfers perfect knowledge about that enemy’s existence and location to all other AI in his “squad”, if they are within 512 units or line-of-sight and they are not outside their “enemysharerange”. This transfer of information takes place 0.5 seconds after he switches enemies. Each AI that becomes aware of this enemy’s location can now decide to switch to the new enemy, or to continue attacking their current enemy.

As soon as an AI fires its weapon, all other AI within that weapon’s sound radius immediately know that the weapon was fired and by who and where the shooter was. The weapon sound radius is currently the same for all weapons.


How AI Initially Sees An Enemy

Note that this is only how an AI initially detects an enemy; once he has locked on to an enemy, sight is done by a simple traceline, without all this extra checking.

AI sight is achieved based on the time it takes to first notice an enemy given the current conditions. This is scaled based on how long it has been since the conditions were last checked to come up with a percentage recognition; for example, if it has been 1 second since we last checked, and it takes 3 seconds to notice the enemy, the percentage recognition increases by 33.3%. When percentage recognition reaches or exceeds 100%, the enemy is sighted.

Recognition time is standard at 2 seconds. There are multipliers to this time based on the LMRF function (light, motion, range, fov). The recognition time gets multiplied by all these factors to get the actual recognition time.

* The light portion:
- if the enemy is the same brightness as self, the light scale is 0.5 for bright areas and 2.0 for dark areas
- if the enemy is much brighter than self, the light scale is 0.125
- if the enemy is much darker than self, the light scale is 8

* The motion portion:
- set for players by the state file; ranges from 0.2 for jumping forward to 1.25 for being ducked while not moving
- currently not set for AI, so it stays at 1 for AI

* The range portion:
- function of self's sight range; using a normalized range of 0-1, the scales are as follows:

Range Scale
0.000 0.000
0.250 0.500
0.500 0.750
0.750 1.000
1.000 2.000

- the normalized range is current range divided by maximum range. For fogged levels, maximum range is capped to 82.8% of the fog farplane.

* The FOV portion:
- set to 1 for directly ahead, and increases to 1.25 at periphery

In addition to this, there is also a minimum sight time that is a function of FOV. It is almost 0 for directly in front of the AI, and about 1 second for the periphery. This will make the AI turn its head to look at something before seeing it.

Making AI Look Smart

Just an un-ordered list of ways to make the AI look smart: