Virtual Guns

From Robowiki
(Redirected from VirtualGuns)
Jump to navigation Jump to search
Virtual bullets sample.png

A system that tracks the virtual success rates of different targeting algorithms in order to choose the most accurate algorithm against a specific opponent or situation. Another term for this system is "virtual bullets," referring to the virtual shots that each gun fires.

How it works

When firing a real bullet (or possibly every tick), each virtual gun is polled for the firing angle it would use, which is then stored along with the firing location and bullet velocity (a "virtual bullet"). The bot keeps track of which of these shots would have hit or missed the enemy, adjusting the rating of the guns accordingly. Since the enemy cannot see what firing angle was used, it cannot adjust its movement based on what gun you are currently aiming with, so the results should accurately reflect the success rate of each virtual gun.

Advantages and disadvantages

Advantages
  • Enemies tend to move quite differently - virtual guns will make your robot adapt.
  • In theory, it can be quite easy to implement.
  • You can let your bot explore quite different targeting techniques, even quite simple ones, in the hope that it will find weaknesses against particular opponents.
    • For example, against some bots head-on targeting is better than anything else. Against a truly flat movement, it can be better to just guess head-on all the time than trying to predict the enemy's movement.
Disadvantages
  • The main disadvantage is that in practice, it can be quite hard to implement well. You risk messing up things so that the array performs worse than your best gun would do on its own.

Viability with advanced targeting strategies

While many bot authors have experimented with using multiple learning guns, e.g. with different segmentations or mixing GuessFactor targeting with pattern matching, it has often been debated whether this is preferable to using only the gun with better overall performance. Since there is no perfect system for choosing the stronger gun against a given opponent, you will inevitably lose performance against some bots while gaining performance against others.

Popular uses of virtual guns

Historically, one of the most common uses of virtual guns has been using an array of simple targeters, which results in a higher hit rate across a broad range of enemies than any of them on its own. This was a popular method in the early days of Robocode and is still popular among beginner and novice Robocoders.

Among high level 1-vs-1 bots, it is common to have a general purpose gun (with little or no decay rate) and an anti-surfer gun (with a high decay rate and other optimizations for hitting adaptive movement), a strategy popularized by long-time RoboRumble champion, Ascendant.