Robo Home | GamePhysics | Changes | Preferences | AllPages

Robocode Processing Loop

The order that Robocode runs is as follows:

  1. All robots execute their code until taking action
  2. Time is updated (currentTime++)
  3. All bullets move and check for collisions
  4. All robots move (heading, accel, velocity, distance, in that order)
  5. All robots perform scans (and collect team messages)
  6. The battlefield draws

Time and distance measurements in Robocode

Time (t) Robocode time is measured in "ticks", which are equivalent to frames displayed on the screen. Each robot gets one turn per tick. 1 tick = 1 turn = 1 frame.

Distance Measurement Robocode's units are basically measured in pixels, with two exceptions. First, all distances are measured with double precision, so you can actually move a fraction of a pixel. Second, Robocode automatically scales down battles to fit on the screen. In this case, the unit of distance is actually smaller than a pixel.

Robot Movement Physics

Acceleration (a) Robots accelerate at the rate of 1 pixel/tick. Robots decelerate at the rate of 2 pixels/tick. Robocode determines acceleration for you, based on the distance you are trying to move.

Velocity Equation(v) v = at. Absolute velocity can never exceed 8. Note that technically, velocity is a vector, but in Robocode we simply assume the direction of the vector to be the robot's heading.

Distance Equation (d) d = vt.

Robot, Gun, and Radar rotation



With Another Robot Each robot takes .6 damage. If a robot is moving away from the collision, it will not be stopped.

With a Wall AdvancedRobots? take Math.abs(velocity) * .5 - 1; (Never < 0)

Robo Home | GamePhysics | Changes | Preferences | AllPages
Edit text of this page | View other revisions
Last edited May 5, 2006 1:33 EST by Voidious (diff)