XanderCat

From Robowiki
Revision as of 17:42, 21 June 2011 by Skotty (talk | contribs) (→‎Version 4.7.3: more version notes)
Jump to navigation Jump to search

MegaBot based on my "Xander" robot framework with pluggable guns, radars, and drives. XanderCat is the flagship of my robot fleet.

Versions up through 2.1 and from 3.1 onward are handcrafted without borrowing code from other robots. Version 3.0 uses a variation on the Wave Surfing drive from BasicGFSurfer, but a wave surfing drive of my own design is used in version 3.1 and beyond. XanderCat could be made smaller by removing unused Xander components and taking advantage of some of the newer classes like Rules, but it's so far above the next smaller weight class that it doesn't really matter.

Current Version: 4.7.3

Best against: Any robot that spends too much time standing still, going straight, going in circles, or doing basic mirroring.

Worst against: Varies.

Drive Tree:

               Ram Escape Selector
          /-------------^-----------\
  Ram Escape Drive         Anti-Mirror Selector
                      /-------------^-------------\
            Anti-Mirror Drive         Active Bullet Waves Selector
                                 /----------------^--------------\
                     Ideal Position Drive              Leadoff Drive Selector
                                                         /-------^--------\
                                          Simple Targeting Drive    Advanced Stat Drive

Gun Tree:

           Opponent Disabled Check
         /-----------^------------\ 
 Head-On Gun              Bullet Shield Protected Wrapper
                                        |
                               Anti-Mirror Selector
                               /--------^----------\
                   Anti-Mirror Gun             Virtual Hit Ratio Selector
                                   /-----------/----------^-----\--------------\
                            Linear Gun     Circular Gun      Stat Gun*     Advanced Stat Gun                       

Version Notes

Version Ranks

Note: Best Change and Worst Change are the change from previous version against the given opponent.

Version 1-on-1 Rank Top Best Change % Score Change Worst Change % Score Change
1.0 ~475 / 805 59% N/A N/A N/A N/A
2.0 386 / 806 48% mld.Wisdom 1.0 4.18 -> 76.13 SuperSample.SuperCrazy 1.0 61.97 -> 37.00
2.1 320 / 805 40% dz.MostlyHarmlessNano 2.1 20.90 -> 63.01 jf.Dodger 1.1 78.98 -> 41.10
3.0 148 / 805 18% gg.Wolverine 2.0 41.08 -> 94.57 xiongan.Xiongan 1.1 100.0 -> 74.39
3.1 145 / 804 18% zyx.nano.RedBull 1.0 53.4 -> 85.3 pulsar.PulsarNano 0.2.4 89.3 -> 64.2
3.2 116 / 806 14% ags.polished.PolishedRuby 1 28.5 -> 83.5 rsim.micro.uCatcher 0.1 91.7 -> 31.8
3.3 115 / 806 14% nat.Samekh 0.4 24.9 -> 64.9 simonton.micro.GFMicro 1.0 62.2 -> 39.2
3.4 85 / 806 11% dsx724.VSAB_EP3a 1.0 67.2 -> 93.4 intruder.PrairieWolf 2.61 65.6 -> 48.4
3.5.1 94 / 805 12% rsim.micro.uCatcher 0.1 21.3 -> 96.4 nat.BlackHole 2.0gamma 69.2 -> 42.5
3.8 81 / 805 10% synapse.rsim.GeomancyBS 0.11 36.5 -> 49.8 mn.Combat 1.0 80.1 -> 60.8
3.9 75 / 805 9.3% pez.mini.ChironexFleckeri 0.5 42.2 -> 64.9 rsim.mini.BulletCatcher 0.4 57.7 -> 7.0
4.0 92 / 805 11% rsim.mini.BulletCatcher 0.4 7.0 -> 72.1 nat.Samekh 0.4 73.3 -> 45.2
4.1 74 / 805 (73.66 APS) 9.2% nat.Samekh 0.4 45.2 -> 75.7 staticline.whiskey.Whiskey 0.6 75.5 -> 57.5
4.2 74 / 805 (73.73 APS) 9.2% mladjo.iRobot 0.3 53.8 -> 69.9 jcs.AutoBot 4.2.1 60.1 -> 35.1
4.3 74 / 805 (73.92 APS) 9.2% kc.mini.Vyper 0.311 33.0 -> 53.0 positive.Portia 1.26e 60.0 -> 36.2
4.4 71 / 805 (74.11 APS) 8.8% pez.frankie.Frankie 0.9.6.1 45.9 -> 62.8 fromHell.CHCI3 0.1.4 74.4 -> 55.7
4.4.1 71 / 805 (74.11 APS) 8.8% brainfade.Fallen 0.63 45.7 -> 65.5 jam.micro.RaikoMicro 1.44 64.0 -> 49.8
4.5.1 71 / 805 (74.25 APS) 8.8% spinnercat.CopyKat 1.2.3 51.6 -> 69.3 synapse.rsim.GeomancyBS 0.11 54.4 -> 38.6
4.6 71 / 805 (74.35 APS) 8.8% deo.virtual.RainbowBot 1.0 54.8 -> 69.1 jab.DiamondStealer 5 80.6 -> 61.7

Version 1.0

Based on a not-quite-complete Xander framework. Uses BasicRadar, OrbitalDrive, and a CompoundGun combining a CircularGun and a LinearGun.

Version 2.0

This version adds a StatGun to the CompoundGun (in order, the CompoundGun will consist of a StatGun, CircularGun, and LinearGun). The StatGun is a "Guess Factor" gun of my own design. I don't call it "Guess Factor" because, frankly, I hate that term. The stat gun supports variable configuration, with interchangable Segmenter modules. Version 2.0 uses a CompoundSegmenter, which combines a BulletTravelTimeSegmenter and a RelativeDirectionSegmenter. This segmenter combination categorizes the statistics based on approximate time it takes bullet to reach opponent and opponent heading relative to self.

Version 2.1

Version 2.1 adds better gun selection, tweaked parameters for firing, driving, and stat gun segmenting. For the driving, it drops the "inverse gravity bullet dodging", as it assumes opponents are using head-on or linear targeting, which likely causes worse performance against opponents using guess factor guns. Instead, it just randomizes movement a little more.

Version 3.0

This version drops the Orbital Drive, and instead uses a Wave Surfing drive based on the drive used by the BasicGFSurfer. This means I cannot credit myself entirely for this version, as I am using a modified version of a previously existing Wave Surfing drive. This version will serve as a reference point for my next version, which will use a Wave Surfing drive of my own design.

Version 3.1

Switched to using my StatDrive for driving, a form of wave surfing drive of my own design. This drive has not been tweaked yet, but seems to be doing it's job well so far. Will be interesting to see how it compares to version 3.0 in the rumble. This version also takes advantage of the ability to paint on the battlefield (very cool!), though it is disabled in the packaged form. It also benefits form a few minor tweaks to the Xander framework, for things like firing at enemies who are low on energy or disabled.

Version 3.2

This version has the following modification from version 3.1:

  • Flattening turned off in StatDrive
  • Now tries to better position itself on round start using IdealPositionDrive (before bullets start flying)
  • StatDrive now attempts to back away from the enemy/enemy waves if it deems itself too close
  • Anti-Mirror components added (a drive, gun, and a few other odds and ends). Bye bye PolishedRuby 1; I was tired of you wiping the floor with me. :-)

Version 3.3

This version has the following modifications from version 3.2:

  • StatDrive Flattening now auto-enables after a particular point in time if the opponent's hit ratio is over a certain threshold.
  • StatGun segmentation changed a bit; fewer relative direction and bullet travel time segments, but added a drive speed segmenter.
  • StatGun now does a better job of predicting how far an opponent can get, and only looks within that range when deciding where to fire.
  • Some other minor StatGun tweaks.

Version 3.4

Version 3.3 didn't show the improvement I was hoping for. My next step was to do some bug hunting. This has revealed a few things which have resulted in the following changes:

  • StatDrive previously would decide on where to go for a bullet wave repeatedly. While this might would seem good in that it makes it arguably more adaptable to unexpected events, that potential advantage appears to be outweighed by the "flip flopper" effect. In some cases, XanderCat would keep changing it's mind on which direction to go for a wave, making it more likely to get hit. Amusing, but not what I'm going for. To avoid this problem, I have changed it so the decision on where to go for a wave is made once, and XanderCat sticks to that decision until the next wave.
  • StatDrive would previously go to the division of least danger. I've found this to be too simple in practice. I've now changed it so it separately looks clockwise and counter-clockwise, computing the average danger in each direction, and finding the exact division of least danger in each direction. If one direction has significantly lower average danger than the other, the exact division of least danger in that direction is chosen. If the two average danger levels are close to equal, it then chooses by which individual division has the least danger. If the individual danger levels are close to equal, it then randomly decides.
  • Flattening effect has been turned off.
  • Rolling danger levels has been turned on (note: danger levels are only rolled when total danger for a segment reaches a set maximum value)
  • The number of drive segments has been reduced slightly.

Per the advice of others, I looked deeper into the performance against HawkOnFire and Barracuda. Some of the above changes are based on that. My current scores against (in my own testing) against HawkOnFire and Barracuda average about 98% and 95% respectively.

For kicks, I left on the painting features, in case anyone wants to see what I have been playing with. :-) I don't think it degrades performance too much, as most of the work happens in the onPaint method which is bypassed when not turned on the the UI.

Rumble Results

XanderCat 3.4 places 85th in the Rumble. To someone not familiar with Robocode, that might sound kind of bad. But to those who are familiar with Robocode...well, I can't speak for the rest of you, but I think it's pretty darn good. It achieves my early goal of reaching the top 100.

Version 3.5

This version has the following changes from the previous version:

  • Mostly fixed bug with gun aiming where aim was always one tick behind. Fixed this by aiming with predicted positions 1 tick into the future, though this won't be exact.
  • Future position prediction bug fixed (was not taking velocity into account when changing heading).
  • StatGun overhaul. I have attempted to make it as precise as possible. Changes to the StatGun include the following upgrades:
    • Segment "danger" is now added as a triangular region in the factors/divisions centered at exact sighting factor rather than at a fixed sighting factor (in other words, the values added to the bins approximates for the exact sighting location rather than centering at the center of the closest factor; I'd have to include a picture, as it is hard to explain). The triangular region added adjusts based on robot width (when a robot is closer, it's width causes it to span more divisions).
    • When getting the factor angle for a particular factor index, it now estimates an exact factor by considering the values in neighboring bins rather than taking the factor angle for the center of the pie slice for the factor index.
    • It now attempts to get state of opponent when my bullet wave hits them down to the partial tick.
    • Rolling history added.
  • Xander framework cleaned up and documented a little more.
  • Some segmentation changes on the StatGun. Now using lateral velocity, and wall smoothing (or wall proximity).
  • implemented a victory move when it wins. (because I can, though Robocode usually cuts the performance short)

The main purpose of this version is to see how much an improvement I can make just by polishing my guns.

Left out of this version (and possible changes for next version):

  • Drive flattening in special cases
  • Dive protection
  • The Red Eyed Monkey

Rumble Results

Version 3.5 had a couple of bugs that were causing it to crash hard. I found the bugs and updated it. Waiting to see how 3.5.1 does.

Performed worse than 3.4. The problem I believe is a combination of 2 factors -- my segmentation isn't right, and my mix of guns is throwing things off. I believe by continuing to allow other guns to fire, it is polluting the statistics of the stat gun (the stat gun still records everything, but the opponent behaves in a less predictable fasion).

Note: despite worse performance overall, performance on uCatcher improved quite a bit due to the improvements to the stat gun core.

Version 3.6

This version will include the following changes from the previous version:

  • Linear and Circular guns are only be used if their hit ratio early on is very high.
  • New higher quality segmentation processing for the guns allowing for the comparison of segment combinations on the fly (hotness!).
  • Gun segmenters in use changed to lateral velocity, bullet speed, and wall smoothing (wall proximity).

Rumble Results

No improvement overall. Improvement against the top robots, but somehow this version loses too many points against the middle of the pack. It could be the restriction of the linear and circular guns has something to do with it.

Version 3.7

This version includes the following changes from the previous version:

  • Re-worked how guns are handled in the Xander framework. The performance of all guns can now be tracked simultaneously, rather than only for the active gun. This is a big deal and should help a lot with some of my earlier troubles where gun selection was sloppy. What this means is that I no longer have to actually shoot a gun to know it's performance, and can switch between them much more intelligently.

Rumble Results

Positive movement, and highest rank yet, though only by a few places. The update in this version is brilliant, but not a silver bullet. Still a few areas I need to work on.

Version 3.8

Version changes:

  • Fire power. I haven't changed how I figure fire power since the beginning. With version 3.8, I've finally tuned it. This alone made enough of a change that I have decided to release it as a new version, without making any other changes.

Version 3.9

Changes in this version:

  • Added new gun that takes care of a problem area. The new gun specifically targets the factor the opponent was at on the previous shot.
  • Fixed bug of checking gunTurnRemaining() < really-small-number before firing (oops! it can return negative values for left turns -- need to take absolute value!)
  • Fixed bug that was making calculated timing of when my bullet waves hit the opponent inaccurate.
  • Fixed issue with hit ratio of Xander guns going down immediately on bullet fire (then back up if it hits); it now waits until the bullet either hits or misses before updating hit ratio numbers.
  • Fixed bug in wall smoothing gun segmenter.
  • Now handling bullet-hit-bullet when tracking my own bullet waves.

Areas that can still improve:

  • Stat Drive? I still don't have a good dive protection. And I could potentially employ the dynamic segmentation approach I created for the Stat Gun, and adjust the segmentation for it as well. I could also play with "flattening" again in special cases, but the approach would need to be sure-proof.
  • More analysis could improve things. Possibly changing how data points get rolled off in the StatGun and StatDrive.
  • Fire power selection might could be tuned again, but for this version I left it as is to get a better idea of how the other changes play out.

Rumble Results

Moved up in the ranks some. How much of it was my bug fixes and how much of it was the new gun is hard to say. GeomancyBS and BulletCatcher results were interesting. Possible bug causing my bot to disable? I'll have to investigate it.

LOL. No bug with BulletCatcher or GeomancyBS. My guns appear to be newly vulnerable to bullet shielding, likely due to some of my bug fixes. Pretty funny really. I will make sure it's fixed in the next version. Skotty 22:08, 13 June 2011 (UTC)

Version 4.0

Since this version goes back to working on the drive instead of the guns, and since XanderCat is quite a bit different from where it was at version 3.0, I've decided to update the major version number.

Changes in this version include:

  • "Dynamic" segmentation processing, developed originally for the Stat Gun, is now added to Stat Drive as well. This allows me to consider different segment combinations on the fly, rather than being locked into one segmentation combination.
  • Changed segmenters used in the stat drive to lateral velocity, relative direction, defender speed, and wall smoothing (wall proximity).
  • Increased stat drive bins from 47 to 87.
  • Added new bullet shielding protection gun. This gun is just a wrapper (or decorator, in GUI terms) for other guns. This gun wrapper detects bullet shielding and, when detected, shifts the position of the opponent "snapshot" a small random amount laterally (currently a distance of 5 to 10 in either direction).
  • When the opponent is in the way from reaching the "ideal position", the IdealPositionDrive now tries to drive around the opponent instead of through them.
  • Cleaned up framework in a few areas.

Version 4.1

Changes in this version include:

  • Now using a fixed bullet power instead of variable. Takes an extra variable out of the equation.
  • Fixed bug in segmentation handling in the StatDrive where segments would get used before they had enough data points.
  • Changed gun segmenters (since I switched to fixed bullet power, and one of my previous segmenters was bullet speed, I figured I might as well swap them up a bit -- changed them to match what I am currently using in the drive)

Version 4.2

Plans for this version include:

  • Update segmentation processing on the stat drive such that the no-segmentation array is always considered as an option, rather than just being used as a backup early in the game when the segments are low on data points. Will this improve my scores on the middle pack?
  • Updated fire power selection. Fire power will remain at a constant level as in the previous version most of the time, but will jump up to maximum power at very close ranges where a miss is unlikely.
  • New Ram Escape Drive added to the "drive tree". This drive engages only when in very close proximity to the opponent, and attempts to back away in an intelligent manner. It is targeted primarily at ramming robots or robots who like to crowd in as close as possible (e.g. as.xbots 1.0). At such close ranges, wave surfing is rendered ineffective, resulting in roughly 50% scores. The Ram Escape Drive intends to increase scores against such robots.
  • Fix bug where XanderCat still fires a bullet when down to 0.1 energy.

Drive tree for Version 4.2:

               Ram Escape Selector
          /-------------^--------------\
  Ram Escape Drive               Anti-Mirror Selector
                            /-------------^---------------\
                    Anti-Mirror Drive              Active Bullet Waves Selector
                                              /-----------------^----------------\
                                   Ideal Position Drive                     Advanced Stat Drive

Gun tree for Version 4.2

           Opponent Disabled Check
         /-----------^------------\ 
 Head-On Gun              Bullet Shield Protected Wrapper
                                        |
                               Anti-Mirror Selector
                               /--------^----------\
                   Anti-Mirror Gun             Virtual Hit Ratio Selector
                                   /-----------/----------^-----\--------------\
                            Linear Gun     Circular Gun      Stat Gun*     Advanced Stat Gun                       
  • The basic Stat Gun is configured specifically to target the last guess factor where an opponent was seen.

I also plan to investigate more middle-pack opponents to try to determine where XanderCat can improve. This might result in a few other changes.

Version 4.3

Changes from the previous version:

  • Fixed issue with advanced stat gun segments not being properly balanced based on data load.
  • Advanced stat gun segments must now have a certain number of data points before being used.
  • Advanced stat gun no-segmentation array is now a valid option at all times.


Version 4.4

Changes from the previous version:

  • Finally implemented dive protection (score on Barracuda up from about 95% to about 98%).
  • Fixed bug where the number of data points for a segment in the stat gun / advanced stat gun was being calculated incorrectly.
  • Fixed bug with Bullet Shield wrapper not propagating call to initialize wrapped gun for new round.
  • Added bias to the virtual hit ratio gun selector such that linear gun is only used if it's virtual ratio is at least 5% better than the other guns. (this may be modified again before this version is released)
  • Changed segmentation on main gun and drive to use defender relative direction, defender speed (positive only), bullet travel time, and wall smoothing (wall proximity).
  • Added minor negative danger (-5% of what gets added for a hit) in the stat drive for factors when XanderCat doesn't get hit. Not sure if this is a good idea or not overall, but it makes sense to me. It means if XanderCat keeps going to the same factor, the opponent would have to get above a 5% hit ratio at that factor for XanderCat to go somewhere else. Works well on an opponent like Barracuda who might occasionally get in a lucky hit.

Version 4.4.1

Changes from the previous version:

  • Fixed bug that was causing stat gun no-segmentation array to never be used. This was rendering the basic stat gun targeting the last factor completely ineffective.
  • Fixed issue in how ram escape drive attempts to dodge bullets.

Rumble Results

Amazing how many differences there are with the "last factor" gun working again. While the last factor gun works well on certain opponents, it's presence seems to interfere with the performance of the advanced stat gun. Perhaps what I need to do is add a "bias" to the last factor gun, where it does not get used unless it's virtual hit ratio exceeds the advanced stat gun virtual ratio by a certain margin. Especially in the early rounds where the advanced stat gun is still learning.

The only other change this vesion was a change to the ram escape drive, to make it dodge bullets a little better. While this worked well on opponents like GubbmThree, it also worked a little worse in at least one case (as.xbots). I'll have to review this to see if it was just a matter of chance or if the ram escape drive needs more tweaking.

On further analysis, it appears the rank differences are not just a result of the last factor gun coming back online. It's a combination of factors that results in slightly different results against the same opponents.

Version 4.5

Changes from the previous version:

  • Xander framework updated to track rolling virtual hit ratios, configurable through the Configuration class. XanderCat makes use of this through the VirtualHitRatioGunSelector for choosing a primary gun. The VirtualHitRatioGunSelector looks at both the overall virtual hit ratio and the rolling virtual hit ratio. XanderCat currently weights the rolling ratio at 60% and overall ratio at 40% (subject to change before release).
  • Bullet fire power now ranges from 1.8 to 2.4 dependent on overall hit ratio on opponent.
  • Disabling self with bullet shot is now allowed if opponent is already disabled.

Version 4.5.1

Changes from the previous version:

  • Fixed bug where overall hit ratio was not getting carried over from round to round.

Version 4.6

This version adjusts fire power selection and focuses on improving distancing. Changes from the previous version:

  • Bullet fire power range adjusted to be from 2.0 to 2.5 (from 1.8 to 2.4).
  • Stat drive now retreats away from opponent rather than away from bullet wave when inside of optimal range.
  • Stat drive now advances on opponent some when outside of optimal range.

Opponent scan for retreat/advance is currently from the moment wave being surfed changes; it does not presently update on the fly, as the design doesn't currently support it. Nevertheless, using the opponent scan should be better than using the wave origin.

Version 4.7

Changes from the previous version:

  • Introduction of a Simple Targeting Drive, targeted primariliy at increasing scores against simple linear targeting, though it is also designed to work against head-on targeting. The advanced stat drive works fine against head-on targeting, but underperforms against simple linear targeting (achieving only around 75% against linear targeters, whereas over 90% is a reasonable expectation for an intelligent robot). Are there many linear targeters out there? Well...I know of at least one, so might as well take it into consideration. Simple Targeting Drive stays online so long at hit ratio against it does not exceed 9%.
  • Refactored a lot of my wave surfing and guess factor code to use common components where ever possible. I had already done this with Segmenters in the past, but I'm now doing it with various other tasks as well, like determining reachable factor ranges, converting between factor angles and factor indexes, distributing weight within a factor array, and choosing best factors within an array. While I could have introduced bugs by doing this, in the long run it should decrease the likelihood of bugs, eliminate code duplication, make it easier to develop new guess factor components, and reduce overall code size.

A note on distributing weight within an array:

XanderCat 4.7 uses a WeightDistributer interface for it's guess factor guns and wave surfing drives. This allows the means for weight distribution within an array to be interchanged easily. At the moment, I have 3 different weight distributers: Triangle Distributer (used in XanderCat's guns), Wave Distributer (used in XanderCat's drives), and Point Distributer (currently unused).

Point Distribution     Triangle Distribution      Wave Distribution

        X                                                  X
        X                         X                        X
        X                       X X X                    x X x
_ _ _ _ X _ _ _ _         _ _ X X X X X _ _      . x x X X X X X x x .

Version 4.7.1

Changes in this version:

  • Fixed AIOOB bug in refactored method for getting reachable factor ranges. This bug was causing XanderCat to disable periodically. By chance, I didn't run across it in initial testing.

Version 4.7.2

Changes in this version:

  • Fixed bug in calculating factor span of opponent robot body. This was hurting performance of all stat guns.
  • Fixed bug with stat guns not rolling history properly.
  • Fixed the "last factor" gun, which I broke again during the version 4.7 update.
  • Sometimes the bullet (x,y) coordinate at time of bullet-hit-bullet seems to be a tick off. I don't see any flaws on my bullet position calculations -- could this be a Robocode quirk or bug? The problem this was causing was in trying to find a matching bullet wave for a bullet-hit-bullet event. To work around this, the code for finding the matching bullet wave will now consider it a match when the distance between bullet (x,y) and calculated bullet (x,y) is slightly over the bullet velocity.

Version 4.7.3

Changes in this version:

  • Fixed bug resulting in incorrect hit ratios for XanderCat's guns. (Oops! How long has that been broken?)
  • Fixed bug in gun controller that could result in NullPointerException when looking for bullet wave for bullet-hit-bullet event.
  • Now using Head-On Gun when "ram escape" is engaged.
  • Minor tweak to RamEscapeDrive.

Other Versions

I may release various other minor versions that are just tweaks and bug fixes. There are a number of configurable parameters I could play with. I might also update it specifically for melee and enter it in the melee rumble.