robocode.Bullet instances not being synchronized

Jump to navigation Jump to search
Revision as of 11 February 2013 at 05:45.
The highlighted comment was edited in this revision. [diff]

robocode.Bullet instances not being synchronized

I've been trying to track down a weird bug that makes DrussGT occasionally not be able to identify one of its bullets in an onBulletHitBullet situation. The bullet I get in the onBulletHitBullet handler gives a getX() and getY() to a point which is one tick behind the one I have stored from fire time. This only happens rarely, once every ~100 or so bullets, but it's enough to make DrussGT crash with some new optimizations I've added, and enough to prevent the wave shadows from being cleared in certain circumstances.

I'm also not sure which one is giving the incorrect results, the setFireBullet Bullet or the BulletHitBulletEvent Bullet; if it's the former, it means that every so often my bullet shadows are incorrect, which would also explain why I get hit by a bullet which is inside of a bullet shadow several times a battle against Diamond.

So, any ideas of how on earth this might be happening, or the best way to mitigate it? Would somebody please check if this happens to them as well? I'm using 1.7.3.2 as a dev environment.

    Skilgannon20:26, 10 February 2013

    If you just match the bullet within a distance of 50 and also match the bullet power to 1 decimal, there should be no room for error, right? At least in matching to the right wave. I think I've always done it that way, probably going back to the point where my wave management was buggy enough that I just compensated for it.

    In fact I thought the *HitBullet methods used to return points not even along the line the bullet traveled, though again that could have been buggy wave management. But I thought it was something Fnl fixed at some point.

    That is pretty funky and I'd def like us to track it down and fix it. I'll run some tests when I get a chance.

      Voidious00:27, 11 February 2013
       

      onHitByBullet events return bullet coordinates after it hits you, and onBulletHitBullet events return bullet coordinates before it hits the other bullet. If you reuse the same code for both events, you have to adjust time accordingly. I stumbled on this while tracking a wave detection bug in Combat a while ago.

        MN00:53, 11 February 2013

        But surely both Bullet objects should show the same location even after a hit? ie, the one from setFireBullet and the one from BulletHitBulletEvent? They both represent the same simulated object. They should stay in step with each other.

          Skilgannon06:44, 11 February 2013