Skip to content

What is Robocode & How to Use This Book

Robocode is a programming game where your code drives a battle bot. Instead of using a controller, you write the brain of the bot and let it fight on a 2D battlefield. This book explains the ideas behind winning bots with short, teen-friendly pages, light math, and practical intuition.

What "Robocode" Means

In this book, the word Robocode is used in two closely related ways:

  1. Robocode (classic) — the original Java-based programming game created by Mathew A. Nelson and later maintained by Flemming N. Larsen. Battles run on a 2D battlefield where bot tanks fight using Java code.
  2. Robocode Tank Royale — a newer, modern Robocode platform created by Flemming N. Larsen. It keeps the same core idea (code a battling bot) but supports multiple programming languages and a more flexible architecture.

Unless stated otherwise, Robocode should be read as Robocode and Robocode Tank Royale together. When a concept only applies to one platform, the page will say Classic Robocode or Robocode Tank Royale explicitly.

The Core Idea

Your bot must:

  • Move around the battlefield
  • Scan for enemies with a radar
  • Aim its gun
  • Decide when and how hard to fire
  • React to events such as being hit or colliding with walls

During a battle, you cannot control the bot directly. The only way to win is to write smarter code.

Bullets themselves follow simple physics: they cost energy to fire, travel in straight lines along the gun heading, and reduce an opponent's energy when they hit.

Battle Formats

Robocode supports three main battle formats. Each rewards different strategies:

  • 1v1 (Duel) — Two bots face off in direct combat. The most popular competitive format. Success depends on targeting accuracy and energy management.
  • Melee — Three or more bots battle simultaneously until one remains. Survival often matters more than raw damage output. (Fun fact: The name "Tank Royale" is inspired by melee battles resembling the "Battle Royale" game genre!)
  • Team — Multiple bots per side share a collective score. Enables role specialization and coordinated tactics.

For detailed scoring rules, see Scoring Systems & Battle Types. For competition standards used in community rankings, see Competition Formats & Rankings.

Classic Robocode vs. Tank Royale

Classic Robocode

  • Runs on the Java platform.
  • You write Java bots that extend specific base classes from the Robocode API.
  • Battles run inside a desktop GUI application.
  • Has the RoboRumble client built-in for participating in community rankings via LiteRumble.
  • Many classic strategies, tutorials, and bots live on RoboWiki (classic Robocode only).

Robocode Tank Royale

  • Runs on a server + bot architecture.
  • Bots connect to a game server using network protocols.
  • You can write bots in multiple languages (for example, Java, C#, Python, Kotlin, Scala, and more).
  • Does not have a community competition system like RoboRumble and LiteRumble yet.

Terminology Note

  • Throughout this book, we use the term "units" for all measurements of distance, size, and movement in Robocode and Robocode Tank Royale. This replaces the older term "pixels" and ensures clarity across both platforms.
  • We also use the term "bot" instead of "robot" or "tank" to describe the agent you develop and control. This keeps the language consistent and focused on programming your own intelligent agent.
  • The word "intent" refers to the set of commands (move, turn, fire, etc.) your bot issues for the current turn. When you commit the turn (using execute() or go()), your bot sends this intent to the game engine or server to be carried out.

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