Talk:Anti-Surfer Targeting
From old wiki's Anti-Surfer Targeting page
There's not much concrete information about AntiSurferTargeting on this wiki (yet), but it is clearly an important aspect of a gun in the modern Robocode environment. Ascendant uses two guns in a VirtualGuns array, one that Mue says is tuned to hit adaptive movement. While I will have plenty more to say about this topic in the future, I just wanted to create this page (for now) and throw a few quick thoughts up on it.
A couple of important things for making an AntiSurfer gun have already become apparent to me:
- Non-firing waves will throw off targeting a WaveSurfer. It's kind of obvious why (they react to bullet fire), but a lot of top guns (Bee and many more) still use non-firing waves.
- Low rolling depth on your RollingAverages. Once a WaveSurfer has adapted to your targeting, a lot of your previously collected statistics are only helping him to continue to dodge you.
Beyond that, nothing is really certain to me just yet; I've seen my VirtualGun array choose a gun that is aiming for a "very low but not lowest" scoring factor bin on many occasions, but I haven't really proven that it is actually helping my targeting over the course of a whole match.
More to come...
-- Voidious
Bee still weights bullet-carrying waves higher than the other waves. I've experimented some with using only bullet-carrying waves against surfers but I have seen no improvement worth risking to compromise the performance against non-adaptive movement. The thing is that Bee's segmentation is extremely tuned towards the speed of learning that every-tick waves gives. Which makes an experiment like that very hard to carry out fully.
I think Ascendents anti-surfer gun isn't so much tuned against adaptive movement as it is fast-learning through light segmentation. Making it stay ahead of many surfers' speed of learning. But to accomplish that trick I think it fires waves every tick. Even so surfing is better against Ascendant than most other movements. It forces Ascendant to use lighter segmentation and then it can't reach the potential that its general-purpose gun has.
What I did in the latest Bee was to use two sets of segmentations. First I ask the "normal" segmentation about the best GF to use. Then I use feed that back to a segmentation that includes these GF choices. And then I fire at the GF that this second query gives. Against non-adaptive movement it should mean little to no difference. The sad part of the stpry is that it means little to no difference against surfers either... So far. I'll continue exploring it.
-- PEZ
Funny, I tried a very similar setup. I added a dimension to my gun that was the most probable GF coming from a non-segmented GF stats. Same result, it didn't work. It's not that I need an anti-surfer boost much. When it comes to hitting surfers, beeing different works quite well. ;)-- ABC
I started over with my stat arrays after 0.611, because it had like 8 in total, and I was too far from the KISS principle. As a result, my gun is still not quite as well segmented as the 0.611, but I got scores of 73% and 66.6% against CassiusClay TC in 100 and 500 rounds, respectively, with a RollingAverage depth of 1 last night. I also got my highest FastLearning score overnight with two guns, one with a normal rolling depth, one with a rolling depth of 2 ("anti-surfer gun"). I may run some tests with unsegmented or very lightly segmented (eg, only lateral velocity) guns with and without non-firing waves. That might be a decent way of judging just how much they are affecting the anti-surfer targeting. Another thought is to weight virtual waves by how far they are from the last or next real bullet. -- Voidious
Another interesting idea that I've explored a little is deducting from your GF bins when you hit the enemy, just as he will do the same in his WaveSurfing. (I know someone else mentioned this somewhere on the wiki, but I can't remember where.) This actually seems like the most accurate way of simulating the enemy's WaveSurfing / GuessFactor data to me. -- Voidious
Sounded interesting enough for me to try it. Perhaps I'm doing something wrong because I notice no big difference even against non-surfers. Just slightly degraded performance. Maybe it takes that you segment your gun exactly as the targets segments its movement? -- PEZ
The only thing I'm completely confident in right now is a low depth on a RollingAverage. It seems like two decent segmentations will be similar on at least *some* level... But perhaps not similar enough? -- Voidious
I'm not sure. As I said, I might have done something wrong in the implementation. That has certainly happened before. -- PEZ
One problem I had to adjust for was that I removed many waves before the real bullet "hit". If I did it again, I would actually change code so that waves "register" at the same spot as now, but aren't completely removed until a couple ticks later. Maybe that's happening to you, too? -- Voidious
Yes, that's probably what I do. Since I remove waves as soon as they reach the target outline. -- PEZ
I must say, the low rolling depth has really worked out for me for an AntiSurfer Gun. It is consistently the one chosen against surfers, and my TC scores against CC went up instantly when I added that second gun with the same segmentations but low rolling depth to my dev version. (Before that, my rolling depth was always low; now one gun is higher and one gun is very low.) And it stands to reason that stats should decay quickly against a surfer, or any adaptive movement. I will likely explore the "decrement bin score onBulletHit" idea in the future, too. -- Voidious
It certainly helps against some surfers. For me it gives me an edge against my own surfing and Ascendant and Tigger. While against Cyanide and a few others it makes things worse. As usual nothing helps against Shadow. If I can get this to work in a VirtualGuns setup it might give me some points. But VGs always risks screwing things up so I'm not taking any points to the bank just yet. =) -- PEZ
Moved from VirtualGuns/Help, 1/30/2006:
This weekend, I was actually thinking that there might be some much simpler way to detect a WaveSurfer, as opposed to using VirtualGuns like this. I'm not convinced it will work just yet, but here are some qualities that I think might help identify a surfer:
- A WaveSurfer is almost always perpendicular to you. - Yes, so are many non-surfing movements, but I'd say 99% of WaveSurfers have this quality.
- A WaveSurfer reacts to bullet fire. - Again, so do some non-surfing movements, but this is also common to all WaveSurfers. Not entirely sure how to best detect this, but I'm sure there are many ways.
- A WaveSurfer is rarely hit at GF0; or is rarely hit at the same GF twice. - This seems like the most promising method. Some WaveSurfers pre-load a GF0; or you could fire 0.1 bullets at GF0 until you hit them, and then see if they ever end up at GF0 again on a "real" wave.
It's just brainstorming, but WaveSurfing is such a distinct algorithm that it seems quite possible to accurately detect it. -- Voidious
It seems to me that wave surfers reverse velocity more frequently and sustain those velocities irregularly. I'm not sure, but they may not favor a 0 velocity at enemy fire time, which is more likely for a snop-n-go style movement. -- Martin
Well, a GoToStyle WaveSurfing would have a zero velocity at fire time somewhat regularly. Edit: I'm also pretty sure Ascendant has zero velocity at fire time pretty often. -- Voidious
I think you guys slipped into AntiSurferTargeting. =) You might want to move that stuff there actualluy. Back to VirtualGuns then... <snip> -- PEZ
Actually, I think Voidious was looking at an implementation of a virtual gun battery that did not rely purely on hit percentages (with or without weighting). He was determining gun selection through behavior observations. -- Martin
I think he was looking at an AntiSurferTargeting tool. You carry with you a gun which you trust is the best gun you have against WaveSurfing. You try to figure out if you are up against one. And if that seems the case you wield that gun. This is not VirtualGuns at all. It is well worth exploring, but it's something else. My particular problem isn't an anti-surfer one. I haven't created an anti-surfer gun yet even. I have two guns of different characteristics, where one is by a margin the best overall gun and the other one is capable to kill a few rumble participants more efficiantly. Now I want to find out if I can use VirtualGuns to select gun correctly enough to not risk my overall performance. Ascendant does it, so I know it is possible. But my own experiements are failing so far. -- PEZ
(Written concurrently to PEZ's post there...) Yes, I almost started posting it there, but I thought it applied to your case, too. In the case of "general purpose" and "anti-surfing" guns, I think it's worth considering an unorthodox (ie, not VirtualBullet hits) way of determining who is a surfer and who isn't, and thus what gun to use. It is probably a pretty common reason for using VirtualGuns among the higher end tanks. (Although I suppose it's not quite "Virtual Guns" in that case, it's just that VirtualGuns has become synonymous with "multiple guns".) <snip> -- Voidious
Also I like to avoid making synonyms of VirtualGuns and MultipleGuns. It's not just because I invented VirtualGuns. =) Yes you need several guns to do VG, but there are other ways to select guns than using virtual stats. I did some experiments on selecting-by-figuring-out-the-movement-type against PrairieWolf back when that was the bot I dreamed about beating. Never got anything working though. Mostly because all but the HOT gun on Marshmallow were broken, without me realizing it. (M had stellar movement without me realizing that either.) -- PEZ
I hear ya. MultipleGuns and VirtualGuns are definitely different; but VG is the only form of MG I've really encountered yet, so they were kind of synonymous to me until today. Anyway... <snip> -- Voidious
End of mass editing / moving from VirtualGuns/Help...
I took the Dookious 0.813 gun, and made it log a negative hit to the GuessFactor data when a real bullet hit the enemy in the AntiSurfer gun. (I used twice the amount it adds: one to compensate for adding when that wave breaks over the enemy, and another to really decrement it.) Over 50 seasons of TC2K6 FastLearning, it got an average of .4 higher vs the surfers; I know that is hardly statistically significant, but it's something, and it probably means that it's at least a not-bad thing to do. That's also in a VG array that is *very* reluctant to use the AntiSurfer gun. I will try doing some tuning as well as some more objective tests, comparing the AntiSurfer guns directly instead of as part of the VirtualGuns array, and let you guys know how it turns out. -- Voidious
Yes, just run the gun by itself and see what happens. I'm curious. -- PEZ
Hardly an exhaustive test, but all I could get done between work and class so far:
500 rounds | CassiusClay 1.9996bdTC | Cyanide 1.80.bTC | Score | Comment |
Dookious 0.813* | 70.91 | 76.94 | 73.93 | AntiSurfer used in 0.813 |
Dookious 0.813* | 74.08 | 77.15 | 75.61 | AntiSurfer gun, decrement on hit |
I'm running another test with some different settings. The above versions used a 1 weight on waves hitting, a rolling depth of 2, and the "decrement" version used a 2 weight (and negative score) on real bullets hitting. -- Voidious
Ok, here's my dev AntiSurfer gun with and without decrements on real bullet hits. I've added very lightly weighted virtual waves; it's got rolling depth 3, weight of 3 on the (negative) bullet hits, 1 on non-virtual waves breaking, and .05 on virtual waves. I've included Dookious 0.813 (which is VG, not pure AntiSurfer, keep in mind) for reference.
35 rounds | CassiusClay 1.9996bdTC | Chalk 1.2TC | Cyanide 1.80.bTC | Tigger 0.0.23TC | Score | Comment |
Dookious 0.813 | 68.63 | 83.59 | 74.25 | 90.43 | 79.23 | 50 seasons (for reference) |
Dookious 0.813* | 74.78 | 88.20 | 78.36 | 91.20 | 83.13 | 17 seasons with decrements |
Dookious 0.813* | 71.53 | NaN | 76.97 | NaN | N/A | 20 seasons w/o decrements |
I've also got a hunch that this will have a positive side effect in making this a very unattractive gun for non-surfers according to my VirtualGuns ratings. I think this idea has definite merit. Edit note: I ran 17 seasons of each, and then ran 3 more; I noticed I ran the last 3 on the "with decrements" with them still disabled, so I've subtracted those seasons. The rest is correct, I promise. =) -- Voidious
Interesting footnote: Tonight, I noticed that my WaveSurfer gun was still using a "good but not best" bin instead of just the best bin, like I thought it was. Probably very little difference in actual results, but still very surprising that I forgot it was using that this whole time. Doh! -- Voidious
Awesome. -- PEZ
I thought it was worth noting here that both PEZ and I are using decrements on real bullet hits now (to different degrees.) It seems to help noticeably in hitting surfers, and also does a good job of making an AntiSurfer gun get a bad VirtualGuns rating against non-surfers. I don't think it works as the core feature of an AntiSurfer gun, but I do think it's worth trying in an AntiSurfer gun for anyone that's really trying to rock the PremierLeague. (If you're not using stat buffers, though, I'm really not sure how you could implement this idea. =) ) I'd say these are the key features of my AntiSurfer gun:
- Very low weight to virtual waves - I use 1/20th (0.05)
- Very low rolling depth - I use 3 right now
- Decrement on bullet hits - I weight these 3 right now
- In addition to the onBulletHit decrement, I don't even consider using the AntiSurfer gun if Dooki's bullet damage given is more than (4/3) the bullet damage taken this match. That value could surely be tweaked, but it seems like a good failsafe; when there are expert WaveSurfers with horrible guns, let me know. =)
-- Voidious
I can't help but wonder what David Alves might have to contribute to this page. Dookious certainly has one of the best AntiSurfer guns in the rumble, but I think Phoenix and Shadow have it soundly beat in this area. Care to share some tips with us, David? -- Voidious
How to hit surfers:
- Buy a pair of boxing gloves.
- Drive to the beach.
- Go at it!
I tried it, but i got only one surfer lying on the beach. Everyone else was surfing and i had no chance to get them, they are that fast and unpredictable! Do you have a trick to get them? --Krabb
David, your insightful, metaphoric commentary has truly opened my eyes! Thank you! -- Voidious
Just wait on the beach, Krabb. They'll have to come ashore eventually. --David Alves
PatternMatching has been long considered a somewhat obsolete form of targeting, but it does work very well vs. surfers. Although they keep very flat profiles, surfers tend to move predictably. They also dodge bad guess factors instead of bad movement patterns. SeaSerpent's pattern matching gun with simple rolling and a lower multiple choice makes a surprisingly strong anti surfer gun. Here are my initial results:
500 rounds | CassiusClay 1.9996bdTC | Chalk 1.2TC | Cyanide 1.80.bTC | Phoenix 0.855TC | Shadow 3.66dTC | Tigger 0.0.23TC | |
SeaSerpent | 72.13 | 94.78 | 80.90 | 76.36 | 73.83 | 85.49 |
It has amazing scores vs. Chalk, Cyanide, Phoenix, and Shadow. On the other hand, it gets a terrible score vs. Tigger (almost 10 points below Dookious). I think this has the potential to become one of the strongest anti surfer guns ever made. The problem is it's kind of slow, so it wouldn't work well in a virtual gun array. Building a good anti surfer patternmatcher might just become the new thing in targeting... -- Kev
Those are some very nice scores. I tried Shaakious' gun last night against Phoenix, as it's a decent (also slow) PM gun, but it got like 62. Your Shadow and Phoenix scores are off the hook. I don't have exact numbers, but Dookious gets around 77 against CC with its AntiSurfer gun and 70 against Shadow with it. It actually just uses its Main Gun against Chalk, Cyanide, and Phoenix. It might be time for me to look at making a FoldedPatternMatcher... -- Voidious
I posted this idea under chase bullets, since it is sort-of related to that, and I hadn't yet found this page, but I have been working on a tactic to defeat Wave Surfers more easily. This does not rely on any particular gun type, but essentially some form of basic linear or circular gun might be good enough. the idea is to fire 0.1 bullets at the enemy, and to one side of it, so that it is forced to dodge the bullet, but if it goes the wrong way, it will be hit, and so will probably change direction when you fire the next bullet. If you fire along the same direction as the second bullet again, that should be enough to move it back in the direction it was going. This can be used to drive the enemy towards a corner (you will need to move around it, to force it into a corner, rather than just to a wall). Once it is close enough to the corner, it will have its movement options greatly reduced, and so will be very easy to hit. I saw this happen entirely by chance in a battle between my first half-decent robot and jp.Perpy, but the idea should work against all but the most advanced wave surfers. A really advanced wave surfer would be able to tell that if it stayed in the corner it would get hit very often, and so drive into the oncoming bullets so that it can escape, whereas a more basic one would try to dodge as best it can, and so it can be pinned in the corner by bracketing it with fire. I have not got this to work well yet, since it requires a lot of tweaking of values, and it would almost certainly need different values for each enemy, requiring a very long match to make a difference, although I suppose a config file could be used to store the best values it has discovered for each enemy. If I get this working properly I will add it as a mode of operation into my main robot, so it tries this if it is in a one-on-one match, and if it does not appear to work, switch over to normal VG or waves.
This idea is somewhat hard to explain, but should not be too difficult to implement in a wave surfing robot. Since I have not heard any other name for this type of gun, I will call it a Surfing Gun. If a wave surfer A, fitted with a surfing gun, were to fight robot B, then the Surfing Gun would calculate where A would go if it were the positions reversed. The problems are: 1) A has no idea which wave surfing algorithm B is using. This could be solved by using several VirtualGuns, but the time taken to perform the calculations could be prohibitive. 2) Furthermore, even if you did know which algorithm to use, you still do not know how many bins to use or what segmentation is being used. OTOH< this could be useful in a micro bot competition, since only the simplest WaveSurfing algorithms will fit, or for use against a WhiteWhale, if you can reverse-engineer its movement code.
Sign your work! Also, for a micro bot competition, you wouldn't be able to fit that much code. And as far as 'shepherding' the enemy into a corner, I think that this would make your movement very predictable, and they would kill you before you got there. However, give it a try, it may just work =). I know RamBots use this method to try and prevent their enemy from getting away. -- Skilgannon
Sounds like you have two very separate AntiSurfer ideas here, right? For the first one, I'm sorry, but I just don't think it will work. There's nothing about WaveSurfing that says you will reverse position when you get hit. Your own movement - whether you move closer or you move away - is more likely to determine where a WaveSurfer ends up. You could "corner" most surfers by just keeping a close distance, but be careful, as you will also be making it easier for them to hit you (like Skilgannon said). Many WaveSurfers actually end up cornered a lot (e.g., CassiusClay and Chalk, at least older versions), while others (e.g., Ascendant and Dookious) often end up in the middle of the field; to some degree, it's just a style of the movement.
As for simulating WaveSurfing stats and using them to hit an enemy: this is a seemingly good idea, but very hard to implement. Perhaps it is impossible! I have tried this many times in a variety of ways and never been able to even equal performance of a GuessFactor gun with a very low RollingAverage depth. But definitely good luck in exploring it yourself. =) There is certainly potential there.
-- Voidious
The best anti-surfer gun I have seen is made from strangely a DC gun using only the vary latest targeting info, it gets a very high hit ratio if the right segments are used. I personally think making an Anti-Surfer gun is easier then making a standard gun, generally because its targeted against only one kind of movement which is implimented almost exactly the same in almost all instances. :) --Chase-san
- That gives me an idea ... -- Simonton
- Newest Most Relevent, I guess, its hard to explain as I tossed that code away awhile back. --Chase-san
- I highly disagree that all surfers are implemented "almost exactly the same"! While the general algorithms are similar, the segmentation and other nitty gritty details are almost all completely different. I think it can seem easier to get a reasonable AntiSurfer gun because the bar of "good" is so much lower on surfers - just decay your data quickly and you will hit them way, way better than a non-decaying standard learning gun (thus seeming "good"). But compared to non-surfing movements, nobody has yet found out how to really accurately target surfers. -- Voidious
I started playing robocode several months ago, so I am still a beginner. However, I have thought about this a bit and have two rather simple methods that could be tried.
1) Rather similar to chase bullets, I call my idea wave breaking. Basicly you want several bullets to be in the proximity of the enemy at once. So you would fire a high power shot and then one or two lower powered ones. I think this could have several interesting effects. Depending on how the wave surfer is coded:
a) If the closest wave changes suddenly, the robot's movement might be affected. eg. turning around
b) The robot may be pushed back by having a line of waves coming at them at once if they use some form of Anti-Gravity movement.
c) The robot might not weight waves by bullet power, so if a 0.1 bullet is fired at guess factor 1 and a 3 at guess factor 0 the robot may be hit by the 0.1 and when avoiding that guess factor next time it may be hit by the more powerfull bullet, and not weight the second guess factor any heigher.
d) The three preceding points were assuming that the bullets would be fired to three separate locations, however if they were all fired to one the amount of damage would be greater than just one bullet hitting while the wave surfer gets no extra data. (ie. theoretically higher shot power is better against wave surfers because they learn less for the amount of damage caused)
2) Bullet sheilding, besides its usuall effects would cause a wave surfer to think that it's opponent's guess factors were different than they really were. Thus you could alternate between bullet shielding and shooting at the wave surfer, in essence giving the wave surfer false data. -- AW
- [View source↑]
- [History↑]
You cannot post new threads to this discussion page because it has been protected from new threads, or you do not currently have permission to edit.
Contents
Thread title | Replies | Last modified |
---|---|---|
Performance Enhancing Bug | 20 | 20:46, 13 May 2013 |
I started working on a mini-sized GF gun which I plan to have both an anti-RM and anti-WS component. First, I used Raiko's gun as a base, and then I added Bin Smoothing from Vyper. The problem was, I forgot to change the array type from int
to double
, so the bins couldn't hold decimal values and got rounded down. One would think that this would have a harmful effect, but it actually had a significantly positive effect on my robot's score against surfers. I thought that maybe the smoothing was too heavy, so I tried lower smooth factors, and I even tried getting rid of the smoothing altogether, but I still couldn't replicate the score increase.
Any ideas why this happened? Could it be something about the decay rate instead of the smoothing? Has anyone else ever noticed this?
That's very interesting. Since lower smoothing factors didn't replicate the score increase, I believe key difference is most likely the shape of the smoothing rather than the extent of the smoothing. I can think of two changes in the shape of the smoothing that may be caused by integer rounding and may be significant:
- Depending on what kind of smoothing you used, the integer rounding may have caused several bins at the center of the hit to be incremented by the same value. It's possible eliminating the bias towards the center of the 'hit' may be of benefit in targeting surfers perhaps. To confirm/refute this hypothesis, you can keep 'double' but modify your smoothing code to keep a 'flat' region around the center of the smoothing.
- The integer rounding would reduce the influence far from the 'hit' to zero. It is possible that small influences from excessively distant 'hits' may have a detremental effect, possibly making your targeting more predictable. To confirm/refute this hypothesis, you can keep 'double' but modify your smoothing code have a sharp cutoff for the maximum distance from the 'hit' that it gets smoothed into.
For the sake of easy reference, below is all immediately relevant code. The weight
is 4 if this is a wave fired the same tick that an actual bullet was fired, and 1 otherwise. Notice that the actual smoothing is done by raising the difference between the current GF and the visited GF to the power of 0.3. I tried factors of 0.1 and just 0 (effectively the same as not smoothing at all), with little success.
int gf = GF_ONE;
try
{
do
{
waveGuessFactors[gf] *= 0.995;
waveGuessFactors[gf] += (weight * Math.pow(0.3, Math.abs(gf - (int)(GF_ZERO + Math.round(Utils.normalRelativeAngle(Math.atan2(enemyLocation.x - firePosition.x, enemyLocation.y - firePosition.y) - absoluteBearing) / bearingDirection)))));
gf--;
}
while (true);
}
catch (Exception ex)
{
}
I highly doubt your first hypothesis, because every other GF than the one that was actually visited would be increased by 0. Unless of course, the wave has a weighting of 4, but even before I added weighting, the int
arrays performed better.
Your second hypothesis has the same problem. Any GF other than the visited GF would get rounded down to 0, under normal circumstances.
Yeah, the first hypothesis was only applicable to greater-than-1 weight for most kinds of smoothing, which I had thought to be likely.
The second hypothesis still isn't ruled out by that however. "Any GF other than the visited GF would get rounded down to 0" is in fact the most extreme version of what I describe in the second hypothesis.
Now that I know you are using a weight of 1 however... and thinkning about your decay... I'm now quite certain that the real cause is not anything about the smoothing, but the decay. Specifically, applying the operation "foo *= 0.995" where "foo" is an integer in the range 1 to 199, is equilivant to a decrement-by-one operation. When your weight is 1 and your array is an integer one... this means that your decay might as well be "foo *= 0.0" because you're immediately completely erasing the last data point when the next arrives.
It looks to me like you have basically made your gun only keep the latest hit index at each segment, so basically a segmented version of MirrorMicro's gun. A rolling depth of 0 makes sense as to why it would be good against surfers - it is basically how a standard VCS anti-surfer gun is made. Fairly coarse segmentation, and low rolling averages.
If you want to keep that performance, but with lower codesize, you could probably get rid of the bins at each segment and instead just store a single value which would represent the last GF you saw. This is basically what I do in DrussGT for the movement, except I keep the last few GFs as well as a little info like the rolling depth and the segment weighting.
Also, weighting real-bullet waves higher than tick waves helps too, right?
Do you think I would be able to fit a Virtual Guns system in 100-200 bytes? Or will I just have to sum the different buffers like Vyper?
Against surfers, yes. Real waves are more meaningful since surfers react to waves.
Against flatteners, no. The more data you use, the harder it is to flatten all statistics.
If you already have the waves running a VG shouldn't be that much more codesize, just another thing to check when the wave breaks. Of course, it is important to have your VG only work on real waves otherwise it is pretty useless against surfers and bots that react to bullet fire.