Is wiki wrong about MEA?

Jump to navigation Jump to search
Revision as of 17 September 2017 at 15:02.
The highlighted comment was created in this revision.

Is wiki wrong about MEA?

I've been using the asin(Vbot/Vbullet) formula for ages. But in my mind it should be atan(Vbot/Vbulet). Am I right?

It is not a big deal to over estimate MEA with asin. but the over estimate could be as bad as 30% for bullets with fire power equal to 3.

    Beaming (talk)04:43, 17 September 2017

    asin formula is when your opponent move perpendicular to your head on angle atan formula is when your opponent move perpendicular to your hit angle ;)

    However, the first one is greater, therefore the max (of them).

      Xor (talk)06:05, 17 September 2017

      I am arguing that the asin(Vbot/Vbullet) formula has an assumption in its derivation, which leads to the overestimation of the angle. The easy way to see that use of the asin is wrong is to assume that bullet speed is equal to the bot then asin gives 90 degrees, but you will never hit the bot this way, by symmetry MEA in this case is 45 degrees. Note that atan does it automatically.

        Beaming (talk)15:11, 17 September 2017

        90 degrees is correct, since you know the bot is restricted to that half of the field, since if it came towards you your bullet could catch up with it. To make it a little more absurd, what if the maximum bullet speed was 7, and bot speed was 8? According to the atan formula, your slow bullets will still hit the bot, even though a real strategy could be for the bot to run away faster than the bullets go. The asin formula is not defined in this case, which makes more sense, since the bot might never get hit (assuming infinite field size of course).

        Let's rephrase this: if you were the bot making the movement (not the firer), then what angle would be optimal for you to move at? Well, the one that lets you access the largest MEA, of course. What gives you the largest MEA? Not having a component of your movement going towards the fire location. Think of the x and y components separately, for the atan movement path if the bullet is fired on x axis then by orbiting the fire location you are reducing the x component of your distance to the fire location in the hopes of increasing the y component more. However this tradeoff is not worth it since it makes the bullet hit you sooner, meaning you cannot access the higher MEA.

        In the case when the firer is moving and there are multiple bullets in the air each from different locations, it isn't always possible to move perpendicular to the original wave because you are in 2D and can only move perpendicular to one line at a time, and you are trying to dodge multiple bullets. But if you chose to, and didn't run out of space, you could make your MEA right up to the asin(vbot/vbullet), for a single wave at least. And if the enemy gun didn't accept or shoot at these higher angles, you could dodge all of their bullet like this.

          Skilgannon (talk)15:52, 17 September 2017
           
           

          The thing is, if the bot moves slightly away then it increases the bullet flight time, allowing the bot to reach a higher MEA than just an orbit or chord.

          Personally, in DrussGT I use a precise MEA since it gave better results. But if you have some limitation on whether the bot can exceed the calculated MEA (for example you log them to bins) then the asin is better, otherwise bots could potentially move to angles you can't shoot at.

            Skilgannon (talk)11:26, 17 September 2017

            Are you using precise MEA to scale? or just to cut. From the version history I think it is the latter, but Understanding DrussGT says former ;)

              Xor (talk)11:46, 17 September 2017

              Both.

                Skilgannon (talk)14:01, 17 September 2017
                 
                I've just calculated it. If it is correct moving away helps.
                            latVel = Math.sin(angle) * 8;
                            advVel = -Math.cos(angle) * 8;
                            timeToHit = distance / (bulletSpeed + advVel);
                            mea = latVel / (distance - (timeToHit * advVel) / 2) * hitTime;
                
                This is the formula. It thinks that the bot is moving at full speed and with brute force search I got these results:
                Bullet Power 1:
                LatVel: 7.762365810207972 AdvVel: -1.9353751647973414
                Bullet Power 2:
                LatVel: 7.6504380477042835 AdvVel: -2.338973637781894
                Bullet Power 3:
                LatVel: 7.468643411977614 AdvVel: -2.8669435963624013
                Distance doesn't change anything if it isn't zero.
                  Dsekercioglu (talk)14:40, 17 September 2017

                  timeToHit is not taking in account that the bullet moves at some angle too, i.e. we need to use bulletSpeed*cos(MEA). In above we assume that 'a' is angle between line connecting bots and the velocity of the target.

                  The last line is not precisely correct as well. There should be no factor of 2, and you forgot the atan. It should be

                   mea = atan( latVel / (distance - (timeToHit * advVel)) * hitTime );
                  

                  But the last thing could be simplified a bit if you notice that

                  latVel = bulletSpeed*sin(MEA)
                  

                  Moving away is always bad idea from the MEA prospective within robocode physics.

                    Beaming (talk)15:07, 17 September 2017

                    Look at the values that he posted for latVel vs advVel, all with the same 8 speed. For a very small reduction in latVel you can get a big increase in advVel. Increased advVel means you get a longer time until the bullet hits, so in that extra time you can add more latVel components, giving you a higher MEA. This is offset somewhat by being further away, so your latVel/distance is slightly smaller so each latVel increases the MEA a bit less. But this is more than compensated by the extra time until the bullet hits.

                      Skilgannon (talk)16:02, 17 September 2017