# Precise MEA

Revision as of 9 February 2012 at 19:13.
The highlighted comment was created in this revision.

## Precise MEA

Ok, so while I await the results from the latest release to see if my new strategy works, I wanted to know two things: 1) What do the experts think about imprecise MEA causing randomness in targeting?

2) Does anyone have an efficient, accurate method for calculating MEA?

AW01:23, 9 February 2012

The worst thing I see with imprecise MEA is shooting walls.

MN14:31, 9 February 2012

Imprecise MEA is not responsible for imprecise targeting. Precise MEA only cuts off angles that are not reacheable by the opponent. Simply said, precise MEA has only advantages. The benefits of imprecise targeting on the other hand, can cause quite an interesting discussion. Imprecise targeting is not perse worse than precise targeting, f.e. random targeting can be a valid strategy against (very) good bots.

GrubbmGait15:17, 9 February 2012

Scaling/segmenting your gun differently than your opponents dodging makes it harder to learn/dodge and can be good. As long as it doesn´t shoot walls (unreachable angles). DrussGT keeps changing its gun weights (segmentation) in the next version every time someone knocks it off the top and seems to be working very well.

MN18:25, 9 February 2012

Well, that depends on how you use precise MEA. For Gilgalad I was scaling bin size by the MEA So I think that the buggy / random MEA added noise to the GF's. Another interesting point is that moving ahead 0.5 GF and then back 0.5 GF won't always end at zero because the wall smoothing may make the 0.5 GF much closer to GF zero than -0.5 is. However, that is a problem no matter how you calculate your GF's. I haven't given it detailed thought, but I think that as long as the enemy is making enough random and independent movement decisions between when you fire and when the wave breaks, the [centeral limit theorem] proves that their movement porfile will still approximate the normal distribution (which is why I think bin smoothing makes sense). However, I am unsure whether having the GF's scale or not would allow better/faster learning.

AW17:43, 9 February 2012

If so-called "imprecise MEA" is shooting walls, then your segmentation is inadequate anyway I'd say. I can't say I've ever seen RougeDC's gun (Also, the 5th place Scarlet in the rumble) shooting the walls, yet it just uses classical MEA. Now, I'm not saying so-called "Precise MEA" is pointless, because it can allow you to have a fast-learning gun omit wall segments (or give them lower weight), but it CAN actually have caveats worth paying attention to:

1. The algorithms most people use for it are not perfect, and may underestimate how far robots can move by a small amount. Usually, this is not a big deal because the imprecision is smaller than half-botwidth and the vast majority of guns aim for the center of the enemy, but theoretically it could cause some distortion.
I've never seen it implemented before, but a targeting system could account for the fact that at the it never needs to aim beyond the GF of "MEA - botwidth/2 + tiny_amount", and thus improve hitrate near the edges. This is risky though, because if your "precise" MEA and botwidth calculations are not significantly more precise than is typical, you risk an enemy being able to take advantage of this and avoid being hit.
2. If a bot uses the so-called "precise MEA" for scaling it's guessfactors (as opposed to just cropping), while it may sometimes learn faster due to being able to omit wall segments, BUT as the data collected increases, it may become less precise because it relies on an assumption about how enemies react to walls, which may not be entirely accurate.
Rednaxela18:42, 9 February 2012

Wall segments only avoids shooting walls after the gun learns how the opponent reacts to it. So at least in the first round a gun can shoot walls.

First round, an opponent dodges the first bullet at factor 1.0. Then it gets close to walls, factor 1.0 (imprecise) is unreachable, it crashes on the wall and "dodges" the second bullet at factor 0.0. There is only 1 wave in the history, so a GF gun without precise MEA will use factor 1.0 (imprecise) and shoot the second bullet at the wall (and make your bot look stupid).

Now, which of the two is better, cropping or scaling, varies with the opponent.

MN19:29, 9 February 2012

True, but I'd say it can be learned away much much quicker than 1 round even, especially when tick-waves are used.

About cropping or scaling, yeah... I'd say the tradeoff comes down to a matter of low-distortion (fewer assumptions) versus fast-learning (reduced segmentation needed). The best choice depends on all sorts of circumstances. With 1) a sufficiently large number of rounds, 2) good wall segmentation, and 3) non-learning opponents, cropping will just about always be better. Conditions #1 and #3 may frequently not be the case though, so yeah.

What I have been thinking about trying when I get around to actively robocoding again, is including both scaling and cropping, and use both for deciding each shot. Possibly ways to do it would be averaging the probability curve for both, or picking the one that gives the strongest prediction, among other possibilities.

Rednaxela20:15, 9 February 2012

1) I think precise MEA (with scaling, as Rednaxela is talking about above) is simply a truer mapping of a random mover's decision making process to firing angle. Random movers may decide "I'll move this direction for X ticks" or "each tick I have an X chance of reversing direction". If they never reverse direction, with precise MEA they'll always end up near GF=1. Without precise MEA, where they end up is all over the place depending on wall distance.

With precise MEA, wall segments can still be used to refine the data and learn about dive protection, while without it, they have to learn how wall distance impacts MEA and dive protection. So I personally don't see why imprecise MEA would be better after enough rounds, with good wall segments, or against non-learning opponents. I might concede "probably just as good after enough rounds", but "after enough rounds" is quite a caveat ;), and it would have to be "better" eventually to average out to even be "as good" over the whole battle. I also might concede "not worth the CPU time", but I haven't found a better use for it.

In my mind, raw bearing offsets are to GuessFactors what imprecise MEA is to precise MEA.

2) I don't know of any efficient algorithm for it. I simulate movement (with precise prediction) without wall smoothing, with wall smoothing, then reiterating the with wall smoothing a couple times to move more directly towards the farthest reachable point. I also add an extra 10% to that, though it doesn't matter because my gun could learn GFs > 1 if they happened. The only way I know of to really optimize this is with a lot of precomputed stuff in a giant lookup table, like "Fast Math" classes.

Voidious21:13, 9 February 2012