- Fork this repo (or clone it and create a branch)
- Install Java v17 (may have issues with a newer version of Java)
- Download the Robocode Setup JAR from sourceforge.net/projects/robocode/
- Run the Robocode Setup jar:
java -jar ./robocode-1.9.5.4-setup.jar - Install Maven:
- MacOS:
brew install maven - Linux: Use your package manager. i.e.
apt install maven - Not sure about Windows
- Run Robocode:
~/robocode/robocode.sh(or equivalent in other OSes) - Run
./build.sh
- Should create
target/*
- In the Robocode menus:
- Select
Options -> Preferences - Go to the
Development Optionstab - Click the
Addbutton and add[callibrity-robocode]/target/classesto the list of paths
You should now be able to create new bots in [callibrity-robocode]/src/main/java/robots/[whatever], and after running ./build.sh you can add those bots to a battle (using Battle -> New in Robocode).
Robots should be in the robots package, but you can create sub-packages for your bots (i.e. robots.callibrityBot). (This is a requirement of the Maven build.)
There are many sample bots available, and the Robocode Wiki has a lot of other information about the types of bots you can create and how to code them.
You may use the sample bots as a base for any bots you want to create, and you can use the wiki and publicly-available bots for inspiration. However, to keep this fun and competitive, please only enter your own, original creations in the Callibrity Battles.
Package your bot(s) by using the Robot -> Package Robot or Team option within the Robocode interface. This will create a .jar file that you can send to me (Aaron Tyler) on Slack or Email.
The RoboWiki provides all the information needed to get started.
Robots are written in Java, but the docs mention the ability to write bots in .NET as well. Feel free to try that if you'd like, but if additional setup is needed to execute .NET bots, please give me a heads-up so I can try to get it working before the Callibrity Battles.
- All bots should be your own creation, from the ground up! DO NOT USE SOMEONE ELSE'S BOT AS A STARTER BOT!
- You CAN use the SAMPLE bots as starter bots
- You CAN use strategies found in tutorials, the RoboWiki, and other bots, but don't pull code from other bots
- Don't use AI to generate your bot's code
- You may enter as many bots as you want. All of your bots should be in the same package.
- THIS IS NOT A TEAM BATTLE. Your bots should be independent bots, and not coded to work together in any way. You bot should not have any knowledge of your other bots. (i.e., you can't code your bot to only fire at bots that aren't yours.)
- If using this maven script, it says to put your robots in the
robotspackage. You can createrobots.myBotPackagefor your bots. - When packaging your bot, you must include the source code. This allows others to learn and improve, and allows for enforcement of the rules.
- The bots will be shared with everyone on the Slack channel after each battle to keep up the competition.
- All bots will be added to a 1000x1000 battlefield
- Battlefield Size may be increased if we end up with lots of bots
- All other options for the battle will be the default options:
- Number of Rounds: 10
- Gun Cooling Rate: 0.1
- Inactivity Time: 450
- Sentry Border Size: 100
This repo was created from fernandrone's repo here: https://github.com/fernandrone/robocode-maven
The original README.md file is below. You can try to get it working with the linked Docker container, but I couldn't get it working on MacOS. If you get it working, please share with the rest of us!
A framework for easy development and sharing of Robocode robots, setup as a Maven project and adapted to work with the containerized Robocode-docker.
To build the project you'll require maven and to run Robocode-docker you'll need docker.
- Clone Robocode-maven where you want it installed. A good place to pick is
$HOME/robocode(but you can install it somewhere else).
$ git clone https://github.com/fbcbarbosa/robocode-maven.git ~/robocode
- Define the environment variable
ROBO_ROOTto point to the path where the repo is cloned and add$ROBO_ROOTto yourPATH:
$ echo 'export ROBO_ROOT="$HOME/robocode"' >> ~/.bashrc
$ echo 'export PATH="$ROBO_ROOT:$PATH"' >> ~/.bashrc
- Restart your shell so the path changes take effect.
$ exec $SHELL
- Build the project one time using Maven. It will download all the required packages once, including the Robocode API, so be a little patient.
$ cd $ROBO_ROOT && mvn clean install
- Run 'robo' script to launch Robocode-docker. The first time may take a while as it downloads the 'fbcbarbosa/robocode' image.
$ robo
And that's it!
Note: if done properly, the sample robot
robots.first.MyFirstRobotshould be available. Otherwise, go through the installation steps again carefuly, either the maven build failed or you have set an environment variable incorrectly.
Simply add the installation folder to your favorite IDE as a Maven Project!
Make sure that every new robot you develop is added under the robots package, within the $ROBO_ROOT/src/main/java/robots folder (their .class files will then be under $ROBO_ROOT/target/classes/robots, which is where Robocode reads them from). Feel free to add subpackages, e.g. robots.mybots at $ROBO_ROOT/src/main/java/robots/mybots.
To build your robots run Maven on the root of the installation folder:
$ cd $ROBO_ROOT && mvn clean install
They will become instantly available on Robocode under the robots.* package (you might have to refresh the robot list in the New Battle view with CTRL+R)
Note: you can use Robocode's functional, yet limited, IDE to develop your robots, even as it's running on a container. However it will be hard to retrieve them at the host machine later, so it's not recommended. Besides, if you're ok using Robocode's IDE, why'd you download this framework?
Don't forget to commit your robots on a public GitHub repository so that everyone can learn from them :)