1

I just started experimenting with Robocode and read about waves: http://robowiki.net/wiki/Wave

what I don't understand is, why circles are used here.

i mean, when I shoot a bullet I only shoot it in one single direction and not in every direction as being implied when using a circle.

can anyone try to explain that circumstance and that concept in other words to me?

I'm just being stuck right now..

thanks, Julian

Julian
  • 61
  • 4

2 Answers2

2

The above answers hit the main points of why waves are a useful abstraction: as an optimization for collecting firing angles that would hit the target, relative to firing directly at the enemy.

Another use of waves is in bullet dodging movements. When you see the enemy fire a bullet (by monitoring its energy), you know the bullet's origin and speed, but not its exact location, as you can't see bullets. In this case, the wave represents what you know about the bullet: all its possible locations. If you get hit, you can similarly deduce the relative firing angle the enemy used. Later, you can use that data to evaluate the danger of different points on each wave and decide the safest place to intersect the wave (aka "Wave Surfing").

Voidious
  • 41
  • 2
  • Great! thanks for your reply! I've already read a lot of you regarding Robocode strategies! :) – Julian Mar 24 '13 at 08:23
1

It looks like the wave approach is meant as some optimization of a naive implementation. The basic concept would then be to determine the point in time when the projectile passes the target. This can simply be done by comparing the distance the 'wave' travelled from its origin ("wave_velocity * (time_now - time_fired)") to the distance of the target to the origin of this wave.

Once the two distances become equal (or the wave passes the target), the bearing from the wave's origin to the target's current location can be calculated and compared to the bearing of the projectile. If these two bearings are close enough to each other the target is considered 'hit'; otherwise the target was missed and the projectile can be disregarded for further calculations. (Assuming the target cannot move faster than the projectile.)

The optimization in this is that for every time-step only a couple of distances have to be calculated and compared to determine if the actual 'hit-check' needs to be performed. This way the projectiles need not be traced exactly in two (or three) dimensions but only in a single one (distance) which may save a significant amount of computation.

JimmyB
  • 12,101
  • 2
  • 28
  • 44
  • thanks! but a wave as being displayed would always hit a target as it expands. what basic fact do I seem to miss here? – Julian Mar 23 '13 at 20:05
  • I think waves are a way to calculate what the firing angle _should have been_ to hit the target – Martin Wilson Mar 23 '13 at 20:07