Selecting Fire Power
An important element of targeting strategy is choosing what power with which to fire a bullet. As bullet power goes up, bullets move more slowly, require more energy, do more damage to the enemy, and give more energy back to the firing bot. Managing one's own energy and depleting the enemy's energy is important to survival, but bullet damage itself is also very relevant to Robocode scoring, so it can be difficult to choose the optimal fire power in all situations.
- In Robocode, a bullet can be fired with any amount of energy between 0.1 and 3.0.
- Bullets move with a velocity of:
20 - (3 * bulletPower)
- Bullets do damage equal to 4 times bullet power plus 2 times any amount over 1.0:
(bulletPower * 4) + (max(0, bulletPower - 1) * 2)
- Bullets that hit the enemy give energy back to the firing bot equal to:
3 * bulletPower
- After firing, a robot's gun heats up to a value of:
1 + (bulletPower / 5). At the default gun cooling rate of 0.1, this means a bot has to wait
ceiling((1 + (bulletPower / 5)) * 10)before it can fire again.
Common fire power choices
There are many, many fire power selection schemes, but there are some basic ideas that many (but nowhere near all) bots use:
- In 1-vs-1, many bots use a fire power around 1.9 or 2.0.
- In melee, many bots simply use maximum fire power, 3.0.
- Many bots reduce fire power when the opponent is very far away or increase it when the enemy is very close.
- Many bots reduce fire power when they are low on energy.
- It is a waste of energy to fire with a power greater than what's needed to kill the enemy (especially in 1-vs-1).