JavaScript EditorFree JavaScript Editor     Ajax Editor 

Main Page
  Previous Section Next Section


In 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:

  • [Tozour02] provides a great overview of the tips and tricks used to fake ranged combat. This includes firing bullets that are almost aligned with the gun barrel, determining when to hit or miss, and tips on how to miss in the best possible way!

  • [Alexander02] discusses response curves, and investigates their applicability to faking the aiming of humans. By using a sine function together with response curves of different slopes, varying degrees of accuracy can be obtained.

  • [Sterren01] focuses on more advanced weapon strategies, which involve knowledge of the terrain to determine the ideal place to fire a grenade. This illustrates the need to gather information about the environment, even if we need a simpler solution (without planning).

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.

      Previous Section Next Section

    JavaScript EditorAjax Editor     JavaScript Editor