Difference between revisions of "Radar"

From Robowiki
Jump to navigation Jump to search
(→‎1-vs-1 Radars: - Renaming)
m (less confusing link (I think))
Line 10: Line 10:
  
 
== 1-vs-1 Radars ==
 
== 1-vs-1 Radars ==
[[One on One Radar|One on one radars]] are the smallest of the bunch and many can get a scan in every turn, producing a perfect lock. The most common types of radar in [[One on One|one on one]] are:   
+
: ''Main article: [[One on One Radar]]
 +
One on one radars are the smallest of the bunch and many can get a scan in every turn, producing a perfect lock. The most common types of radar in [[One on One|one on one]] are:   
  
 
* Spinning radar
 
* Spinning radar
Line 19: Line 20:
  
 
== Melee radars ==
 
== Melee radars ==
[[Melee Radar|Melee radars]] are more complex and take up considerably more room inside a robot. Since the field of opponents does not usually fall within a 45° area, compromises must be made between frequent data of one bot (e.g., the firing target) and consistently updated data of all bots. Common melee radars include:
+
: ''Main article: [[Melee Radar]]
 +
Melee radars are more complex and take up considerably more room inside a robot. Since the field of opponents does not usually fall within a 45° area, compromises must be made between frequent data of one bot (e.g., the firing target) and consistently updated data of all bots. Common melee radars include:
 
* Spinning Radar  
 
* Spinning Radar  
 
* Oldest Scanned Radar
 
* Oldest Scanned Radar

Revision as of 06:38, 17 November 2011

Radar is one of the most vital components of your robot. Without it, targeting is effectively impossible and movement is purely random. Just as with movement and targeting, there are many simple and complex algorithms for radar control. In most robots the radar takes up the smallest portion of code.

Radar in Robocode

Technical Information

A radar in Robocode can turn a maximum of 45° or π/4rad in a single tick. The radar scans robots up to 1200 units away. The angle that the radar rotates between two ticks creates what is called a radar arc, and every robot detected within the arc is sent to the onScannedRobot() method in order of distance from the scanning bot. The closest bot is detected first, while the furthest bot is detected last. By default, the onScannedRobot() method has the lowest event priority of all the event handlers in Robocode, so it is the last one to be triggered each tick.

Initial Scan Direction

The optimal direction to scan at the beginning of the round is generally considered to be the one with the shortest rotational distance to the angle to the center of the field. However there is likely many robots that have a more complex initial scan setup. Such variations include rotating the gun and robot to get a larger scan arc to find the enemy faster.

1-vs-1 Radars

Main article: One on One Radar

One on one radars are the smallest of the bunch and many can get a scan in every turn, producing a perfect lock. The most common types of radar in one on one are:

  • Spinning radar
  • The Infinity Lock
  • Perfect Radar Locks
  • Turn Multiplier Lock
  • Width Lock

Melee radars

Main article: Melee Radar

Melee radars are more complex and take up considerably more room inside a robot. Since the field of opponents does not usually fall within a 45° area, compromises must be made between frequent data of one bot (e.g., the firing target) and consistently updated data of all bots. Common melee radars include:

  • Spinning Radar
  • Oldest Scanned Radar
  • Gun Heat Lock

Notes

For most of these radar locks, you will need to add one of the following to your run() method:

setAdjustRadarForRobotTurn(true);
setAdjustGunForRobotTurn(true);
setAdjustRadarForGunTurn(true);