Mean Targeting

From Robowiki
Revision as of 16:12, 29 November 2007 by Voidious (talk | contribs) (removing "Targeting" category)
Jump to navigation Jump to search

A style of targeting that averages the data from a few recent scans to use as input to its prediction algorithm.

Linear Mean

Given the enemy's current position and their position t ticks in the past, assume the enemy will continue to move with the same direction and average speed deduced from these scans. The pseudocode would look like this:

  • Take a present scan position and an older scan position, t ticks in the past. Ignore actual heading and velocity.
  • Find the angle from from the old scan to the new one. This is the mean heading.
  • Find the distance between the two points and divide by t. This is the mean velocity.
  • Use these values as input to a linear targeting algorithm.

Circular Mean

Given a collection of x recent scans of the enemy, calculate his average velocity and turn rate and assume that he will continue to move with those values. The pseudocode would look like this:

  • Iterate over the group of scans, summing the x - 1 heading changes and x velocities.
  • Divide the sum of heading changes by x - 1 to find the mean heading change.
  • Divide the sum of velocities by x to find the mean velocity.
  • Use these values as input to a circular targeting algorithm.