Here's a little guide on how to get started editing and compiling Robocode
bots with NetBeans
. It took me a little while to figure out how to set it up properly, since I was new to NetBeans
, so I hope this helps someone :)
Follow these fairly simple steps:
- First create a new project for your bot. If you have very simple bots (like one file MicroBots) you can use the same project for several bots, but big bots with many source files should have their own project. Select Project->Project manager, then click New and give your project a name.
- Once the project has been created you need to mount the robocode.jar file: right-click on Filesystems, select Mount->Archive files, and browse to your robocode.jar file. It's located in the main Robocode folder.
- Next you need to mount the robots directory. Just like in the previous step, right-click on Filesystems, but then select Mount->Local directory, and select the robots subdirectory in your main Robocode folder.
- Now you need to add the robocode documentation, to get the very useful context-sensitive documentation popups. From the main menu select Tools->Javadoc manager, then click Add folder, and select the javadoc folder in your Robocode directory. You can add the main Java api documentation in the same way, if it's not already in the list.
- Once you have completed the steps above you are ready to start adding files to your project. Click on the 'Project <your project name>'-tab in the column on the left, then right-click the root node, and select either Add new or Add Existing, depeding on whether you want to create a new, empty java file or import a file you created with some other editor.
That should get you started in creating killer bots using NetBeans :)
Misc. tips and tricks:
- Notice that when you for example want to add one of the robocode events to your bot, you can start typing "public void on", and then press Ctrl-Space. This will give you a list of all the available events, and when browsing through the list you will see the documentation for each event. Handy! If it doesn't work you didn't follow the instructions correctly ;)