Skip to content

Angular Targeting ​

Origins

Angular Targeting was developed and documented by the RoboWiki community. Peter Strömberg (PEZ) designed the Factored variant and first built it into his bot Gouldingi.

Most targeting systems in this book predict a position: where the enemy's x and y coordinates will be when the bullet arrives. Angular Targeting skips position entirely and predicts an angle, extrapolating how the enemy's bearing has been swinging between scans and firing along wherever that swing points next.

Bearing swing instead of position ​

RoboWiki describes the base idea in one line: extrapolate the bearing difference between two scans of the enemy. Take the bearing from the bot to the enemy on the last two scans, find the difference between them, and assume the next stretch of bearing change looks like the last one. The bullet fires along that projected bearing rather than at a simulated future position.

The bearing to the enemy swings between two scans. Angular Targeting fires further along that same swing
instead of predicting a position.
The bearing to the enemy swings between two scans. Angular Targeting fires further along that same swing instead of predicting a position.

PEZ's Factored refinement ​

Plain bearing extrapolation trusts the most recent swing completely, which is fragile against any enemy that changes its turning at all. Factored Angular Targeting keeps the same shape but scales the swing by an adaptive factor FF instead of taking it at face value, aiming at the current bearing plus FF times the raw bearing delta between the last two scans.

Every shot gets logged: the bot's own location, the enemy's location, the fire time, the bullet speed, and the raw bearing delta bdbd that produced the shot. When the bullet would have reached the enemy's original position, Factored Angular Targeting looks back at where the enemy actually ended up and works out the bearing swing BDBD that shot would have needed to land. The ratio f=BDbdf = \frac{BD}{bd} is the factor that would have hit that one shot. RoboWiki does not publish a fixed way to fold ff into FF, only that some kind of rolling average works, so each new shot nudges FF toward whatever ratio has been landing hits lately, without resetting it from scratch.

txt
onScan(enemy):
    bd = bearing(now) - bearing(lastScan)
    fireBearing = bearing(now) + F * bd
    fire(fireBearing)
    logShot(ownLocation, enemyLocation, fireBearing, bulletSpeed, bd)

onBulletArrival(shot):
    BD = bearingSwing(shot.ownLocation, shot.enemyLocationThen, enemyLocationNow)
    f = BD / shot.bd
    F = rollingAverage(F, f)   // RoboWiki leaves the exact averaging step open

Where it sits next to GuessFactor ​

GuessFactor Targeting normalizes every bearing offset by the physics-based escape angle and bins the results into a histogram, so it can represent an enemy with two favorite escape directions at once. Factored Angular Targeting keeps a single running number, closer to RoboWiki's Averaged Bearing Offset Targeting than to a full segmentation system. That single factor is cheap to keep and quick to adapt, but it can only aim at one place at a time, so it blurs together an enemy that genuinely alternates between two escape directions.

Platform notes ​

Both platforms expose the scan history and bearing data the technique depends on. Convert bearings into one consistent angle convention before computing bdbd or BDBD, since classic Robocode headings are compass-style while Tank Royale headings are mathematical.

Further Reading ​

Based on RoboWiki content (CC BY-SA 3.0) for classic Robocode and the official Robocode Tank Royale documentation.