Targeting

From Robowiki
Revision as of 21:26, 8 September 2011 by Voidious (talk | contribs) (moved from Category:Targeting, could use a lot of work)
Jump to navigation Jump to search

In Robocode, you deplete your opponent's energy and increase your own energy by hitting other bots with bullets. Thus, coming up with targeting algorithms to hit your opponents accurately is a cornerstone of a successful Robocode bot. Different algorithms are more appropriate for different Code Size divisions and styles of play.

The main components of a targeting system are:

  • Choosing a target (Melee only)
  • Energy Management - Whether or not to fire, what bullet power to use
  • Choosing a firing angle

Most descriptions of Robocode targeting systems focus on choosing a firing angle. For a learning gun, this is essentially a classification problem. The enemy robot can't react to where you fired your bullets because he can't see your gun or your bullets (until they hit). He can, however, see when you fire by monitoring your energy.

Some aspects that make Robocode targeting an interesting classification problem are:

  • You have a very small amount of time per tick to make a decision. Dropping in the most sophisticated classification algorithm you can find in a textbook won't work. This time needs to be split between inputting data and generating output values.
  • You have to continually make decisions - when you have no data, when you have 50 ticks, 500 ticks, or 20,000 ticks of data. Your algorithm has to perform well and remain fast enough throughout the entire battle.

Some of the most common learning gun configurations are:

  • Pattern Matching / Play It Forward - Use the enemy's recent movements as the input, find a time in the past when his relative movements were similar, and guess that he will continue in the same fashion as he did in the most similar previous situation.
  • Visit Count Stats / Segmentation / GuessFactors (aka GuessFactor Targeting (traditional)) - Choose a few attributes to describe firing situations, segment them into a multi-dimensional array that covers all possible situation, and tally the hitting GuessFactor in each situation encountered (like a multi-variate histogram). At fire time, fire at the most often visited GuessFactor for the segment describing the current situation.
  • Dynamic Clustering / GuessFactors - Choose a few attributes to describe firing situations, log the attributes and hitting GuessFactor for every situation encountered. At fire time, choose some number of similar situations from your log, and find the densest area of the graph of the corresponding GuessFactors.