Robocode/Developers Guide for modify Robocode

From RoboWiki
Jump to: navigation, search

This guide show you how to modify some parts or all of your robocode without need of reinstall it. You can choose if run the original or the MOD version


Developer's Guide for building Robocode

Software Requirements

  • Sun's Java SE JDK (5.0 or >) or alternatives
  • Robocode installed (same version as source)
  • Robocode source (same version as installer)
  • Text editor

Install the java SDK (JRE is not enough), then install robocode. As text editor you can simply use block notes, gedit, ecc.. You surely have installed one basic text editor in your operative system.

Create MOD launch file

We want create a mod but we don't want break the original robocode, so here the solution:

  • open home folder of robocode (the installation directory)
  • create a copy of and (robocode.bat and roborumble.bat in windows), this will be your mod runner
  • open the copy and delete ".jar" in the -cp option for roborumble and robocode
old roborumble.bat):
java -Xmx512M -cp libs/robocode.jar:libs/codesize.jar:libs/roborumble.jar roborumble.RoboRumbleAtHome ./roborumble/roborumble.txt
new roborumbleMOD.bat):
java -Xmx512M -cp libs/robocode:libs/codesize.jar:libs/roborumble roborumble.RoboRumbleAtHome ./roborumble/roborumble.txt
  • now open folder "libs" and extract robocode.jar and roborumble.jar (Warnig: prevent path error using "extract here" option), if necessary set this folder's permission as read/write for your user
  • try the modified version of or (.bat for windows): everything should work normally

Modifing source code

If the MOD launch file is working is time for modify your robocode version.

  • extract roborumble source code where you want
  • find the source file you want modify
  • copy it under the extracted folder "libs" in the right location indicated by file's package(tip: if you are in the right directory you will find a .class file with the same name as your .java)
  • modify your source code
  • if your MOD works send your code at patch tracker and if it's good enough will be implemented in the next version of robocode

tip: is better import only the source code of the file you want modify and not all, so you know where you have changed something

Compiling Robocode's code

I assume:

robocodeDir is the directory where you intalled robocode

fileName is the name of the file you want compile

fileDir it's the directory of the file you want compile


cd fileDir
javac -cp robocodeDir/libs/robocode:robocodeDir/libs/roborumble fileName
robocodeDir = ~/robocode
fileName = (the main file of roborumble)
fileDir = robocodeDir/libs/roborumble/roborumble
cd ~/robocode/libs/roborumble/roborumble
javac -cp ~/robocode/libs/robocode:~/robocode/libs/roborumble


cd fileDir
javac -cp robocodeDir\libs\robocode;robocodeDir\libs\roborumble fileName
robocodeDir = C:\robocode
fileName = (the main file of roborumble)
fileDir = robocodeDir\libs\roborumble\roborumble
cd C:\robocode\libs\roborumble\roborumble
javac -cp C:\robocode\libs\robocode;C:\robocode\libs\roborumble

Launch Robocode

Original version

Simply use the original or (windows: robocode.bat or roborumble.bat)

MOD version

Simply use the modified or (windows: robocode.bat or roborumble.bat)

Personal tools