Anti-Surfer Targeting

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.

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.

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

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 GoToStyleWaveSurfing 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

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

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:

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

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

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. =)

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

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:

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.

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

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 just had an idea of how to decide whether to use your anti-surfer gun or not: if they are orbiting the fire-location of the nearest bullet, and not you, then they are DEFINITELY a surfer. No questions asked. Of course this doesn't help if they decide to orbit you instead...but it may make the choice that much easier. -- Skilgannon

That's a good idea. I've definitely had some interest in developing AntiSurfer detection that goes beyond VirtualGuns, such as detecting perpendicular movement (not unique to surfers, but it's still evidence) or how much they are altering their MovementProfile. However, it brings up a new issue, and one that might be even harder to deal with than tuning VirtualGuns - what about the surfers which your Main Gun hits better than your AntiSurfer gun? For Dookious, that's a lot of them. -- Voidious

Well, isn't detecting surfers as such a moot point, because if a properly tuned VirtualGuns array is getting better hit rates on a non-anti-surfer gun, against a surfer, doesn't that indicate that it would do best to not use the anti-surfer gun anyways? -- Rednaxela

Well, yes, it very well might be. But if you had an AntiSurfer gun that legitimately did as well or better than your Main Gun against all surfers, then you'd be better off with a more accurate surfer detection than with VirtualGuns. On the flip side, if you had a trusty AntiSurfer detector, it might keep you from using the AntiSurfer gun against non-surfers. (Hit rates fluctuate and matches are relatively short, so VirtualGuns will always be wrong sometimes, as odd as that sounds. =)) -- Voidious

Hmm, well, one thing is it might be effective to use such surfer detection until the VirtualGuns have gathered stable enough information. Also, this reminds me of one thing. I don't think such fluctuations are necessarily a bad thing, because when I was developing my first bot Mervin, it had a VirtualGuns array of a few simple targeting methods, and after some experimentation I found that it actually helped against surfers and multi-mode bots to roll the VirtualGun stats very rapidly as to enhance such fluctuations. This makes me wonder, if maybe it would be an interesting strategy, to apply PatternMatching to VirtualGuns, to looks for patterns of which sequences of guns may work best fire with, perhaps segmenting the pattern matcher on other stats. -- Rednaxela

I think surfers are able to actively dodge most guns. To make a gun that is more effective against surfers than a random gun is the ultimate goal, and once you have this gun it is preferable to use this gun, and this gun only, no segmenting your VG stats, or anything like that. -- Skilgannon

Both of my guns are more accurate than a random gun against surfers. =) Against some surfers, the Main Gun is better (and not just chumps, bots like Cyanide and CassiusClay). I'd have to really improve or alter my AntiSurfer gun before I could trust a surfer-detection system over a VirtualGuns system to make the gun choice for me. It could be quite worth the effort if you could get the whole setup working, though! -- Voidious

How about using the above detection method to *enable* the anti-surfer gun in your array? So you never use it against random movers, etc. Or, when the above method shows no surfer, the anti-surfer gun VG rating is handicapped, and otherwise no handicap on the anti-surfer gun? Another thought just struck me: wouldn't it be possible to figure out the values in the movement buffers of a True Surfer by checking when they speed up/slow down? It might be complicated if they have a stop option as well, but it's still better than nothing. This could make for some pretty mean anti-surfer targeting with fast-rolling stats... and make Goto surfing a whole lot more desirable ;-) I always thought there was something weird about not knowing where you're going until you get there. It turns out, it's because the enemy can see when you're making your decisions. -- Skilgannon

Well, perhaps against some varieties of "true surfers", figuring out their buffers might be possible. Of course, it's very dependent I think on you figuring out what type of segmentation they're using, and I also think that against DC based surfers it becomes trickier than against VCS generally, at very least by virtue of being a bit different and that cluster size can have a notable effect. Ones that evaluate multiple waves instead of just one would be even trickier to make out anything useful from, because it becomes even more dependent on knowing their segmentation as well as their danger evaluation or smoothing methods (knowing when they'd weave). Furthermore I think the matter gets even trickier when you get into "lazy" surfers like I'm working with lately. So overall I'd say.... perhaps you could make this work, but I think it would only work that well against some of the simplest "true surfers" (the kind that think like: evaluate only one wave and just think about the danger at the point the simulation predicts we'd be at if we keep moving this this way till the wave hits). -- Rednaxela

Against a surfer that is using one buffer, I think it's maybe possible to deduce a TrueSurfer?'s danger stats like this. But against Dookious with 20-30 buffers (I don't even remember), or DrussGT with a hundred? You'd also have to know their WallSmoothing method, their distancing strategy, and those kinds of details. I don't think you could make heads or tails of any of it. Feel free to prove me wrong. =)

There is one idea that I still think has promise, and it's one that I tried but failed to get results from. Basically, we're simulating their surfing to get an idea how they might move based on the bullets in the air, and factoring it into our aiming stats. It's kind of hard to describe, but here we go:

Track surf stats from their perspective, just like they would. Sure you don't know their segmentation at all, but just use your own good segmentation. The assumption is that all good segmentations will give results in the ballpark of each other, so it will still be useful. (This assumption may be totally wrong - in which case, this whole thing's useless...)

Before aiming each time, create a "mask" buffer, which will be multiplied to the gun buffers, and initialize it to all 1s.

For each bullet in the air, starting with the one closest to them:

Determine the enemy's max reachable angle (bin) for the bullet.

Look at your pseudo-surf stats and use the dangers as (inverse) probabilities that the enemy will move there.

If the danger indicates the probability the enemy will move there for this airborne bullet, it's also the probability they will end up in the range that is still reachable on the current / aiming wave (if you assume they did move there).

Go through each reachable bin for this bullet, and use the danger / probability to factor into the mask the likelihood that the bot will end up in the still-reachable range. (This part's really tricky in several ways.)

I think it could really help. It might require way too much precise prediction to do it right, but maybe not. I believe there are probably some situations where it's totally obvious, based on previous data, that the enemy is going to surf an airborne bullet a certain way - you should be able to use that to influence your targeting. I'd actually be curious to hear if you guys think there is anything to this idea. It's the one that most tempts me to get back to Dookious. =)

Hmm, this would be an interesting way of going about it. One thought, is if it were me, I would create a variety of "fake" surfing buffers that track their perspective, using a number of common configurations. Perhaps a DC one, a few differently segmented VCS ones, a few flattener ones in different segmentations too perhaps, perhaps a variety of different rolling speeds. Then evaluate when a wave passes them, which "fake" surfing buffers appear most similar what may have motivated them to move, and based on that, better approximate what they're using. -- Rednaxela

Voidious, the reason I'm pretty excited about this method is because it should make it possible to learn not just 1 point on the enemy's buffer, as your AS gun currently does, but all the points. Imagine if, instead of just using a single peak to roll the stats in your AS gun, you use their entire profile. You would be able to see the peaks that they avoided by a lot, and the valleys that they only just missed stopping in (and which they might stop in next time). Using this on top of a lightly segmented GF gun, it could be much more accurate than just having 1 piece of information for each wave that passes. -- Skilgannon

Hey, I've some ideas. I don't know does anyone post it already because this page is very long. First, to hit a hit surfer, do exactly reverse of hit surfer. Only log the hit on hit, perform a bin smoothing, choose the lowest in precise maximum escaped angle when this wave is enemies closest wave =D. --Nat

Well, for one thing, it will *always* miss any surfer who is flawed in a way that makes them unable to get to the max predicted GF every time. Additionally, and perhaps more importantly: It won't work because well. You fire bullet A, at the lowest point, the surfer starts moving to it, you fire bullet B at the lowest point, more advanced surfers may change course due to taking bullet B into consideration too which will ruin the aim of bullet A. Even if it's a very basic surfer that only considers the nearest bullet, bullet B's aim will be ruined by movement for bullet A unless you take into consideration how bullet A will restrict the movement of for bullet B. Additionally, this would only work if you segmentation is very similar to that of the surfer too. So really, there are a lot of variables to consider that make simply aiming for GFs rarely hit before rather futile. --Rednaxela

I mean, you need to predict enemy path trough each active waves, then perform MEA of the new wave =) soud very complicated --Nat

I once tried a similar aproach, but as Rednaxela said, it wasn't good. Besides all he said, you also have to consider that many surfers don't go to the safest place they can, just a safe enough, in my last tests I actuallt found it better to stop as much as possible is better, so I if the stop danger is only a bit bigger than the orbit danger, I will stop. I believe this is because the "safest" place doesn't mean sure dodge, having low velocity gives your bot more symmetric reach points on either direction and you keep changing what segment uses your enemy. But those are just guesses ;) --zyx