Robocode is a popular Java programming game where you program a small robotic tank to battle against other tanks. It is very easy to get started, and is a great introduction to Java (or programming in general), video games, and robotics.
By completing this activity, you will:
- Develop Java programming skills
- Learn some video game basics
- Explore concepts of robotics
- Build a robot, and compete against others who complete this activity
- Install Java, if necessary. Robocode is written in Java, and uses the Java Runtime Environment (JRE).The Java group has a web page that will test your system to see if Java is installed, and provides installation instructions if needed.
- Download and install Robocode. Visit the Robocode download page, and click on the big "Download Now!" button. When the download begins, your browser may ask whether you want to Open or Save the file; if presented with this choice, select Open, which will start the installation wizard and walk you through the simple Robocode installation. If you select Save, the downloaded file will be saved with a name like robocode-<version-number>-setup.jar. After the file is saved, find it, and either open it (double-click on it), or from your system's command line run java -jar robocode-<version-number>-setup.jar, where you replace <version-number> with the actual version number you see in the filename. This isn't difficult, but if you have any problems, ask for help in the discussion forum for this activity.
- Run Robocode. When your installation completes, it will tell you how to start Robocode (this may be different whether you are running on Windows, Linux, or Mac). Follow the instructions to start up Robocode. Then visit the Robocode/Getting Started page and follow the instructions on the page. This will show you how to select robots for a battle and run the battle.
- Create a simple robot and do battle! Visit Robocode/My First Robot and follow the instructions. This will show you how to create a (very simple) new robot, load it into the game, and select it to participate in a battle. If you already know some Java, or want to experiment a bit, feel free to make additional changes to the robot.
- Package your robot for upload. Visit Robocode/Package Robot and follow the instructions to package up your robot. This packaging of robots is the way you share robots with others so you can battle against each other. This robot package is part of what you will submit to this activity, so keep track of where you save your robot package! The packaging wizard will ask you if you want to include the source code for your robot. This is entirely up to you. When you download a package that includes source, you are able to unpack the source code and view it, which allows you to learn from the robot code. If you want to share what you have created, go ahead and include source code. If you want to protect any secrets you have coded in your robot, you won't want to include source code in your package.
At this point, you have completed the activity. On the activity page, click the Submit button, and upload your robot package. Optionally, you can upload some screenshots of your robot in battle, or the final score window showing your robot's victory over other robots.
If you enjoyed this activity, and want to continue with Robocode, please join the FreshBrain Robocode League group, where you can share tips with other Robocoders, take place in big battles, and achieve glory by being the top FreshBrain Robocoder!