Skip to content
Branch: master
Find file Copy path
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
170 lines (115 sloc) 5.01 KB
layout author title date desc bigimg img categories tags series extras interesting toc package-versions redirect_from
Wouter Van Schandevijl
Robocode Installation & Debugging
2019-06-17 17:00:00 -0700
Robocode tutorials for the itenium roborumble™
url desc origin
Photo by Ray Rui
githubproject githubtext
Example Eclipse and Visual Studio Robocode projects
url desc
Official Robocode site
url desc
Robocode Wiki
💣 Installation

{% include github-stars.html url="robo-code/robocode" desc="Build the best - destroy the rest!" %}

Robocode is a programming game, where the goal is to develop a robot battle tank to battle against other tanks in Java or .NET. The robot battles are running in real-time and on-screen.

Install Robocode


Or follow the official step by step instructions.

If you get a "'java' is not recognized as an internal or external command", then add your JDK to PATH.

Building a Robot

In the Robocode UI

Robot > Source Editor (Control + E) > New Robot (Control + N)

This will generate something like:

public class MyRobot extends Robot
    public void run() {
        setColors(,,; // body, gun, radar

        while(true) {
            ahead(100); // pixels
            turnGunRight(360); // degrees

    public void onScannedRobot(ScannedRobotEvent e) {
        fire(1); // Strength between 0.1 and 3.0

    public void onHitByBullet(HitByBulletEvent e) {
    public void onHitWall(HitWallEvent e) {

Extend either Robot or AdvancedRobot. An AdvancedRobot:

  • Loses energy when bumping into walls.
  • Can have non-blocking calls (setXXX() methods), custom events and FileSystem access.

When you are ready for battle, use: Compiler > Compile (Control + B) in the Source Editor.

In Eclipse

New Project:

  • Libraries > Add External JARs...: Add libs/robocode.jar.
    • External annotations > Edit: Javadoc is bundled with Robocode.
  • Do not create a
  • Add a new Java Class with Superclass: robocode.Robot.

Be sure your final robot is packaged! A * appears ingame next to a robot's name if it is a development version.

Robocode UI

Add the project's bin folder in the Robocode UI:
Options > Preferences > Development Options > Add


Run as > Run configurations > Java Application

  • Main class: robocode.Robocode
  • Arguments > VM arguments: -Xmx512M -Ddebug=true
  • Arguments > Working directory > Other > Robocode install path (ex: c:\robocode)

Do not point to a Robocode directory where the .NET plug-in is also installed!

In Visual Studio

Download the .NET plug-in for Robocode and install in the same directory as Robocode itself!

Create a .NET Framework project and reference libs\robocode.dll. See dotnet-bots for a minimal example.

Robocode UI

Add the bin\Debug folder in the Robocode UI:
Options > Preferences > Development Options > Add



Project > Properties > Debug:

  • Start external program: C:\Program Files\Java\jdk1.8.0_211\bin\java.exe
  • Command line arguments:
-Ddebug=true -Xmx512M -cp libs/robocode.jar;libs/jni4net.j- -XX:+IgnoreUnrecognizedVMOptions "--add-opens=java.base/" "--add-opens=java.base/java.lang.reflect=ALL-UNNAMED" "--add-opens=java.desktop/sun.awt=ALL-UNNAMED" robocode.Robocode
  • Working directory: Where installed (ex: c:\robocode)

Be sure your final robot is a Release build!


More Debugging

Start Robocode UI in debug mode:
java -Ddebug=true -Xmx512M ...
Find the CLI arguments in robocode.bat.

Robot Console

See out.println() (or Console.WriteLine()) in your robot log by clicking on your robot name in the right top battle view pane in the UI. SYSTEM events and crash stack traces will also be printed in the robot console.

You can’t perform that action at this time.