Difference between revisions of "Play It Forward"
m (This deserves this categorization, I think.)
|Line 28:||Line 28:|
Latest revision as of 17:36, 24 September 2012
A method of generating a firing angle from a past situation. Using a log of enemy movements, one can "Play It Forward", simulating future movements, to determine where a bullet would have intersected the target bot.
Commonly abbreviated "PIF".
Play it Forward
The most common technique for playing it forward, is to store states of heading difference and the velocity. Some older robots used velocity delta instead, but this has the problem of bounds checking and less accurate outcomes.
With this technique, you take the current enemy location, heading, and velocity. Then for every state you want to simulate apply the stored states to the last one. They build on top of one another to build a simulated set.
Fast Play it Forward
A faster version of the play it forward. It is faster since it skips the inner loop trigonometry calls usually done in the usual method. This method makes use of the stored location and heading. It is only beneficial when finding the end point is important, otherwise it may well be slower than the usual version. This is generally more confusing and complex to implement the first time around.
It requires rotating the battlefield around the location of the robot you are predicting. Rotating it so that the current heading would match the recorded heading. Then translating the entire field so that the current position equals the recorded position. This is because any other points on the field (such as another robots location), are subject to the current heading and location, rather then the recorded ones. Then playing it forward till you reach the wanted point. As usual with a Play it forward, a close match to the current heading difference and velocity are very important.
Then doing the reverse to get the final point. An simple optimization if only the angle is needed is getting the angle delta to the projected absolute angle, and applying it to the current one.