Tank Royale (Robocode) is a programming game where the goal is to code a bot in the form of a tank to compete against other bots in a virtual battle arena. Once the match starts you will have no control over your bot and its performance relies solely on the quality of your implementation.
Robocode is running on the Java Runtime Environment (JRE) and needs Java 11 as a minimum. Run java -version to check your current Java version.
In order for you to participate in the Tank Royale you need to do the following:
- Clone this repository
- Copy and rename the ExampleBot in the tankroyale/competition-bots subdirectory. Note that the new directory as well as all of the files in it should have the exact same name. Make sure to also update the name inside the .sh/.cmd files.
- Modify the values inside the
YourBotName.jsonfile - Create a feature branch for your new bot
- Create a PR to the
mainbranch containing only the files in your bot directory
Read the docs at docs/javadoc/index.html! You should start by exploring the Robot class (your bot is a subclass of this), which contains methods for moving the bot, turning the turret, firing bullets etc.
TIP! Check the source code of some of the sample bots for inspiration if you are stuck.
- Firing your turret drains your own energy (health), as does colliding into walls and other bots
- Avoid calling API methods like
fire()and in general avoid CPU-intensive logic in your event handlers (why? read here) - The event handlers are only required to gain up-to-date information about your bot's information. Consider your event handlers as "sensors" of your bot.
- Tank Royale uses the Cartesian coordinate system, which means that the (0, 0) coordinate is in the bottom-left corner of the arena.
- Tank Royale uses the classic trigonometric functions for angles and directions. Hence, 0°/360° is east, 90° is north, 180° is west, and 270° is south. When turning a bot to the right, the angle moves in the clockwise direction.
- Take a look at the Physics section to learn how movement, rotation, bullets and collisions work
You can test your bot locally by using the GUI application (tankroyale/robocode-tankroyale-gui-0.30.0.jar). A local match can be started by navigating to Battle > Start battle, adding your bot as well as any number of sample bots to the match and then clicking Start Battle (see below screenshot).

