Chapter 16. Physics for Prediction
Key Topics
Accurate shooting can be understood as a combination of many skills. One of these is the ability to predict what's going to happen in the near future. This involves anticipating player movement, as well as understanding the ballistics of the projectile. We'll focus on this aspect of shooting in this chapter.
Throughout the explanations, we'll assume that the aiming can be done satisfactorily by just turning toward the estimated target. (Matching pitch and yaw angles is often good enough.) The weapon is fired whenever it's ready—with an enemy present of course! The target selection itself is done implicitly as part of the prediction; the predicted outcome becomes the target.
In the quest to find the best place to launch a projectile at an enemy, this chapter covers the following topics:
Theory from Newtonian physics such as integration, used to simulate movement A solution purely based on physics that solves an equation to find the target A more practical approach to predicting movement using an iterative approach The conditions for experimentation with predicting movement of other players An analysis of the quality of the behaviors in the game, as well as the development process
By the end of the chapter, we'll have an animat capable of firing a weapon (with slow projectiles) to intercept a moving enemy.
|