Skip to content

Physics Differences ​

Origins

Classic Robocode physics was defined by Mathew A. Nelson (Mat Nelson). Flemming Nørnberg Larsen (fnl) kept the same rules for Robocode Tank Royale and switched the angles to ordinary math conventions.

A classic bot ported line by line to Tank Royale can compile, run, and still drive straight into a wall. The speeds, bullets, and gun heat are the same. The compass is not. This page lists what carries over unchanged and the few rules that quietly flip.

The numbers that do not change ​

The Tank Royale docs say the game "is following the same basic rules as the original game". Every core formula checks out as identical on both platforms:

RuleValue on both platforms
Acceleration1 unit/turn per turn
Deceleration2 units/turn per turn
Maximum speed8 units/turn
Body turn rate10−0.75⋅∣v∣10 - 0.75 \cdot \lvert v \rvert degrees per turn
Gun / radar turn rate20° / 45° per turn
Firepower0.1 – 3
Bullet speed20−3⋅p20 - 3 \cdot p units/turn
Bullet damage4p4p, plus 2(p−1)2(p - 1) when p>1p > 1
Energy returned on a hit3p3p
Gun heat per shot1+p/51 + p / 5
Bot vs bot collision0.6 damage to each bot
Wall damage∣v∣/2−1\lvert v \rvert / 2 - 1, never below 0

Here vv is the bot's speed and pp is the firepower. Guns start hot at the beginning of every round on both platforms. So any physics math from the Battlefield Physics chapter, escape angles, and bullet flight times can be reused as they are.

The compass flips ​

Both platforms put (0,0)(0, 0) at the bottom-left corner of the battlefield. The difference is where 0° points and which way angles grow.

  • Classic Robocode: 0° is north, 90° is east, and angles grow clockwise.
  • Tank Royale: 0° is east, 90° is north, and angles grow counterclockwise, like a math textbook.

Classic Robocode: 0° points north and angles grow clockwise.
Classic Robocode: 0° points north and angles grow clockwise.

Tank Royale: 0° points east and angles grow counterclockwise.
Tank Royale: 0° points east and angles grow counterclockwise.

Converting a heading is one subtraction, and it works in both directions:

hTR=(90−hC) mod 360h_{TR} = (90 - h_{C}) \bmod 360

Here hCh_C is a classic heading and hTRh_{TR} is the same direction as a Tank Royale heading. North is 0° in classic and 90° in Tank Royale. East is 90° in classic and 0° in Tank Royale.

The payoff is in the trigonometry. Classic code projects a point with x + sin(a) * d and y + cos(a) * d, which surprises most newcomers. In Tank Royale, the textbook form works:

txt
// Tank Royale: project a point at distance d along heading a (degrees)
x2 = x + cos(toRadians(a)) * d
y2 = y + sin(toRadians(a)) * d

Turning left is now positive ​

A flipped compass also flips the sign of a turn. In classic Robocode, turning right increases the heading. In Tank Royale, turning right moves the heading clockwise, which decreases it, and turning left increases it.

This is the bug that survives porting most often. A wave surfer or wall smoother that computes "turn by +30°" will steer the wrong way unless the sign flips too. When porting, convert every angle once at the edge of the code, and keep the internal math in a single convention.

Platform Difference

Classic Robocode also offers radian methods such as getHeadingRadians(). Tank Royale works in degrees only, so convert explicitly before calling sin() or cos().

Hitboxes: square versus circle ​

Bullets hit a different shape on each platform.

  • Classic Robocode: a 36×36 unit square that stays axis-aligned even when the bot turns.
  • Tank Royale: a circle with radius 18 units around the bot's center.

Classic Robocode: an axis-aligned 36×36 square.
Classic Robocode: an axis-aligned 36×36 square.

Tank Royale: a circle with radius 18 units.
Tank Royale: a circle with radius 18 units.

The square reaches about 25 units from the center along its diagonals, and the circle only reaches 18. A bullet that clips a classic bot's corner can miss the same bot in Tank Royale. This matters most for precise targeting and bullet shadows, where a bot computes exactly which angles a bullet covers.

One more difference: the turn itself ​

Classic Robocode runs every bot in its own thread inside the game engine. Tank Royale bots run as separate programs and send an intent to the server each turn, and the docs call each turn "deterministic" as a result. The physics does not change, but a slow bot skips turns when it misses the configured turn time limit.

Classic Robocode gives a bot no way to see that deadline coming. Tank Royale exposes it directly: getTurnTimeout() returns the turn budget in microseconds, and getTimeLeft() returns how much of it remains before go() must be called. A bot with a heavy per-turn computation, such as a k-d tree rebuild or a wide GuessFactor scan, can check getTimeLeft() and cut the work short instead of losing the whole turn to a timeout.

The mechanics are close enough that most strategy knowledge carries over. The API is another story, and the next page, API Changes, covers the method names and events that did move.

Further Reading ​

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