Difference between revisions of "Mean Targeting"

From Robowiki
Jump to navigation Jump to search
m
 
(2 intermediate revisions by one other user not shown)
Line 3: Line 3:
 
== Linear Mean ==
 
== Linear Mean ==
  
Given the enemy's current position and their position <code>t</code> ticks in the past, assume the enemy will continue to move with the same direction and average speed deduced from these scans. The pseudo-code would look like this:
+
Given the enemy's current position and their position <code>t</code> 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, <code>t</code> ticks in the past.  Ignore actual heading and velocity.  
 
* Take a present scan position and an older scan position, <code>t</code> 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 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 <code>t</code>. This is the mean velocity.  
 
* Find the distance between the two points and divide by <code>t</code>. This is the mean velocity.  
* Use these values as input to a [[Linear Targeting]] algorithm.
+
* Use these values as input to a [[linear targeting]] algorithm.
  
 
== Circular Mean ==
 
== Circular Mean ==
  
Given a collection of <code>x</code> recent scans of the enemy, calculate his average velocity and turn rate and assume that he will continue to move with those values. The pseudo-code would look like this:
+
Given a collection of <code>x</code> 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 <code>x - 1</code> heading changes and <code>x</code> velocities.  
 
* Iterate over the group of scans, summing the <code>x - 1</code> heading changes and <code>x</code> velocities.  
 
* Divide the sum of heading changes by <code>x - 1</code> to find the mean heading change.
 
* Divide the sum of heading changes by <code>x - 1</code> to find the mean heading change.
 
* Divide the sum of velocities by <code>x</code> to find the mean velocity.
 
* Divide the sum of velocities by <code>x</code> to find the mean velocity.
* Use these values as input to a [[Circular Targeting]] algorithm.
+
* Use these values as input to a [[circular targeting]] algorithm.
  
 +
{{Targeting Navbox}}
 
[[Category:Simple Targeting Strategies]]
 
[[Category:Simple Targeting Strategies]]
[[Category:Targeting]]
 

Latest revision as of 18:18, 1 April 2011

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.