Difference between revisions of "Robocode/Developers Guide for modify Robocode"
m (→UNIX:) |
m (→WINDOWS:) |
||
Line 60: | Line 60: | ||
</pre> | </pre> | ||
− | :example: | + | :'''example''': |
:robocodeDir = C:\robocode | :robocodeDir = C:\robocode | ||
:fileName = RoboRumbleAtHome.java (the main file of roborumble) | :fileName = RoboRumbleAtHome.java (the main file of roborumble) |
Latest revision as of 23:43, 25 February 2009
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
Contents
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 robocode.sh and roborumble.sh (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
- example:
- old roborumble.sh(or roborumble.bat):
java -Xmx512M -Dsun.io.useCanonCaches=false -cp libs/robocode.jar:libs/codesize.jar:libs/roborumble.jar roborumble.RoboRumbleAtHome ./roborumble/roborumble.txt
- new roborumbleMOD.sh(or roborumbleMOD.bat):
java -Xmx512M -Dsun.io.useCanonCaches=false -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 robocode.sh or roborumble.sh (.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
UNIX:
cd fileDir javac -cp robocodeDir/libs/robocode:robocodeDir/libs/roborumble fileName
- example:
- robocodeDir = ~/robocode
- fileName = RoboRumbleAtHome.java (the main file of roborumble)
- fileDir = robocodeDir/libs/roborumble/roborumble
cd ~/robocode/libs/roborumble/roborumble javac -cp ~/robocode/libs/robocode:~/robocode/libs/roborumble RoboRumbleAtHome.java
WINDOWS:
cd fileDir javac -cp robocodeDir\libs\robocode;robocodeDir\libs\roborumble fileName
- example:
- robocodeDir = C:\robocode
- fileName = RoboRumbleAtHome.java (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 RoboRumbleAtHome.java
Launch Robocode
Original version
Simply use the original robocode.sh or roborumble.sh (windows: robocode.bat or roborumble.bat)
MOD version
Simply use the modified robocode.sh or roborumble.sh (windows: robocode.bat or roborumble.bat)