# Waves

(Redirected from Wave)
Tron and Fractal firing at each other, thus creating waves with each shot.

A mechanic used to gather bearing offsets (used as firing angles), for use in either movement (i.e., wave surfing) or targeting. A wave consists of a source location (of the firing bot), a velocity (generally based on firing bot's bullet power), the time the wave was created, and the bearing to the target at fire time.

## How it works

A wave "breaks" or "hits" when the distance the wave has traveled (`wave_velocity * (time_now - time_fired)`) is greater than the distance from the wave source to the enemy. You can imagine the wave as a circle that radiates out from the point from which it was fired (which is where the name came from). Once the wave breaks, the firing angle - the offset relative to head-on targeting - that would have hit the enemy can easily be deduced.

## Precursors to waves

Before waves, forms of GuessFactor targeting used virtual bullets to gather firing angles: a bot would simulate a bullet being fired at many different GuessFactors between -1 and 1, then check each tick to see which of those bullets would have hit the enemy. This accomplished the same thing as using waves, but was far more CPU intensive.

Several people were using waves in some form before the term itself was coined and the concept brought into popular use, most notably Iiley in his bot Cigaret.

## How it's useful

Many forms of targeting, including GuessFactor targeting and many implementations of Dynamic Clustering, are based on offsets from head-on targeting. This makes waves the ideal mechanic for data collection. In Wave Surfing, waves can be used to figure out how the enemy is targeting your bot so that you can dodge their bullets effectively. Some bots also use waves in their virtual guns systems, comparing the firing angle produced by the wave to the one produced by the gun instead of tracking virtual bullets each tick.