Predicting physics in games is the use of characteristics of an object’s current status and movement to predict where it will end up. Although there are many uses for predicting physics and trajectory in games and at least as many strategies for accomplishing it, the most basic example would be looking at two objects with constant velocities, a target and a projectile, perhaps, and determining when the projectile should be fired in order to hit the target. Given a constant velocity and a starting point for each it is easy to calculate the point at which they should collide and, from there see how long it would take for each of the objects to reach the newly calculated end point; as soon as those two time values are the same, the projectile should be fired to guarantee that it will arrive at the collision point at the same time as the target. Physics prediction can be applied to something as simple as this, or as complicated as predicting the landing location of a projectile launched into a system with multiple points of gravity acting on the projectile based on the projectile’s relative location, which is what I set out to do.
In my prediction system, the landing point was one of any number of planets in a solar system and there is little correlation between the initial velocity and the landing position, as it would apply to the aforementioned iteration system. I instead used iteration to basically run a limited simulation, feeding in the initial position and velocity and stepping through each frame to determine what forces would be applied and, thus, how the trajectory would be affected frame-by-frame. I iterated through each time step until either a collision was found or the prediction timed out according to a limit I determined. You can see in the screenshots that the pink dots are positions along the trajectory of the projectile, the yellow dot with a yellow trail.
Predicting physics is not innately too processor intensive, or have any specific platform requirements. Obviously iterative prediction methods are going to be significantly more processor intensive, with an increase in demand based on how accurate the calculated trajectory must be or how long until a simulation-based iteration will continue without reaching a target. Simple things such as the first example involving constant velocities and calculating just the timing takes only a few simple operations.
Works Cited:
Millington, Ian, and John Funge. "Predicting Physics." Artificial Intelligence for Games. 2nd ed. Burlington, MA: Morgan Kaufmann, 2009. 120-33. Print.