BackgroundIn most realistic first-person games, the AI doesn't need to do any prediction because the bullets fly almost instantaneously. This implies that aiming is the only aspect of the nonplayer character (NPC) that requires thought. There is an extremely simple solution to aiming, which involves nothing more than vector algebra. When the enemy is located, a bullet is spawned traveling toward that position. The simplicity of this solution implies that there is little documentation on the subject—compared to movement at least. When more complex projectiles are used, AI developers tend to borrow solutions from physics manuals for the prediction. In fact, the problem of fire control is not as simple as it seems when different constraints are applied to the projectile (for instance, wind or spin). A few recent articles focus on different aspects of range combat, mostly on the aiming problem:
Generally, game developers seem content to just add a random noise to the bullet's initial orientation, which results in a spread fire. Considering the big picture and the seeming unimportance of shooting details, the quick solution is often a good compromise. As far as developing genuine behaviors for shooting is concerned, the documentation is quite rare. The same applies for formal interfaces. Not to worry, it's beneficial from an educational point of view. It provides us the opportunity to try our skills at designing a specification unassisted. |