Combat Strategy
Give your pilot a preferred engagement distance and a plan for when it cannot hold that distance. A useful first loop picks a visible target, approaches until it can get a reliable shot, tracks through cooldown, and disengages before its reserves run out. Change one decision at a time so you can measure its effect in the replay.
Choose an engagement distance
| Role | What the pilot should try to do | Trade-off to test |
|---|---|---|
| Close-range attacker | Use a fast chassis to get inside the Plasma Cannon's effective range of 18 units, or inside the radius of a centered weapon. Approach at an angle that leaves a route out. | A bot that drives directly at the target can get stuck on its chassis. Fragment Burst loses damage quickly near its 4.5-unit edge. |
| Midrange duelist | Use Pulse Laser at roughly 20–27 units or Beam Laser near its 45-unit effective range. Back off if a shorter-range bot gets close. | Repeated energy shots can outspend regeneration. A bot that changes targets each tick may never finish lining up a turret. |
| Long-range attacker | Use a Beam Laser, Railgun, or Sniper Rifle to engage before short-range enemies. Keep a fallback for a close attacker or depleted ammo. | Long flight time and angular error can undo the reach advantage. A standard 64-ammo chassis has only two Sniper Rifle shots before resupply. |
| Control support | Use EMP to create a firing window, Repulsor to open space, or Graviton to pull a target toward follow-up fire. | Control spends reserves. Force can move a target out of the line your allies intended to use. |
Adjust those starting distances to suit the build. Spread starts at a weapon's base value, then increases quadratically beyond effective range. Movement on the launch tick multiplies the spread by 1.15. The engine aims from the fitted mount and tests projectile contacts against a 1.35-unit hit radius. At long distance even a small angle error can miss that circle. Equipment ranges
Use a range band to avoid switching between forward and reverse on every tick. For example, close outside 27 units and retreat inside 19 while using a Pulse Laser. Try remaining still between those distances. A different opponent, arena, or loadout can justify a different band.
Track before you fire
The pilot reads one snapshot per tick. The engine applies toggles and chassis movement before resolving aim and launch. A point you read from scan() can already be behind a moving target when the shot fires, even for an instant beam.
- Pick a target using your intended range, any observed velocity, and the time your turret would need to align. Retain the same visible target briefly when two candidates are similarly good. Match-local contact IDs are useful for keeping track.
- Use
estimateShot()for range, alignment time, and nominal flight time from the current pose. UseestimateIntercept()for a constant-velocity lead. Contact velocity can benullon the first sighting or after a visibility gap. Recheck the proposed point because the estimate can fail or the target can turn. - Use
aim()while cooling down or while the geometry is unfavorable. A ready shot with zero estimated aim delay can launch that tick. Ask forfire()only when you want the shot and the reserves are available. - Replace a stale pending shot with an updated aim-only order, or call
cancelAim(). A pending fire order can otherwise keep turning toward its original coordinate across ticks even after the contact moves or disappears. Use one aim, fire, or cancel command per slot per tick. - Read
actionResults()on the next tick.firedconfirms a launch. Check yourshotLaunchedandshotResolvedevents for feedback about visible impacts. A missing visible impact can include a hit on a hidden target.
This example uses a directional weapon in slot 0. It covers aim and fire. Add a route for closing, departing, or reacquiring a target in your main pilot.
<?php
$mount = $pilot->mountState(0);
$target = $pilot->scan()['enemies'][0] ?? null;
$battle = $pilot->battleState();
if ($target === null) {
if (($mount['pendingAim'] ?? null) !== null) {
$pilot->cancelAim(0);
}
return;
}
$vx = $target['velocity']['x'] ?? 0.0;
$vz = $target['velocity']['z'] ?? 0.0;
$x = $target['x'] + $vx * $battle['tickDuration'];
$z = $target['z'] + $vz * $battle['tickDuration'];
$lead = $pilot->estimateIntercept(0, $x, $z, $vx, $vz);
$x = $lead['x'] ?? $target['x'];
$z = $lead['z'] ?? $target['z'];
$shot = $pilot->estimateShot(0, $x, $z);
if (!($shot['inRange'] ?? false)) {
if (($mount['pendingAim'] ?? null) !== null) {
$pilot->cancelAim(0);
}
return;
}
if ($mount['ready'] && $shot['aimSeconds'] <= 0.0) {
$risk = $battle['friendlyFire'] ? $pilot->estimateFriendlyFire(0, $x, $z) : null;
if (!$battle['friendlyFire'] || ($risk['atRisk'] ?? null) === []) {
$pilot->holdPosition();
$pilot->fire(0, $x, $z);
return;
}
}
$pilot->aim(0, $x, $z);
Estimate quality falls when you turn, are knocked back, or aim through moving bots. Check splash clearance separately when adapting the example for missile launchers, which can detonate early. Pilot API
Move, recover, and stay in the fight
- Give the chassis time to turn.
moveTo()queues a single tick, and chassis alignment can consume the whole tick. CompareestimateMove()forward and in reverse when retreating. The estimate assumes a clear path. If the previous result isblockedByBot, choose a route around the blocker. Both teams' living bots have physical colliders. - Dodge only when you can finish the move. Compare
estimateThreatsAt()andestimateMove()for a reachable point. The threat estimate assumes you are already at the candidate point and only projects sensed threats. A turn or collision on the way can use up the time you had to dodge. - Use resources at the right moment. Preserve weapon energy before enabling shield recharge or overdrive. Armor reduces hull damage after shield absorption. A shield with charge already protects even while its recharge toggle is off. Repair uses ammo as well as energy. Watch the real costs and readiness instead of assuming a second mount will always fire when the first one does.
- Go for pickups you can reach and use. Compare
estimateMove()['totalSeconds']with the pickup'ssecondsRemaining. A pickup gives up to 20 hull, 30 energy, or 20 ammo, limited by your deficit. You collect automatically within 2.3 units. Even a full bot can take it, so route around a pickup when a teammate needs it more. - Change priorities at sudden death. Hull attrition bypasses shield and armor and repair pauses. Hull pickups expire. Check
battleState()and decide whether to finish a close opponent or spend the remaining hull taking a final shot from a safer distance.
Compare a change at the same seed, roster, and seat position, then test a different seed and a full arena. Review range at first shot, time between launches, damage taken while closing, and time spent blocked at the arena edge or by other bots. See Testing, Troubleshooting, and Team Strategy.