Bullet Shadow/Correct

From Robowiki
Jump to navigation Jump to search
This article is a stub. You can help RoboWiki by expanding it.

In BeepBoop/Understanding BeepBoop, Kev mentioned that:

Bots I've looked at implement passive bullet shadowing something like this:

  1. Iterate through various (my_bullet, enemy_wave) pairs. These typically consist of a new enemy wave with all your current bullets or a new bullet with current enemy waves.
  2. For each pair, iterate through various timesteps t when the bullet might intersect with the wave.
  3. Add a shadow (if there is any) for the bullet at t and the wave at t, found by determining where the line segment (bullet_location_t, bullet_location_t+1) intersects the circles wave_t and wave_t+1.

However, step 3 isn't quite right. Robocode checks for bullet collisions by iterating through bullets in a random order, updating the line segment for the current bullet, and then checking if it intersects any of the other bullet line segments. Depending on this random order, a bullet can collide with another bullet's "previous" line segment. This means the correct way of doing step 3 is really.

  1. Add a shadow for the bullet at t and the wave at t. Then add 50%-weighted shadows for the bullet at t and wave at t-1 and for the bullet at t-1 and wave at t.

Thanks Kev for pioneering correct bullet shadow in 1v1! I regard using correct bullet shadow as the next great thing in Innovations since 2005.