Difference between revisions of "CassiusClay/VirtualGuns Help-me"

From Robowiki
Jump to navigation Jump to search
(migrating from old wiki)
 
m (update table style)
Line 11: Line 11:
 
* I think that is very unsurprising :-) The whole WaveSurfing / AntiSurferTargeting dilemma is completely dependent on the fact that WaveSurfers react to bullet fire! -- [[Voidious]]
 
* I think that is very unsurprising :-) The whole WaveSurfing / AntiSurferTargeting dilemma is completely dependent on the fact that WaveSurfers react to bullet fire! -- [[Voidious]]
  
And some results. This is my current dev gun's TargetingChallenge score over 500 rounds against the TargetingChallenge2K6 reference version of CC.
+
And some results. This is my current dev gun's TargetingChallenge score over 500 rounds against the TargetingChallenge2K6  
 +
reference version of CC.
  
| Guns used            | CC 1.9996bdTC
+
{|
| Classic Bee gun alone | '''58.40'''  
+
| Guns used            || CC 1.9996bdTC
| Anti-surfer gun alone | '''72.12'''
+
|-
| Both guns (VG)        | '''66.26'''
+
| Classic Bee gun alone || '''58.40'''  
 +
|-
 +
| Anti-surfer gun alone || '''72.12'''
 +
|-
 +
| Both guns (VG)        || '''66.26'''
 +
|}
  
 
Maybe you can see why I want my VG act together? Yes, I still manage to improve against CC, but since the Classic Bee gun is the better choice against the vast majority or RR@H bots the trade-off in performance from the best gun to the VG isn't a very smart one.
 
Maybe you can see why I want my VG act together? Yes, I still manage to improve against CC, but since the Classic Bee gun is the better choice against the vast majority or RR@H bots the trade-off in performance from the best gun to the VG isn't a very smart one.
Line 46: Line 52:
 
Now I have added a "stabilizor" to my VG array. It's quite simple. I just measure the "real" performance of the guns when they are in operation and then multiplies the virtual and real ratings. The theory is that even if the secondary guns hollers high about how high virtual hit rate it has the selector can still just tell it "well done little gun, but look at your real performance when you've been given the chance". To give each gun some little benefit of the doubt I use the first 8 rounds to alter the guns so that both are used for a full 4 rounds before the auto-selection starts. With this solution I run a real risk at stubbornly holding on to the wrong gun just because the right gun had had some bad luck in the start. But over 500 rounds it seems I might recover. Check the following TC2K6 results table:
 
Now I have added a "stabilizor" to my VG array. It's quite simple. I just measure the "real" performance of the guns when they are in operation and then multiplies the virtual and real ratings. The theory is that even if the secondary guns hollers high about how high virtual hit rate it has the selector can still just tell it "well done little gun, but look at your real performance when you've been given the chance". To give each gun some little benefit of the doubt I use the first 8 rounds to alter the guns so that both are used for a full 4 rounds before the auto-selection starts. With this solution I run a real risk at stubbornly holding on to the wrong gun just because the right gun had had some bad luck in the start. But over 500 rounds it seems I might recover. Check the following TC2K6 results table:
  
| Name | Author | Gun | Bfl | CC | Chk | Cig | Cya | DM | FM | Grb | RMB | Tig | Score | Comment
+
{| border="1"
|CC2 VG /w "stabilizor" | PEZ | GF | 99.80 | 67.91 | 92.44 | 88.51 | 78.11 | 95.98 | 94.12 | 93.02 | 92.78 | 87.66 | '''89.03''' |
+
|Name
|CC2 VG | PEZ | GF | 99.98 | 64.98 | 93.31 | 87.64 | 77.95 | 96.37 | 93.24 | 92.49 | 93.59 | 87.33 | '''88.69''' |
+
|Author
|CC 1.9.9.99a | PEZ | GF | 99.99 | 61.68 | 92.19 | 90.56 | 76.67 | 97.97 | 94.77 | 93.22 | 92.58 | 81.59 | '''88.12''' |
+
|Gun
|Shadow 3.66 | ABC | DC | 99.85 | 72.26 | 96.16 | 85.04 | 74.01 | 95.50 | 90.77 | 90.56 | 89.67 | 86.67 | '''88.05''' |
+
|Bfl
|CC 1.9.9.96bd | PEZ | GF | 99.89 | 57.06 | 94.07 | 89.71 | 78.28 | 96.65 | 93.71 | 92.46 | 92.92 | 80.86 | '''87.56''' |
+
|CC
|Dookious 0.611 | Voidious | GF | 99.32 | 67.71 | 88.19 | 78.96 | 78.6 | 92.08 | 89.48 | 85.89 | 87.25 | 84.27 | '''85.18''' |
+
|Chk
|Max 0.8.9 | Pulsar | GF | 98.51 | 67.34 | 76.92 | 87.38 | 71.43 | 94.97 | 88.18 | 90.97 | 89.52 | 76.75 | '''84.20''' |
+
|Cig
|Raiko 0.43 | Jamougha | GF | 99.93 | 59.41 | 78.14 | 84.64 | 68 | 94.92 | 89.47 | 91.01 | 90.76 | 74.98 | '''83.13''' |
+
|Cya
 +
|DM
 +
|FM
 +
|Grb
 +
|RMB
 +
|Tig
 +
|Score
 +
|Comment
 +
|-
 +
|CC2 VG /w "stabilizor"
 +
|PEZ
 +
|GF
 +
|99.80
 +
|67.91
 +
|92.44
 +
|88.51
 +
|78.11
 +
|95.98
 +
|94.12
 +
|93.02
 +
|92.78
 +
|87.66
 +
|'''89.03'''
 +
|
 +
|-
 +
|CC2 VG
 +
|PEZ
 +
|GF
 +
|99.98
 +
|64.98
 +
|93.31
 +
|87.64
 +
|77.95
 +
|96.37
 +
|93.24
 +
|92.49
 +
|93.59
 +
|87.33
 +
|'''88.69'''
 +
|align="center"|
 +
|-
 +
|CC 1.9.9.99a
 +
|PEZ
 +
|GF
 +
|99.99
 +
|61.68
 +
|92.19
 +
|90.56
 +
|76.67
 +
|97.97
 +
|94.77
 +
|93.22
 +
|92.58
 +
|81.59
 +
|'''88.12'''
 +
|
 +
|-
 +
|Shadow 3.66
 +
|ABC
 +
|DC
 +
|99.85
 +
|72.26
 +
|96.16
 +
|85.04
 +
|74.01
 +
|95.50
 +
|90.77
 +
|90.56
 +
|89.67
 +
|86.67
 +
|'''88.05'''
 +
|
 +
|-
 +
|CC 1.9.9.96bd
 +
|PEZ
 +
|GF
 +
|99.89
 +
|57.06
 +
|94.07
 +
|89.71
 +
|78.28
 +
|96.65
 +
|93.71
 +
|92.46
 +
|92.92
 +
|80.86
 +
|'''87.56'''
 +
|
 +
|-
 +
|Dookious 0.611
 +
|Voidious
 +
|GF
 +
|99.32
 +
|67.71
 +
|88.19
 +
|78.96
 +
|78.6
 +
|92.08
 +
|89.48
 +
|85.89
 +
|87.25
 +
|84.27
 +
|'''85.18'''
 +
|
 +
|-
 +
|Max 0.8.9
 +
|Pulsar
 +
|GF
 +
|98.51
 +
|67.34
 +
|76.92
 +
|87.38
 +
|71.43
 +
|94.97
 +
|88.18
 +
|90.97
 +
|89.52
 +
|76.75
 +
|'''84.20'''
 +
|
 +
|-
 +
|Raiko 0.43
 +
|Jamougha
 +
|GF
 +
|99.93
 +
|59.41
 +
|78.14
 +
|84.64
 +
|68
 +
|94.92
 +
|89.47
 +
|91.01
 +
|90.76
 +
|74.98
 +
|'''83.13'''
 +
|
 +
|}
 +
 
  
 
You can see that the stabilizor version choosed the wrong gun against Butterfly. I guess maybe it is a bit difficult to see the difference between two almost perfect hitrates. It also seems the right gun (classic Bee) was used against Cyanide and I still trash a bit between the guns against CC. Also, I removed the anti-surfer segmentation of my regular Bee gun which I think I will re-install since that thing seemed to give me [[Cigaret]]'s number.
 
You can see that the stabilizor version choosed the wrong gun against Butterfly. I guess maybe it is a bit difficult to see the difference between two almost perfect hitrates. It also seems the right gun (classic Bee) was used against Cyanide and I still trash a bit between the guns against CC. Also, I removed the anti-surfer segmentation of my regular Bee gun which I think I will re-install since that thing seemed to give me [[Cigaret]]'s number.
Line 67: Line 210:
  
 
I now have an idea how to make the stabilizor a bit less dangerous. But here are the latest results before I implement that:
 
I now have an idea how to make the stabilizor a bit less dangerous. But here are the latest results before I implement that:
| Name | Author | Gun | Bfl | CC | Chk | Cig | Cya | DM | FM | Grb | RMB | Tig | Score | Comment
+
{| border="1"
|CC2 VG /w "stabilizor" .b | PEZ | GF | 100.00 | 72.39 | 92.53 | 90.25 | 77.35 | 96.67 | 91.76 | 92.07 | 91.81 | 90.31 | '''89.51''' |
+
|Name
|CC2 VG /w "stabilizor" | PEZ | GF | 99.80 | 67.91 | 92.44 | 88.51 | 78.11 | 95.98 | 94.12 | 93.02 | 92.78 | 87.66 | '''89.03''' |
+
|Author
|CC2 VG | PEZ | GF | 99.98 | 64.98 | 93.31 | 87.64 | 77.95 | 96.37 | 93.24 | 92.49 | 93.59 | 87.33 | '''88.69''' |
+
|Gun
|CC 1.9.9.99a | PEZ | GF | 99.99 | 61.68 | 92.19 | 90.56 | 76.67 | 97.97 | 94.77 | 93.22 | 92.58 | 81.59 | '''88.12''' |
+
|Bfl
|Shadow 3.66 | ABC | DC | 99.85 | 72.26 | 96.16 | 85.04 | 74.01 | 95.50 | 90.77 | 90.56 | 89.67 | 86.67 | '''88.05''' |
+
|CC
|CC 1.9.9.96bd | PEZ | GF | 99.89 | 57.06 | 94.07 | 89.71 | 78.28 | 96.65 | 93.71 | 92.46 | 92.92 | 80.86 | '''87.56''' |
+
|Chk
 +
|Cig
 +
|Cya
 +
|DM
 +
|FM
 +
|Grb
 +
|RMB
 +
|Tig
 +
|Score
 +
|Comment
 +
|-
 +
|CC2 VG /w "stabilizor" .b
 +
|PEZ
 +
|GF
 +
|100.00
 +
|72.39
 +
|92.53
 +
|90.25
 +
|77.35
 +
|96.67
 +
|91.76
 +
|92.07
 +
|91.81
 +
|90.31
 +
|'''89.51'''
 +
|
 +
|-
 +
|CC2 VG /w "stabilizor"
 +
|PEZ
 +
|GF
 +
|99.80
 +
|67.91
 +
|92.44
 +
|88.51
 +
|78.11
 +
|95.98
 +
|94.12
 +
|93.02
 +
|92.78
 +
|87.66
 +
|'''89.03'''
 +
|
 +
|-
 +
|CC2 VG
 +
|PEZ
 +
|GF
 +
|99.98
 +
|64.98
 +
|93.31
 +
|87.64
 +
|77.95
 +
|96.37
 +
|93.24
 +
|92.49
 +
|93.59
 +
|87.33
 +
|'''88.69'''
 +
|align="center"|
 +
|-
 +
|CC 1.9.9.99a
 +
|PEZ
 +
|GF
 +
|99.99
 +
|61.68
 +
|92.19
 +
|90.56
 +
|76.67
 +
|97.97
 +
|94.77
 +
|93.22
 +
|92.58
 +
|81.59
 +
|'''88.12'''
 +
|
 +
|-
 +
|Shadow 3.66
 +
|ABC
 +
|DC
 +
|99.85
 +
|72.26
 +
|96.16
 +
|85.04
 +
|74.01
 +
|95.50
 +
|90.77
 +
|90.56
 +
|89.67
 +
|86.67
 +
|'''88.05'''
 +
|
 +
|-
 +
|CC 1.9.9.96bd
 +
|PEZ
 +
|GF
 +
|99.89
 +
|57.06
 +
|94.07
 +
|89.71
 +
|78.28
 +
|96.65
 +
|93.71
 +
|92.46
 +
|92.92
 +
|80.86
 +
|'''87.56'''
 +
|
 +
|}
 +
 
  
 
Including some of the other scores again for easy comparison. Don't expect the small tweak I am about to implement to give much different results from the above because in that run the VG managed to not get stuck on the wrong gun too often.
 
Including some of the other scores again for easy comparison. Don't expect the small tweak I am about to implement to give much different results from the above because in that run the VG managed to not get stuck on the wrong gun too often.

Revision as of 16:10, 25 April 2009

OK. So I have two guns for CassiusClay. The two works better or worse against some bots and then about equal against many. Testing it I can see what gun should be used against what bot and when it doesn't matter much. But if I let my VirtualGuns array choose it doesn't seem to see the advantage. Even over quite long battles. I have tried just accumulating the stats and also different levels of RollingAverages. So far I keep my VG stats completely unsegmented. If I make one gun perform really bad things work in that the broken gun is never used. But when the differences are more subtle the VG array doesn't do what I want it to do. One problem I know is there is this:

  • Against WaveSurfing even if the VG array is selecting the better gun (gun A) then the unused gun (gun B) is not learnt by the opponent and so is secretly (virtually if you like) starting to perform better. Then when gun B is kicked in by the VG array it might be a sound thing to do. But then it seems the VG array sticks with gun B for quite a while.

I get wildly different performances against some bots over several battles.

What to do? Should I segment the VG stats? Should I accumulate stats or roll it? Should I do both and try weight the two together? Should I maybe accumulate stats and then totally wipe it every time I choose a new gun? It is almost physically painful to watch the CG array stick with the "wrong" gun over tens of rounds!

-- PEZ

Some more info for you. I get quite different results if I update the VG stats on every wave or if I do it only on "real" waves (waves carrying bullets). The latter seems to be better. This is maybe unsurprsing, but I want to know what you guys think of this anyway. =) -- PEZ

  • I think that is very unsurprising :-) The whole WaveSurfing / AntiSurferTargeting dilemma is completely dependent on the fact that WaveSurfers react to bullet fire! -- Voidious

And some results. This is my current dev gun's TargetingChallenge score over 500 rounds against the TargetingChallenge2K6 reference version of CC.

Guns used CC 1.9996bdTC
Classic Bee gun alone 58.40
Anti-surfer gun alone 72.12
Both guns (VG) 66.26

Maybe you can see why I want my VG act together? Yes, I still manage to improve against CC, but since the Classic Bee gun is the better choice against the vast majority or RR@H bots the trade-off in performance from the best gun to the VG isn't a very smart one.

-- PEZ

Just for your info: I only use "real" waves and only use the accumulated virtual results, although my feeling says that rolling averages would be better especially against adaptive movements like WaveSurfing. I also do some rudimentary segmentation on distance (4) and 'nearwall' (2), ignoring the segmentation if there is not enough accumulated data. I would expect a score of about 70 in your situation. Do you evaluate which gun to use for every bullet, or just at the beginning of a round. -- GrubbmGait

  • I think there's a big difference in "best implementation" for simple targeters and GuessFactor guns in a VG array. I think RollingAverages are probably much better for simple targeters, since you may want to change on the fly for different situations; but for GF guns, they are both very good on their own, so I think it should be a more long-term decision. -- Voidious

I definitely think it's worth exploring segmented VirtualGun stats, but I don't think it's completely necessary to make things work right. <deleted> And, dare I ask, are you sure that the VirtualBullet stats are being collected accurately? =) <deleted> But I did just wake up, and maybe I'm just stating the obvious here... (Edit: I deleted some stuff once I was more awake.) -- Voidious

Another thought is to try what Ascendant does - once you reach a decision on gun, use it for the whole match. That might alleviate some issues, and seems like it's worth a try, at least. -- Voidious

Grubb, at current I check what gun to use before I fire. Interesting that with Ascendant and how it sticks to its decision. But I would definately not dare do that before I see that my VG array can choose the right one for opponents where it should be quite obvious what gun to go with. I have verified my VF accuracy somewhat. As I said I can make one gun really bad and it will immediately be disregarded. What I do for Virtual stats is that I store with the wave what gf each gun guessed at. And then when the wave reaches the target I update each gun with "1 / Math.pow(Math.abs(guessedBin - thisBin) + 1, 2)". Should be pretty bullet proof? (Exuse the intended pun, couldn't resist). I have also tried only counting when the guess is dead-right. But I get the same VG behaviour whatever I use. -- PEZ

Just one more thought -- PEZ, have you actually tested the AntiSurfer gun in battle against mid-level opponents? Even if it gives lower TC scores, it might have little to no effect on actual scores in a battle, seeing as it is still probably a very good gun and your movement is superb. -- Voidious

I have only tried the "etxra" gun alone in the TargetingChallenge2K6/ResultsFastLearning. Where it gets a score of 84.72. That's 2 points lower than classic Bee. I'm pretty sure it's goind to mean I lose rating points in RR@H. The VG version gets 86.86 which, given the margin of error we have on 15 seasons, is the same as classic Bee alone. But since most of the gain in the TC is against CassiusClay, a bot I certainly don't face in the rumble, ... Well, I like to try make the VG array work closer to what I think should be possible before I field test it.

-- PEZ

I wouldn't / don't smooth my VG stats like you do. I record the GF that they fired at on the wave, like you do, and I increment all guns with a factor in the bot-width window when the wave hits. But you said you tried that to no effect... The only other thing I do in my VG that seems worth mentioning is I multiply a gun's rating by a "miss penalty" when it misses, currently .995. I know that seems weird and not very KISS, but it is just meant as a very very minor decay in my stats; if one gun does better for the first few rounds, but then the other is better, it lets it catch up quicker, but it still doesn't change too often.

Frankly, I might be able to offer more insight either by looking at your code, or getting a more detailed description of the differences between the guns. I think the design of a VirtualGuns system is quite dependent on the qualities of each gun. Feel free to drop me an e-mail if you want me to take a look. -- Voidious

I did my best to cleanly edit some stuff out and move it to the AntiSurferTargeting page. Hopefully everything still flows pretty well on both pages. -- Voidious

Now I have added a "stabilizor" to my VG array. It's quite simple. I just measure the "real" performance of the guns when they are in operation and then multiplies the virtual and real ratings. The theory is that even if the secondary guns hollers high about how high virtual hit rate it has the selector can still just tell it "well done little gun, but look at your real performance when you've been given the chance". To give each gun some little benefit of the doubt I use the first 8 rounds to alter the guns so that both are used for a full 4 rounds before the auto-selection starts. With this solution I run a real risk at stubbornly holding on to the wrong gun just because the right gun had had some bad luck in the start. But over 500 rounds it seems I might recover. Check the following TC2K6 results table:

Name Author Gun Bfl CC Chk Cig Cya DM FM Grb RMB Tig Score Comment
CC2 VG /w "stabilizor" PEZ GF 99.80 67.91 92.44 88.51 78.11 95.98 94.12 93.02 92.78 87.66 89.03
CC2 VG PEZ GF 99.98 64.98 93.31 87.64 77.95 96.37 93.24 92.49 93.59 87.33 88.69
CC 1.9.9.99a PEZ GF 99.99 61.68 92.19 90.56 76.67 97.97 94.77 93.22 92.58 81.59 88.12
Shadow 3.66 ABC DC 99.85 72.26 96.16 85.04 74.01 95.50 90.77 90.56 89.67 86.67 88.05
CC 1.9.9.96bd PEZ GF 99.89 57.06 94.07 89.71 78.28 96.65 93.71 92.46 92.92 80.86 87.56
Dookious 0.611 Voidious GF 99.32 67.71 88.19 78.96 78.6 92.08 89.48 85.89 87.25 84.27 85.18
Max 0.8.9 Pulsar GF 98.51 67.34 76.92 87.38 71.43 94.97 88.18 90.97 89.52 76.75 84.20
Raiko 0.43 Jamougha GF 99.93 59.41 78.14 84.64 68 94.92 89.47 91.01 90.76 74.98 83.13


You can see that the stabilizor version choosed the wrong gun against Butterfly. I guess maybe it is a bit difficult to see the difference between two almost perfect hitrates. It also seems the right gun (classic Bee) was used against Cyanide and I still trash a bit between the guns against CC. Also, I removed the anti-surfer segmentation of my regular Bee gun which I think I will re-install since that thing seemed to give me Cigaret's number.

Here's hoping!

-- PEZ

Wow, nice work. I'll have to jot that down in my list of things to explore when I do some more work on Dookious. Hopefully you'll be comin' for Ascendant's head-piece with this new gun =) -- Voidious

My secondary gun makes CC win against Ascendant. But then making the VG realized that is a different matter. On the other hand I can always check for Ascendant and choose manually. My stabilizor is a bit dangerous actually. My tests shows that getting stuck on the wrong gun is something that happens a bit too often. -- PEZ

I now have an idea how to make the stabilizor a bit less dangerous. But here are the latest results before I implement that:

Name Author Gun Bfl CC Chk Cig Cya DM FM Grb RMB Tig Score Comment
CC2 VG /w "stabilizor" .b PEZ GF 100.00 72.39 92.53 90.25 77.35 96.67 91.76 92.07 91.81 90.31 89.51
CC2 VG /w "stabilizor" PEZ GF 99.80 67.91 92.44 88.51 78.11 95.98 94.12 93.02 92.78 87.66 89.03
CC2 VG PEZ GF 99.98 64.98 93.31 87.64 77.95 96.37 93.24 92.49 93.59 87.33 88.69
CC 1.9.9.99a PEZ GF 99.99 61.68 92.19 90.56 76.67 97.97 94.77 93.22 92.58 81.59 88.12
Shadow 3.66 ABC DC 99.85 72.26 96.16 85.04 74.01 95.50 90.77 90.56 89.67 86.67 88.05
CC 1.9.9.96bd PEZ GF 99.89 57.06 94.07 89.71 78.28 96.65 93.71 92.46 92.92 80.86 87.56


Including some of the other scores again for easy comparison. Don't expect the small tweak I am about to implement to give much different results from the above because in that run the VG managed to not get stuck on the wrong gun too often.

-- PEZ

My VirtualGuns don't deliver in short battles it seems. (Refering to CC 2alpha's rating points being a tad lower than the old version without VGs). That was what I expected, but it's a dissapointment anyway. Now since they do deliver over long battles I am probably going to save the VG stats between battles. But I must also work on the VG array and try figure out how to choose the right gun faster. Maybe if I make the guns more different? As it is now they use the exact same segmentation, just different rolling depths. (Classic Bee hardly rolls the data at all, while the companion gun just replaces the the data in the bins as it arrives, thus rolling extremely fast if you like.) But if I reduce the segmentation of the fast-rolling gun it might work even better against some surfers and even worse against the vast majority of bots. It's a gamble on how much I lose on using the wrong gun for too long and how much I gain on using the right gun. And the gamble is extra risky since one of the guns collect like 98% of the rating points... Any ideas anyone? -- PEZ

Try to keep getRoundNum() and getNumRounds() in mind when selecting your gun. If it's a short battle, or when you are fighting your earlier rounds, you may want your bot to be a bit more biased towards selecting your fast learning guns, for example. -- Dummy

I do that to some extent. I use the first 8 rounds to give both guns a chance at proving what they can do. There is actually no difference in learning speed of the two guns yet. The difference is in how fast they forget. But, yes, it would reduce the risk if I used the best all-purpose gun for a while when I have little idea on which gun should be the best against the particular opponent. I'll think about that hard now. -- PEZ

One thing is wondering me. I assume you are taking botwidth into account so every virtualhit really is recognized as a full virtual hit. So why should you reward a near miss. If you miss the opponent with one pixel or with half the battlefield, it is still a miss. For a VG array the (virtual) hitrate is the only thing that counts, not if the guns can always shoot approximately in the right direction. -- GrubbmGait

I don't take the botwidth into account. And, if anything, near-misses are penalized rather than rewarded with my solution. The virtual and real rating of a gun are very similar once the gun has been used a while. Which should indicate the rating system as such works. And check the 500-round TC results above and you see that it does work. We're talking 1.5 TC points! I don't take botwidth into account in my targeting in general either. I've settled for "shooting in approximately the right direction" and it seems to work. When I have tried taking botwidth into account it has never made a difference. And you know what this dude does with things that don't make a difference? Right! I delete them. That said, I haven't tried taking botwidth into account in the VG rating, and I might try that and see if it makes a difference. -- PEZ

It's worth mentioning that PEZ does smooth VERY steeply (if it's the same smoothing I've seen in CC), so it's not prone to the problem you mentioned very much, Grubb. He uses like ((thisIndex - rightIndex) + 1)^2. That's divisions by 4, 9, 16 on closest bins... -- Voidious

Yes, and I use 47 bins. Which means the botwidth is often covered by 2-4 bins. Then it makes sense rewarding the immediately surrounding bins some, doesn't it? If anything the smoothing is too steep. But I think (keyword being think) that the virtual rating of the guns are quite OK. It's making a safe descision from those ratings that's the problem. Even after 35 rounds a gun could have been insanely lucky and have a much too high rating. (Or insanely unlucky, and everything in between). But seeing as I speak about "gambling" above. Maybe I can use some risk/reward thingy in the selection? Any comments on that? Any ideas on what to take into account? (One gun being the known better gun over all and such...) -- PEZ

The first thing that comes to mind is taking hit-percentage into account. (I guess a high-ish hit percentage would favor classic Bee.) Another thought I just had is you could keep track of VG ratings on a per-round basis, and compare the median scores; that would discount "insanely lucky" and "insanely unlucky" rounds for each gun. -- Voidious

@PEZ: No, it does not make sense. For a VG array it only makes sense to reward the gun(s) that would have hit. You have two GF-guns that are very good at shooting in the right direction. Which one to choose? The one that would really have hit that 36x36 square most frequently. A dead-on hit is the same as a near-miss, and a near-hit is just a miss. (Further above I used near-miss where I ment near-hit, sorry) -- GrubbmGait

Hit a moving 36x36 square that is. Wich makes it something like a 36x41 rectangle for an orbiting opponent moving in full speed. And, again, the way I do it now is choosing the one that hits a 10 pixel wide bot most often. Or maybe like 15 pixel wide, taking the smoothing into account. In my book that's still the most accurate one. -- PEZ

I agree with your logic, Grubb, and I use bot-width like that in my VirtualGuns setup. But I still wouldn't be surprised if they amount to rougly the same in practice. -- Voidious

(Edit conflict)Ofcourse you want your guns to be accurate (and they are), but you don't want to choose the most accurate gun, you want the gun that hits the most, because that is important in scoring points. A lot of times the most accurate will also be the most hitting, but that is no necessity. -- GrubbmGait

I think I want to choose the one with the highest chance at hitting. Which seems to be the most accurate one. Until I have figured out when most accurate and most hitting differs I think it'll be pretty hard to convince me otherwise. People tried to convince me to use botwidth in my visitcount updates, but failed too. Well, then I actually tried it, many times. But it never made a difference. And I will probably try it in the VG array too. But as I've said, I think I have bigger problems than that and I like to solve problems in decreasing size order. Botwidth is on the to-try list. Has been since V first mentioned it far up on this page. =) -- PEZ

I think I am making progress. Grubb, just so you know I am now using botwidth and reward clean hits only. It doesn't seem to make a difference in the rating of the guns, but since it doesn't make things worse I have decided to take your strong oppinion as a clue and keep it. See? I do listen, even if I am a bit stubborn. Anyway. This is a short summary of how my VG is set up:

Hmmm, I'll recap why the VG even exists. I have:

  • Two guns using the same segmentation
    • Gun A is accumulating stats (best gun against 95+% of all bots)
    • Gun B only considers the last observation (best gun against some WaveSurfers)
    • Both guns are pretty good, but Gun B is noticably worse against most bots. (Naturally since it can't learn to smooth away fluke sitautions.)

And here's how the VG works:

  • Each gun collects success rates on:
    • all waves (CC fires waves every tick) - I call these "virtual waves"
    • waves following along real bullets - "real waves"
    • real hits as reported by onBulletHit()
    • These are accumulating stats, rolling only very little
  • Selecting the best gun before each round:
    • First check the virtual waves virtual rating (vvRating). If it differs enough between the two guns the selection is done on this criteria.
    • Then check the real waves virtual rating (vRating). If diff is big enough, select.
    • Then check the real hit rating (rRating). Give a gun the benefit of a doubt if it hasn't been used much yet.
    • In both the virtual rating checks the diff required increases with the number of rounds an opponent has been battled.

OK. So why this?

  1. Recall that Gun B shouldn't be used unless we're up against one of the few surfers where it is the better gun. It happens that against the vast majority of bots the stats collected on the virtual waves are just as good as the real waves. This increases the speed of learning and makes for a quicker selection of the right gun against most bots.
  2. Against some surfers though the virtual waves stats are down right lying. But it seems it never lies as hard and thus setting a threshold on when the vvRating is allowed to decided seems to help from getting tricked.
  3. Against some surfers the vRating (virtual stats on real waves) lies too! But only after the "right" gun has been selected a while. And again a threshold helps, especially a threshold that increases with the battle length.
  4. Real hit stats help sticking to the right gun even when lied to by the virtual stats.

Does it work? My tests seem to indicate that. But it's not extensive tests. I was to eager to get this thing out and tested in the rumble. Tomorrow we'll know better.

-- PEZ

Yes, learning speed. Against simpler movement, Gun A is selected very quickly (or so it seems in my few tests). Against most WaveSurfing bots Gun A or Gun B (as appropriate) is selected and stabilized around after 50 rounds or so. And used most frequently before that too. Anyway, this has made me make CC save the VG data on files. So for those instances when the same RR@H client runs the same opponent more than once CC will remember where it was on its learning curve. And since I have tested quite a lot against Ascendant CC comes preloaded with some of those test rounds. =) -- PEZ

So beating Ascendant at 53% over 2 matches in 2alpha just wasn't enough for you, eh? :) Anyway, about your VG stuff... At first, it seemed a little complicated, especially coming from you. But it's actually pretty simple after re-reading it, and sounds quite well thought out. My only comment is that I am somewhat surprised you collect "virtual wave" stats in a gun that has a rolling depth of zero; if it is the better gun against surfers/adaptive movements, I would think that replacing real wave data with virtual wave data would be a mistake. Then again, you are the on atop the TC 99% of the time, so... =) Edit: I mean the GF data, not the VG data. -- Voidious

I haven't given that a thought. Thanks! Actually if I can get some confirmation (from the RR@H) that this VG set-up works. Then I will move on to seeing how I can tune Gun B to work even better against surfers. But only when the VG works, since making it better at that probably will make it worse in general. As it is now the segmentation is tuned to virtual waves learning. And I will have to reduce it to make it work with real waves only. -- PEZ

Ohh, thats more or less the VG setup for PM 0.9 which has been held up by some movement bugs for the last months! Though I've never put into to such a nice wording. I divide it up into virtual "visits" & virtual "real" and visits & real stats which I select from virtual first, and even only using that single virtual stat seems to work well. Seems you've already managed more testing than me too! From what I can see the rolling stats are usualy picked up first for most bots (learns faster) but soon switches over to the other if it is more appropiate. Not fail-safe and not tested extensively yet. -- Pulsar

Along with that ALL those scores are actual hits if we had actually fired exactly as the gun requested, that rarely happens due to gun turn not keeping up it seems, but I guess some prediction will help there. -- Pulsar

I reworded the description some, hope it doesn't look as complicated now. It really isn't complicated. Check the source code (included with CassiusClay) and you'll see. Though I would welcome a suggestion on how to make the code clearer. Right now it is just jotted down as I have thought it up.

You use both rolling and non-rolling stats Pulsar? I guess I could try that too if you could explain the rationale behind it. My solution to getting the situation where the virtual bullets go exactly where the real bullets go is to predict both mine and the opponents locations next tick and never fire unless the gun is aligned. And then I only mark the wave as "real" if I really fire.

As it seems (judging from the RR@H rating) this VG set-up works just as bad (or good) as the first 2alpha version did. Which surprises me a bit, but I think if I left this version in for a while it would start benefitting from saving VG data between battles and its rating should climb some. And it's PremierLeague ranking should climb too. Some of the current losses is just bad luck. I guess 5 losses is to expect if each pairing gets something like 3 tries. I will stick to this new set-up a while. I will tune it, but the general outline is sensible I think. What I might do is analyze the saved data from the pairings run by my RR@H client and see where the "wrong" gun is choosen and see if I can figure out what thresholds to use to make the selection more accurate. Then again I might throw a third gun into the soup and then all tunings probably will be different...

-- PEZ

I've tried making Gun B only learn from real waves now. Tried it and tried to tweak it, but I can't get it to perform on par with the old version which learnt from all waves. I guess it's important to learn really quickly. Then again everything in my gunning might be adapted to all-waves learning and that could be why I can't get the experiment to work. My virtual guns aren't really full guns. I call them Guessors and they are just the strategic parts (like what to segment on, how fast to roll and such) of the data gathering. Everything else is sharing good 'ol Bee structures. -- PEZ

Hey PEZ, Nice to see at least one old timer is in the hunt still. A segment that once struck me as having potential against waver surfers is an extension of one of your segments. Since WaveSurfing is reacting to incoming fire, have you ever tried segmenting on ether a ratio of time since fired and time since last reverse or maybe a ratio of (time since last shot - time since last reverse) / distance? I am not sure what effect that might have but as I recall one of your more telling segments was your reverse timer. Maybe adding in a ticks since reversed segment will help some? Just a though- --jim

I can try that. Right now I am back at square one though. My TC35 score with this gun isn't exactly spectacular. I get scores between 53 and 75 against CC. Yeah, 35 rounds makes for a bit of uncertainty, but 22 points is just ridiculous. I'll have to rething the whole VG. Gah!!! -- PEZ

Perhaps segmenting your VG stats on only distance would be helpful? My own guns pale in comparison to Bee, but I have noticed that some light segmentation has helped my VG array a bit. --wcsv

The siren call of VGs: multiple guns will allow me to pick the right gun to use against a certain bot. The reality of VGs: your result will improve against some bots, but will generally decrease against most bots. Your array can never be better than your best gun unless you devise a way to be absolutely perfect in gun selection. I tried this a lot. The only virtual gun that I think has merit is one where you use Linear targeting against a close in enemy where you determine that even should he reverse at that point, they can not dodge the shot. After that, I think you would need to find a way to either hard code the gun to use or a way to characterise what movement style your guns are good against and a way to characterize your enemies movement so you can apply the correct gun. I suspect that Ascendant is so good because his movement is so much better than most that the guns are secondary to his success. -- jim

Well, my TargetingChallenge2K6/Results tell a different story. VGs improved it by 1.5 points! And it kinda seems like Ascendant's VirtualGuns array works too. =) -- PEZ

You and I know the proof of the pudding is in the Rumble. =^> Best of luck though, I would like to see this work. -- jim

Ummm, yeah. It works. Just that 35-rounds is a bit short. But in anycase the old saying that a VG can never be better than your best gun simply isn't true. It's like saying that it is best to guess the right number in Lotto. Of course it is, but what is the right number. Simply the fact that now my VG scores as high in RR@H as my best gun does proves that VGs can work. Ascendant proves it too. The rumble only measure short match performance so I am not sure I agree it is the proof of the pudding. -- PEZ

Hi PEZ, nice to see you discovering the power of VirtualGuns :-). But concerning your current release (CC 2delta): Are you sure that your array is working correctly? I understood that this anti-surfer-gun of yours is toasting Ascendant (like mine does :-), and makes CC win vs him. But in the rumble CC clearly lost that fight (getting 43.9% in 8 battles, so its probably not a fluke). The efficiency of your guns vs A differs notably, and the more the guns hit ratios differ, the better the array should work, shouldnt it? Considering also that CC is back at its old score it looks to me as if it were using the old Bee exclusively again.

Lol, i feel like having betrayed Ascendant now ;-) --mue

CC tells what gun it uses in the log file. Running it agains Ascendant it sometimes locks in on the wrong version, but most often not. What the 2delta version does is to use the old gun for the first 12 rounds. Running twice against the same opponent on the same machine it should use the saved VG data the second time. But if that happens to be one of those where it locked in on the wrong gun... My VG implementation certainly doesn't work yet. But now, at least, in my dev version I have gotten it to beat old Bee in the 35 round version of TargetingChallenge2K6. Which means I am doing something a bit better than I did in 2delta. I haven't gotten rid of the volatile properties, far from it. The scores vary like crazy against most bots.

Good to see you back and throwing us some crumbs again mue.

-- PEZ

Two more things. First thing first: You are absolutely right about CC using the wrong gun against A. Well, without saved data it finds the right gun when the first 12 rounds. But then when reading the saved data it locks in on thw wrong one. This is because CC has a built in reluctance against switching guns unless it is really evident that it is the right thing to do. But I always save the array in the default order so then when reading it CC is reluctant about that default order instead of the order figured out woth blood and sweat in the first round... Don't know if that makes sense, but anyway, I think I know how to protect against this. I didn't see it in my testing because I mostly tested the T version and it doesn't save or read data...

Second. CC doesn't toast A. It wins, but not with a really comfy margin (if it chooses the right gun that is).

-- PEZ

To be honest, im not sure i understood completely what you wrote. You mean there is a bug when reading the saved data that makes CC still using the normal Bee instead of the anti surf gun, the saved data is favouring? Anyway, i think i will start experimenting with movement a bit again. This annoying weakness vs fast learning guess factor guns just makes it to easy to beat Ascendant. And of course i hope that there can be gained some points vs Shadow along the way. --mue

Yes, that's what the end result is. CC keeps the guns sorted in order of their "effiency". But to prevent trashing between two guns it doesn't switch until the secondary gun has significantly better stats. But when saving I sort the guns in a known order so that it should be easy to read it back again. Then that "known" order is kept with the same stubborness that is meant to prevent trashing. Good luck in your Shadow hunt. We should rename it Moby Dick. =) -- PEZ

  • Ah ok, now i see the problem. And i dont know about hunting Shadow, i'm pretty sure that A's movement is the problem. So its more about escaping Shadow right now ;-) --mue

And I wouldn't call CC's second gun strategy for fast learning. It's rather fast adapting. Or quick to forget if you like. The segmentation depth is shared between the two guns. -- PEZ

mue, since you betrayed Ascendant there some I can betray CC some. =) Even if this might not be news to you. Anyway, CC seems to balance survival and bullet damage a bit better than A does when they to are pitted against each other. Even with my anti-Ascendant gun A almost always gets higher bullet damage. But CC wins the match because of it's survival ratio being higher enough. AFAIK both fire with the same bullet power so I don't understand why this happens. Maybe it's the EndingGame strategies? -- PEZ

Hm, interesting thought. Now of course i cannot help but wonder what your EndingGame strategy is :-). Ascendant just uses low power bullets if its energy is very low, and it will never disable itself by firing. So maybe i should start earlier to use low power bullets? Or is there some other special trick thats helping CC to turn the tables? --mue

CC's ending game strategy is in plain view inside Bee.java. It's exactly what you describe you are doing in Ascendant, but maybe we use different starting points for it. Are you using power 3 bullets at some ranges? Then that could be it. I fire power 3 at distances below 130. -- PEZ

  • Ascendant fires power 3 bullets at distances below 120, so almost exactly the same behaviour here. I guess its really the low power bullet handling, thats making the difference here. Adding this to my to try list now... --mue

mue, I don't know if you found what I wrote on Shadow's page. But the thing is that sometimes A locks in on the wrong gun against CC. When that happens we get results like this:

1st: pez.rumble.CassiusClay 2delta	9028	3250	650	4477	651	0	0	65	35
2nd: mue.Ascendant 1.2.5        	6567	1750	350	4069	397	0	0	35	65

I can see it happen in CC's log window because then A never climbs above 4.1 hits / round on CC. When A choses the right gun this is above 4.5. This is prolly not a big deal for you, since A seldom does this mistake. But anyway.

And anyone testing their bots progress by running it against Ascendant should be aware of this of course.

-- PEZ

Thank you for telling me. Though this time i was already aware that the gun-selection is not working perfectly. I've seen it happen vs CC too. This is one of the reasons i'm not yet saving gun-choices to file. Because without some sophisticated re-evaluation mechanism a single wrong decision could seriously hamper the performance vs some bots. At the start of each battle Ascendant is biased towards the general purpose gun. So its much more likely that the normal gun is used when the other should have been chosen, than the other way round. Thats why i think this problem has only minor effects on rumble results. Its single long battles that are affected the most.

Anyway, when i'm done with movement tuning (read: when i've run out of ideas without having achieved anything :-), i'll revisit and maybe refine the virtual gun array. After all i want Ascendant to be strong in long battles too. --mue

Can you share some about how your VG works? It's obviously more reliable than mine. I don't have that problem with using saved data though, because I continuosly reevaluate which gun to use. Remembering it between rounds or battles is the same from that respect. Making your array work as well over long battles as it does over short should be as easy as deferring the lock-in on a certain gun depending on the battle length maybe? -- PEZ

Well, the amount of data Ascendant needs to decide which gun to use is already dependant on battle length. But maybe this part needs some tuning. Actually im just looking at my code and wonder myself how it was supposed to work :-). Either i just found a bug, or im missing something. Maybe i should do some debugging and then build a release, to make sure that the code im looking at is really the one thats active in the rumble. When i think about it, i just might have made some changes before taking a break from robocode, that didnt find their way into a release. The problem is, i dont remember what exactly i changed, so i can only hope that i didnt break anything...

Thats why i can only tell you what i remember of how i wanted the gun array to work: It should keep track of the guns hit ratios (rolling averages). The hit ratios are initialized to favour the general purpose gun. Make this gun the active gun and use it, until the hit ratio of another gun is about 1% better than the ratio of the active gun. Make the better gun the active gun. Repeat. Always use the active gun until the final decision has been made.

The final decision about the guns is based on a guns rating (an integer value measuring gun performance). At the start of the battle each gun starts with rating 0. After a certain amount of bullets has been fired (currently 300) check whether there is a gun, whose hit ratio is 1% above the rest. If there is, increase its rating by one. Wait for a fixed number of bullets to be fired and check hit ratios again (and increase a rating if required). Repeat, until there is a gun whose rating exceeds all other ratings by a treshold. This gun will then be used for the rest of the battle. The treshold is dependant on the number of rounds in the current battle and should maybe be bigger than it is now for longer battles.

Ah well, sounds probably more complicated than it really is... Looking at the code and thinking about it, i already begin to develop ideas about improvements. Will be tough to keep my resolve and stick to movement changes :-) --mue

Thanks! Sounds great and obviously works. I'll try that myself. The path I took with 2gamma really felt quite awful and I hope it won't prove it works. =) Well, it obviously doesn't. -- PEZ

So, jim, what would you say about CassiusClay 2gamma? To me it proves VirtualGuns work. It retains the rating of the single-gun CC, but with VGs it climbs up to 2nd place in the RoboRumble/PremierLeague. It goes from 9 or so losses to 2(!). And the last two losses is nothing any of my guns can do something about. CC 2epsilon will probably not work as well since I've changed the VG rating system again (to work like Ascendant's). I think it'll take a few releases before I get that to work... -- PEZ

Next version of CC (2epsilon) will have a VG handling similar to what mue described about Ascendant. My tests indicate that it works as well as 2gamma. 2gamma is a dead-end though. It is an if/elseif/else structure which encapsulates what I think I know about the two guns. It would explode to something really huuge should I add a third or (horrors) a forth gun. And it would stop working if I changed the characteristics of any of the two current guns too. Here's 2epsilon VG logic:

  1. Always use the gun with the best selection-rating
  2. Rolling update of virtual hit rate for each gun for every "real" wave fired
  3. Every Xth round
    1. check if the gun with the highest virtually hit rate is Y% better than the runner up.
    2. If so increment the gun's selection-rating.

And my general purpose gun (Gun A) is initialized with a virtual rating slightly higher than the anti-surfer gun (Gun B). I also stop updating the selection-rating after a set number of rounds (currently 100). Since I save the VG stats this rounds-count is peristent between battles.

-- PEZ

I really like you doing all this VirtualGuns research. It made me realize just how important it is to choose the right gun, and it is nice to see all your ideas here. (Well, it made me test for it, which made me realize it.) I will likely end up directly ripping off some of your methods to try in Dookious sometime soon. In version 0.76, I did something very simple, kinda ugly, but effective: RollingAverage ratings on only firing bullets, but multiply the AntiSurfer gun rating times 0.85 when I check them, so that it has to be 17% better (1.0 / 0.85) to be chosen. Surprisingly, it seems to work well enough. -- Voidious

If you read way up in the start of this page you'll find that one of my problems was/is that once Gun B is selected Gun A's virtual stats starts to catch up and sometimes even pass Gun B's. Is your approach to make a final switch to your anti-surfer gun once it is 17% better or do you ever re-evaluate? I also think that: your anti-surfer gun > my anti-surfer gun. -- PEZ

No, I continually re-evaluate, and I just cripple the rating of the AntiSurfer gun by 17%. It's not my ideal solution, but I just want to be very biased towards the general-purpose gun for now. Most of my recent gun work has been on the general gun with the AntiSurfer gun turned off... Once that gun's good enough, I'll worry about the AntiSurfer gun and VirtualGuns stuff. Right now, the AntiSurfer gun has the same segments, rolling depth of 2, and no virtual waves. Still, the AntiSurfer gun still seems to be chosen quite consistently against surfers. -- Voidious

This is directed to mue I guess, but anyone choosing to follow Ascendant's VG selection approach is welcome to listen. =) I'm still have the problem that the general purpose gun is sometimes selected against surfers. I experimented some with it and it seems that if I initialize Gun A's virtual rating high enough above Gun B's then Gun B isn't selected by mistake very easily. But that of course increases the problem with Gun A getting selected by mistake. What I am testing now is to accentuate the Gun A preference a bit more but then for those iterations when Gun B is better I increase its selection-rating more than I would with Gun A. Currently I increment with 1 for Gun A and 1.5 for Gun B and it seems that it is working. I also test for this increment a bit more often than I did in 2epsilon. And I roll a bit slower too. This might be worth testing with Ascendant too since it obviously selects the wrong gun against CC now and then. -- PEZ

I've thought some about the gun ratings Ascendant uses for its final gun selection, since i described it above. Right now i think it a weakness to only look at the hit ratios at some defined points in time. Evaluating them continuously looks much better to me, because there is less risk of taking the wrong moment, when the hit ratios do not represent the overall situation very well. So this will be the next thing i'll try with virtual guns. Of course your right that the ratings for different guns do not need to be treated equally. Maybe i need to experiment with that too. But i definitely need to deal with movement first, since i'm sure that this is the main problem when up against Shadow or CassiusClay. --mue

I started out that way and it seemed to make the array more volatile. I think it might be because a gun could be on a lucky streak and if you continously reward it then it is hard for the other gun to catch up when things normalize unless it too finds a lucky streak. Only checking stats now and then gives these streaks less room I think. I have to admit this all confuses me quite much, but my tests seem to support it. Please share the results from your tests too, once you find your way back to gunning. -- PEZ

I also think it makes sense to consider different rating methods for each gun. (Although not the way I currently do it, which is just a hack.) I get the feeling that a gun with very low rolling depth is just inherently erratic - a few unique waves go by that aren't segmented perfectly, and you might be thrown off for a while. Or if you just aren't segmenting in an optimal way for your opponent, you never get enough data to smooth out the inconsistencies. A gun with high rolling depth adjusts for these situations on its own by producing averages over so many waves. Just my 2 cents, you guys are still a few notches above me in gunnery, of course. -- Voidious