The AI should be able to handle some situations easily, while others demonstrate more advanced shooting capabilities. We'll assume the use of range weapons with relatively slow projectiles (for instance, rockets or blaster). In this case, there's less worry about the AI being too perfect because the task is not straightforward.
Considering each scenario, starting with the easiest, the following apply:
The AI should be able to hit still targets.
Targets moving at constant speed should be anticipated and intercepted with projectiles.
Targets accelerating and then breaking, turning arbitrarily to dodge fire should also be hit when their movement averages out to a constant vector (see Figure 14.2).
Figure 14.2. Two scenarios showing prediction abilities. On the left, a player uses a rocket to intercept the target. On the right, the plan is to aim for the floor where the enemy is predicted.
The following situations assume that a projectile with splash damage is used:
When the fight happens on the same level and there are few walls around, the AI should decide to aim for the feet of the enemy.
When the NPC is on the floor below the enemy, it should attempt to hit a nearby wall—also to maximize splash damage.
Gamers have developed these tactics notably for deathmatch games. If the design of the AI is successful, we expect it would use similar tactics.