Skip to content

Bullet Power Selection Strategy โ€‹

Origins

Fire power selection strategies were developed and documented by the RoboWiki community, with notable contributions including Albert's power selection algorithm.

Choosing the right bullet power is one of the most consequential tactical decisions in Robocode. Fire is too weak, and you leave damage on the table; fire is too strong, and you waste energy on slow bullets that miss. This page presents a strategic framework for bullet power selection that adapts to distance, energy levels, targeting confidence, and battle context.

Bullet Power Decision Factors โ€‹

The table below provides quick-reference guidelines for choosing bullet power based on four key factors. Colors indicate the recommended power level:

  • ๐ŸŸข Green = High power (2.5โ€“3.0): Favorable conditions for heavy bullets
  • ๐ŸŸก Yellow/Orange = Moderate power (1.0โ€“2.5): Balanced situations
  • ๐Ÿ”ด Red = Low power (0.5โ€“1.5): Conservative fire required
  • ๐Ÿ”ต Blue = Calculated power: Tactical situations requiring precise calculation
  • โšซ Gray = Context-dependent: Adjust based on the situation
FactorConditionRecommended PowerRationale
DistanceClose (< 150 units)2.5โ€“3.0Bullets arrive quickly; maximize damage
Medium (150โ€“400 units)1.8โ€“2.2Balance damage with bullet speed
Long (> 400 units)0.8โ€“1.5Prioritize speed to reduce travel time
Your EnergyCritical (< 15)0.5โ€“1.0Preserve energy; avoid disablement
Low (15โ€“35)1.0โ€“1.8Balance offense with survival
Healthy (35โ€“70)1.8โ€“2.5Standard combat flexibility
Dominant (> 70)2.5โ€“3.0Can afford heavy shots and pressure
ConfidenceHigh (hit rate > 70%)2.5โ€“3.0Landing shots; maximize damage
Moderate (hit rate 40โ€“70%)1.8โ€“2.2Competitive performance
Low (hit rate < 40%)0.8โ€“1.5Prioritize speed over damage
Context1v1 balanced1.8โ€“2.2Accuracy matters most
Melee standard1.5โ€“2.0Energy efficiency priority
Finishing shotCalculate minimumDon't waste power on overkill
Enemy cornered+0.3โ€“0.5Limited evasion options

Why bullet power is strategic โ€‹

Bullet power selection directly impacts four combat dimensions:

  1. Damage output: Higher power delivers more damage: damage=4ร—power+maxโก(0,2ร—(powerโˆ’1))\text{damage} = 4 \times \text{power} + \max(0, 2 \times (\text{power} - 1))
  2. Bullet speed: Lower power travels faster: speed=20โˆ’3ร—power\text{speed} = 20 - 3 \times \text{power} units/turn
  3. Energy cost: Each shot costs energy equal to its power (0.1 to 3.0)
  4. Gun cooldown: Higher power adds more heat: heat=1+power5\text{heat} = 1 + \frac{\text{power}}{5}

These tradeoffs create a fundamental tension: high damage comes at the cost of speed, energy, and firing rate. The optimal choice depends on the tactical situation.

Scoring efficiency matters more than raw damage

A 1.5 power bullet that hits scores more points than a 3.0 power bullet that misses. Your goal is to maximize expected damage per shot, not theoretical maximum damage.

The strategic framework โ€‹

Effective bullet power selection considers four primary factors:

Distance to target โ€‹

Distance determines bullet travel time, which directly affects hit probability. Longer travel times amplify targeting errors and give opponents more time to evade.

Strategic guidelines:

  • Close range (< 150 units): Use high power (2.5โ€“3.0). Bullets arrive quickly regardless of speed, so maximize damage.
  • Medium range (150โ€“400 units): Use moderate power (1.8โ€“2.2). Balance damage with reasonable bullet speed.
  • Long range (> 400 units): Use low power (0.8โ€“1.5). Prioritize speed to minimize prediction error and evasion time.

Rationale: At close range, the enemy cannot evade effectively, so slow bullets don't matter. At long range, even a perfect prediction can be missed if the bullet is too slow. the target has more time to change course or respond to battlefield events.

Energy levels โ€‹

Your energy level determines how much risk you can afford. Low energy demands conservative play; high energy enables aggressive power selection.

Your energy state:

  • Critical (< 15): Fire 0.5โ€“1.0 power. Preserve energy to avoid disablement. One heavy bullet that misses could end the round.
  • Low (15โ€“35): Fire 1.0โ€“1.8 power. Balance offense with survival. You can still fight, but you can't afford waste.
  • Healthy (35โ€“70): Fire 1.8โ€“2.5 power. Standard combat power levels with flexibility.
  • Dominant (> 70): Fire 2.5โ€“3.0 power when justified. You can absorb the energy cost and sustain pressure.

Enemy energy state:

  • Enemy critical (< 15): Use just enough power to finish them. Don't waste 3.0 when 1.5 will kill.
  • Enemy low (15โ€“35): Increase power to pressure them. Force defensive behavior.
  • Energy advantage (you > enemy + 30): Use heavy bullets to press your advantage and force trades.

Rationale: Energy is survival. When low, every shot could be your last, so maximize shot count over per-shot damage. When high, you can afford to trade misses for knockout power.

Targeting confidence โ€‹

If your bot tracks hit rates or prediction confidence, use that data to adjust power. High confidence justifies high power; low confidence demands speed over damage.

Confidence-based scaling:

  • High confidence (hit rate > 70%): Fire 2.5โ€“3.0 power. You're landing shots: maximize damage.
  • Moderate confidence (hit rate 40โ€“70%): Fire 1.8โ€“2.2 power. You're competitive but not dominant.
  • Low confidence (hit rate < 40%): Fire 0.8โ€“1.5 power. Prioritize bullet speed to increase hit probability.

Implementation note: Many advanced bots use virtual guns or statistical targeting systems that provide confidence metrics. If you don't track confidence, fall back to distance and energy-based decisions.

Rationale: A 3.0 power bullet that hits is worth more than a 1.0 power bullet, but a 1.0 power bullet that hits is worth infinitely more than a 3.0 power bullet that misses. If you're struggling to hit, faster bullets improve your odds.

Battle context adjustments โ€‹

Beyond distance, energy, and confidence, certain tactical situations call for specific power choices:

Finishing shots โ€‹

When the enemy is low on energy and one shot can win the round, calculate the minimum power needed. Recall the damage formula: damage=4ร—power+maxโก(0,2ร—(powerโˆ’1))\text{damage} = 4 \times \text{power} + \max(0, 2 \times (\text{power} - 1))

Work backwards: if you know the enemy's remaining energy, find the minimum power to exceed it:

powerโ‰ˆenemyEnergy6\text{power} \approx \frac{\text{enemyEnergy}}{6} (for power > 1.0, accounting for the bonus term)

For lower powers (0.1โ€“1.0), use the simpler formula:

powerโ‰ˆenemyEnergy4\text{power} \approx \frac{\text{enemyEnergy}}{4}

Example: Enemy has 8 energy remaining.

  • Using the general formula: powerโ‰ˆ86โ‰ˆ1.33\text{power} \approx \frac{8}{6} \approx 1.33
  • A 1.5 power bullet deals 4ร—1.5+2ร—(1.5โˆ’1)=6+1=74 \times 1.5 + 2 \times (1.5 - 1) = 6 + 1 = 7 damage (not quite enough)
  • A 2.0 power bullet deals 4ร—2.0+2ร—(2.0โˆ’1)=8+2=104 \times 2.0 + 2 \times (2.0 - 1) = 8 + 2 = 10 damage (kills them)
  • Fire 2.0 power.

Key principle: Always round up and add a small buffer to account for floating-point rounding. Firing 3.0 when 1.5 will do is wasteful. aim for the minimum that guarantees the kill, no more.

Melee combat โ€‹

In melee battles (3+ bots), bullet power selection requires different priorities:

  • Conservative by default: Fire 1.5โ€“2.0 power to balance damage with energy efficiency. You're fighting multiple opponents, so energy conservation matters more than 1v1.
  • Opportunistic heavy shots: Use 2.5โ€“3.0 power only when you have a high-confidence shot at a low-energy bot you can eliminate.
  • Light shots when crowded: If multiple bots are clustered or moving unpredictably, fire 0.8โ€“1.2 power to increase hit probability.

Rationale: Melee rewards consistent scoring over knockout power. Eliminating bots earns survival points, but wasting energy on missed heavy bullets leaves you vulnerable to focused fire.

Wall proximity โ€‹

When the enemy is near a wall, their evasion options are limited. This is an opportunity for higher power:

  • If they're cornered (< 100 units from wall), consider 2.5โ€“3.0 power even at longer distances.
  • If they're approaching a wall predictably, fire heavier than distance alone would suggest.

Rationale: Walls constrain movement, reducing the enemy's ability to dodge. This effectively increases your confidence, justifying higher power.

Common strategies in practice โ€‹

Fixed power approach โ€‹

Some competitive bots use a single fixed power (e.g., 1.95 or 2.0) for simplicity and consistency. This works well when:

  • Your targeting system is highly accurate across distances.
  • You want predictable gun heat cycles.
  • You're optimizing for specific opponent types or battle conditions.

Pros: Simple, debuggable, consistent cooldown timing.
Cons: Ignores situational advantages (close range, energy imbalances, finishing shots).

Hybrid formula โ€‹

Many bots combine multiple factors into a single calculation. The selector below expects hitRate as a value from 0 to 1, where 0.7 means a 70% hit rate.

java
static double selectBulletPower(double distance, double myEnergy, double hitRate) {
    double distanceFactor = distance < 150 ? 1.5 : distance < 400 ? 1.0 : 0.6;
    double energyFactor = myEnergy < 15 ? 0.3 : myEnergy < 35 ? 0.7 : 1.0;
    double confidenceFactor = hitRate > 0.7 ? 1.2 : hitRate < 0.4 ? 0.6 : 1.0;
    double power = 2.0 * distanceFactor * energyFactor * confidenceFactor;
    return Math.max(0.1, Math.min(3.0, power));
}
python
def select_bullet_power(distance: float, my_energy: float, hit_rate: float) -> float:
    distance_factor = 1.5 if distance < 150 else 1.0 if distance < 400 else 0.6
    energy_factor = 0.3 if my_energy < 15 else 0.7 if my_energy < 35 else 1.0
    confidence_factor = 1.2 if hit_rate > 0.7 else 0.6 if hit_rate < 0.4 else 1.0
    power = 2.0 * distance_factor * energy_factor * confidence_factor
    return max(0.1, min(3.0, power))
java
static double selectBulletPower(double distance, double myEnergy, double hitRate) {
    double distanceFactor = distance < 150 ? 1.5 : distance < 400 ? 1.0 : 0.6;
    double energyFactor = myEnergy < 15 ? 0.3 : myEnergy < 35 ? 0.7 : 1.0;
    double confidenceFactor = hitRate > 0.7 ? 1.2 : hitRate < 0.4 ? 0.6 : 1.0;
    double power = 2.0 * distanceFactor * energyFactor * confidenceFactor;
    return Math.max(0.1, Math.min(3.0, power));
}
csharp
static double SelectBulletPower(double distance, double myEnergy, double hitRate)
{
    double distanceFactor = distance < 150 ? 1.5 : distance < 400 ? 1.0 : 0.6;
    double energyFactor = myEnergy < 15 ? 0.3 : myEnergy < 35 ? 0.7 : 1.0;
    double confidenceFactor = hitRate > 0.7 ? 1.2 : hitRate < 0.4 ? 0.6 : 1.0;
    double power = 2.0 * distanceFactor * energyFactor * confidenceFactor;
    return Math.Max(0.1, Math.Min(3.0, power));
}
typescript
function selectBulletPower(distance: number, myEnergy: number, hitRate: number): number {
    const distanceFactor = distance < 150 ? 1.5 : distance < 400 ? 1.0 : 0.6;
    const energyFactor = myEnergy < 15 ? 0.3 : myEnergy < 35 ? 0.7 : 1.0;
    const confidenceFactor = hitRate > 0.7 ? 1.2 : hitRate < 0.4 ? 0.6 : 1.0;
    const power = 2.0 * distanceFactor * energyFactor * confidenceFactor;
    return Math.max(0.1, Math.min(3.0, power));
}

This approach dynamically scales power based on real-time conditions, adapting to each shot.

Tips and common mistakes โ€‹

Don't waste energy on impossible shots

If your targeting system is struggling (hit rate < 30%) at long range, firing 3.0 power bullets is a guaranteed path to defeat. Drop to 1.0 or lower and focus on improving your aim before scaling up power.

Minimum viable power for finishing shots

When the enemy is low on energy, calculate the exact power needed to finish them. Firing 3.0 when 1.5 will do wastes energy and cooling time for your next target.

Common mistakes to avoid:

  • Always firing maximum power: Slow bullets miss more often at long range. You score more damage with moderate power and higher hit rates.
  • Ignoring your own energy level: Firing 3.0 power bullets when you have 12 energy is dangerous. One miss and you're disabled.
  • Not adapting to melee: 1v1 strategies don't work in melee. Energy efficiency and survival matter more than knockout power.
  • Forgetting gun heat: High power adds more heat. If you need to fire again quickly (e.g., finishing a wounded bot), moderate power reduces cooldown.

Summary โ€‹

Bullet power selection is a multi-dimensional strategic problem. The optimal choice depends on:

  • Distance: Closer targets justify higher power.
  • Energy: Low energy demands conservative power.
  • Confidence: High hit rates justify heavy bullets.
  • Context: Finishing shots, melee battles, and wall proximity all influence decisions.

Competitive bots often use hybrid formulas that weigh these factors dynamically, adapting to each shot. Start with distance and energy-based rules, then add confidence tracking as your targeting system matures. Over time, you'll develop intuition for power selection that matches your bot's strengths and your opponents' weaknesses.

Next steps:

Further Reading โ€‹

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