Robo Home | EnemyWave | Changes | Preferences | AllPages

[okay, I can't get these damn graphs to line up properly. They look right in the page edit window; can someone fix them up so they look right on the page for me?] (Sorry, I don't understand why they don't come out right -- PEZ) (Nope, i can't get them to work... -- Tango) (I could - a part of the wiki syntax we don't really use on the wiki is that a \ is a continuation of a line, so since a lot of lines ended with a \, it was treating them as if they were just signifying you wanted to stay on the same line. And the nowiki tag didn't fix it, either. So I gave them pretty borders :-) Feel free to re-align other things if I did it wrong. -- Kawigi

This concept is something I was planning to put in Fractal, which is why I built its original wave and guess factor infrastructure to plot both its own curve and the enemy's. However, I never really got around to writing movement code to handle it. I have quite a few ideas on the drawing board about how to build this, but since I've currently scrapped most of its gunning system I can't really start on a movement algorithm to build this. Here's one of the ways to avoid peaks that I had in mind. Suppose you've been recording the following hits from the enemy (in other words, this is the curve of the enemy's gunning):

```  +-----------------------+
|          /|           |
|      ___/ |     |\    |
|    _/      \    / \   |
|___/         \__/   \__|
+-----------------------+
|           |           |
-50          0          50
```
You can see an obvious spike at 0, and another at about 30. The idea is to come up with an algorithm to avoid these peaks. First, let's investigate how you will move relative to these peaks. Suppose you have been moving in a constant straight line since the enemy's nearest bullet was fired, and the enemy has been firing bullets consistently since then. Suppose you then reverse direction, and start going the opposite way at full velocity. You can iterate forward until the last fired wave hits you, and plot each wave hit as a point on your graph: (this example shows the enemy firing the same power bullets, but it would work with any power; the lines simply would not be equally spaced).
```  3rd wave 2nd wave 1st wave
|        |       |
+-----------------------+
|          /|           |
|      ___/ |     |\    |
|    _/      \    / \   |
|___/         \__/   \__|
+-----------------------+
|           |           |
-50          0          50
```
This way you can see where the distribution of the next few waves will be. You can see from here that you are not in a very good position; the next 2 waves that pass, you are at the most likely position of being hit. This is where you should modify your movement to avoid these peaks. There are a few solutions I was thinking of. The first is to 'offset' the waves: when you go to reverse direction, simply sit stationary for a few ticks before continuing backwards. This will offset the positions on the graph where the wavefronts will hit you:
```    3rd wave 2nd wave 1st wave
|       |       |
+-----------------------+
|          /|           |
|      ___/ |     |\    |
|    _/      \    / \   |
|___/         \__/   \__|
+-----------------------+
|           |           |
-50          0          50
```
We can see that this is a much more favorable situation; through a simple offset, the enemy's bullets now have the least possible chance of hitting you.

Another tactic is 'scaling' the waves: upon reversing direction, reduce your maximum velocity. This will move the distribution of the waves closer together. This is a good tactic to avoid large negative humps; such is the case with our graph.

```              3rd 2nd 1st
|   |   |
+-----------------------+
|          /|           |
|      ___/ |     |\    |
|    _/      \    / \   |
|___/         \__/   \__|
+-----------------------+
|           |           |
-50          0          50
```
Here we see that by scaling our waves, we have avoided the large negative hump where the enemy is shooting. After the 3rd wave we can reverse direction again and repeat the process; however the waves will not always start at 50 as in this case; you have to plot each wave individually and look at where you were when the wave started. It becomes more complicated when you look further ahead than the waves that are already in play; note however that you don't have the actual velocity of waves past what's on the screen, so for further movement avoidance you have to use the average bullet power of the enemy. These waves are less reliable; you should weight the values of the graph at each wave's position as a function of their order, nearest to you being most weighted.

Anyway, that's my 3 cents on enemy wave avoidance; I've never actually implemented this, so I have no clue if it would work, and I'm still skeptical of it. Keep in mind that graph decay for this kind of graph will be far more important than decay in GuessFactor graphs, because the enemy's gun is constantly adapting to your movement; this is the part that I'm worried about. You only get data to plot when you get hit, so I don't think that your graph will be able to keep up with the enemy's adaptive gun. This is part of the reason I'm not working on this now; my new gunning system looks far more promising than this, which is why I'm working on my gun first. I'll explain my gun sometime when it gets working :D.

-- Vuen

Wow, this is great stuff! So simple and so obvious, yet I wouldn't probably have thougth about it in this way in a thousand years. It just have to work. But I agree that since you are learning slower than your enemy that could be where things crack. What would happen if you combine this with Kawigi's system of plotting his own curve on each wave and just weighting hits higher? -- PEZ

It might balance out, when you aren't getting enough hits to build a good graph, your movement is poor, and you get hit more, so you get a better graph, so avoid better, and then get hit less, so you graph becomes poor, so you get hit more, and so on.... -- Tango

Yeah, that makes sense. If I can just get the bugs out of the infrastructure described on the EnemyWave page I will set out to test this idea. -- PEZ

One more thing, depending on your browser the graphs mihght be readable if you look at the source. Otherwise I suggest you copy the source and paste it into your fav text editor (which should be VIM if you are any intelligent =). -- PEZ

Feel free to look at the graphs on the page now :-) -- Kawigi

Vuen - excellent report - Since DT 2.21 I have also looked at this (I was not impressed with DT's lumpy gragh in Fractal) However in trying to implement this I came across a couple of issues - By stopping or slowing down even for a moment your potential max/min gun angle is reduced and you are sending 'signals' to an opponent as to what you are doing in the near future also, there is a difficulty with combining this 'dodging' movement with avoiding walls, corners etc. I think these methods should work against simple guns, but segmented guns can gain extra information from the movement and actually improve targeting. -- Paul Evans

Thanks Kawigi! This is certainly true; this is another reason I wasn't too motivated to keep working on this at the time. However it could end up turning out good against these segmented guns, because you could also segment your 'getting hit' graph the same way. This may seem extremely complicated, but when I build Fractal's AutomatedSegmentation gun it should turn out quite simple. I haven't found time to work on it because midterms are starting up again; I'll see how much sleep I can safely trade for Robocode and still make it to class :). However I'm not too worried about the patternable predictability of your behaviour, because you can certainly mix up these concepts and vary the scaling throughout your stride. Say you sit still for a few ticks to offset the first wave, go slowly to get the second wave over the 30 peak, then speed up while the 2nd wave is hitting you to space out the 3rd one. You would end up with:

```         3rd      2nd  1st
|        |    |
+-----------------------+
|          /|           |
|      ___/ |     |\    |
|    _/      \    / \   |
|___/         \__/   \__|
+-----------------------+
|           |           |
-50          0          50
```

You could also just decide to switch direction about half way between the 2nd and 3rd wave, to keep your movement entirely in the positive:

```                 2 3    1
| |    |
+-----------------------+
|          /|           |
|      ___/ |     |\    |
|    _/      \    / \   |
|___/         \__/   \__|
+-----------------------+
|           |           |
-50          0          50
```

You can keep your movement positive until the enemy adapts to it. Another bonus in this is that most segmented guns don't use data decay. Once you adapt to their gun, they have to wait until your new movement outweighs the old data.

-- Vuen

...where "most segmented guns" mean mine, right? -- Kawigi

I found this while browsing the random page link, amazing how much it resembles WaveSurfing! Vuen just never found a practical way of putting it to use, and everybody else (me included) dismissed it as a predictable dodging tactic. Times change... :) -- ABC

Well, maybe it will again some day look like a predictable dodging tactic, like stop-and-go movement would have been in the beginning. -- Kawigi

It probably will, it's just another layer of complexity. Like Paul once said, every published method of targeting can be countered, and so can a movement strategy. -- ABC

I think what Paul once said was that every published targeting method can be outtweaked. Maybe he said both. =) -- PEZ

Robo Home | EnemyWave | Changes | Preferences | AllPages