Bridging robocode.control.RobocodeEngine to .NET

55 views
Skip to first unread message

Jason Hyland

unread,
Jul 20, 2010, 11:15:29 AM7/20/10
to robocode-...@googlegroups.com
Hi,

I'm looking at how best to write integration tests for my robots in .NET. I don't see anything in the .NET API, but I have found the robocode.control.RobocodeEngine which appears to do exactly what I need. So, I'm trying to bridge the classes using jni4net.

I guess the correct approach is to extend the bridging code in robocode itself, but I know next to nothing about Java, and I certainly don't feel confident enough yet to go poking around in the source. So, for now, I though it best to play in a safe sandbox :)

My initial approach is to attempt to bridge robocode.jar (from robocode\libs), which I believe contains the classes I need. Using jni4net 0.0.0.8 I run

c:\robocode\libs\proxygen robocode.jar -wd work

this creates a work directory and pumps out

jni4net.proxygen - Copyright (C) 2009 Pavel Savara - licensed under GPLv3
will generate CLR net.sf.robocode.core.imodule
will generate CLR net.sf.robocode.api.module
will generate CLR net.sf.robocode.battle.ibattlemanagerbase
will generate CLR net.sf.robocode.core.containerbase
will generate CLR net.sf.robocode.gui.iwindowmanagerbase
will generate CLR net.sf.robocode.io.fileutil
will generate CLR net.sf.robocode.io.logger
will generate CLR net.sf.robocode.manager.iversionmanagerbase
will generate CLR net.sf.robocode.peer.irobotstatics
will generate CLR net.sf.robocode.repository.irepositorymanagerbase
will generate CLR net.sf.robocode.security.hiddenaccess
will generate CLR net.sf.robocode.security.ihiddenbullethelper
will generate CLR net.sf.robocode.security.ihiddeneventhelper
will generate CLR net.sf.robocode.security.ihiddenruleshelper
will generate CLR net.sf.robocode.security.ihiddenspecificationhelper
will generate CLR net.sf.robocode.security.ihiddenstatushelper
will generate CLR net.sf.robocode.security.ithreadmanagerbase
will generate CLR net.sf.robocode.security.safecomponent
will generate CLR net.sf.robocode.serialization.iserializablehelper
will generate CLR net.sf.robocode.serialization.rbserializer
will generate CLR robocode.robotinterfaces.ibasicrobot
will generate CLR robocode._robotbase
will generate CLR robocode._robot
will generate CLR robocode.robotinterfaces.iinteractiverobot
will generate CLR robocode.robotinterfaces.ipaintrobot
will generate CLR robocode.robotinterfaces.ibasicevents
will generate CLR robocode.robotinterfaces.ibasicevents2
will generate CLR robocode.robotinterfaces.ibasicevents3
will generate CLR robocode.robotinterfaces.iinteractiveevents
will generate CLR robocode.robotinterfaces.ipaintevents
will generate CLR robocode.robot
will generate CLR robocode._advancedrobot
will generate CLR robocode._advancedradiansrobot
will generate CLR robocode.robotinterfaces.iadvancedrobot
will generate CLR robocode.robotinterfaces.iadvancedevents
will generate CLR robocode.advancedrobot
will generate CLR robocode.event
will generate CLR robocode.battleendedevent
will generate CLR robocode.battleresults
will generate CLR robocode.battlerules
will generate CLR robocode.bullet
will generate CLR robocode.bullethitbulletevent
will generate CLR robocode.bullethitevent
will generate CLR robocode.bulletmissedevent
will generate CLR robocode.condition
will generate CLR robocode.control.battlefieldspecification
will generate CLR robocode.control.battlespecification
will generate CLR robocode.control.events.ibattlelistener
will generate CLR robocode.control.events.battleadaptor
will generate CLR robocode.control.events.battleevent
will generate CLR robocode.control.events.battlecompletedevent
will generate CLR robocode.control.events.battleerrorevent
will generate CLR robocode.control.events.battlefinishedevent
will generate CLR robocode.control.events.battlemessageevent
will generate CLR robocode.control.events.battlepausedevent
will generate CLR robocode.control.events.battleresumedevent
will generate CLR robocode.control.events.battlestartedevent
will generate CLR robocode.control.events.roundendedevent
will generate CLR robocode.control.events.roundstartedevent
will generate CLR robocode.control.events.turnendedevent
will generate CLR robocode.control.events.turnstartedevent
will generate CLR robocode.control.irobocodeengine
will generate CLR robocode.control.randomfactory
will generate CLR robocode.control.robocodeengine
will generate CLR robocode.control.robocodelistener
will generate CLR robocode.control.robotresults
will generate CLR robocode.control.robotspecification
will generate CLR robocode.control.snapshot.bulletstate
will generate CLR robocode.control.snapshot.ibulletsnapshot
will generate CLR robocode.control.snapshot.idebugproperty
will generate CLR robocode.control.snapshot.irobotsnapshot
will generate CLR robocode.control.snapshot.iscoresnapshot
will generate CLR robocode.control.snapshot.iturnsnapshot
will generate CLR robocode.control.snapshot.robotstate
will generate CLR robocode.customevent
will generate CLR robocode.deathevent
will generate CLR robocode.droid
will generate CLR robocode.exception.abortedexception
will generate CLR robocode.exception.deathexception
will generate CLR robocode.exception.disabledexception
will generate CLR robocode.exception.eventinterruptedexception
will generate CLR robocode.exception.robotexception
will generate CLR robocode.exception.winexception
will generate CLR robocode.gunturncompletecondition
will generate CLR robocode.hitbybulletevent
will generate CLR robocode.hitrobotevent
will generate CLR robocode.hitwallevent
will generate CLR robocode.robotinterfaces.ijuniorrobot
will generate CLR robocode.juniorrobot
will generate CLR robocode.keyevent
will generate CLR robocode.keypressedevent
will generate CLR robocode.keyreleasedevent
will generate CLR robocode.keytypedevent
will generate CLR robocode.messageevent
will generate CLR robocode.mouseevent
will generate CLR robocode.mouseclickedevent
will generate CLR robocode.mousedraggedevent
will generate CLR robocode.mouseenteredevent
will generate CLR robocode.mouseexitedevent
will generate CLR robocode.mousemovedevent
will generate CLR robocode.mousepressedevent
will generate CLR robocode.mousereleasedevent
will generate CLR robocode.mousewheelmovedevent
will generate CLR robocode.movecompletecondition
will generate CLR robocode.paintevent
will generate CLR robocode.radarturncompletecondition
will generate CLR robocode.robotinterfaces.iteamrobot
will generate CLR robocode.robotinterfaces.iteamevents
will generate CLR robocode.teamrobot
will generate CLR robocode.ratecontrolrobot
will generate CLR robocode.robocode
will generate CLR robocode.robocodefileoutputstream
will generate CLR robocode.robocodefilewriter
will generate CLR robocode.robotdeathevent
will generate CLR robocode.robotinterfaces.peer.ibasicrobotpeer
will generate CLR robocode.robotinterfaces.peer.istandardrobotpeer
will generate CLR robocode.robotinterfaces.peer.iadvancedrobotpeer
will generate CLR robocode.robotinterfaces.peer.ijuniorrobotpeer
will generate CLR robocode.robotinterfaces.peer.iteamrobotpeer
will generate CLR robocode.robotstatus
will generate CLR robocode.roundendedevent
will generate CLR robocode.rules
will generate CLR robocode.scannedrobotevent
will generate CLR robocode.skippedturnevent
will generate CLR robocode.statusevent
will generate CLR robocode.turncompletecondition
will generate CLR robocode.util.utils
will generate CLR robocode.winevent
proxygen done

I then cd to the work directory and run the build.cmd and get the following error

jvm\robocode/control/snapshot\IScoreSnapshot_.java:30: robocode.control.snapshot.__IScoreSnapshot is not abstract and does not override abstract metho
d compareTo(robocode.control.snapshot.IScoreSnapshot) in java.lang.Comparable
class __IScoreSnapshot extends system.Object implements robocode.control.snapshot.IScoreSnapshot {
^
Note: jvm\robocode/control\RobocodeListener_.java uses or overrides a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: Some input files use unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
1 error

I looked at the source under plugin\dotnet and looked at the robocode.proxygen.xml and became even more confused! A pointer in the right direction would be appreciated!

--
Regards, Jason

Pavel Šavara

unread,
Jul 20, 2010, 4:23:39 PM7/20/10
to robocode-...@googlegroups.com
Hi Jason,

I experimented with the same thing last night as well. I got have it
up & running, but I spent whole night on it and I know what I'm doing.
So I realized that it was bit unfair to throw you into that with bare
hands.

Please see and comment on this
http://code.google.com/p/robocode/source/detail?r=3482

Download preview is there, Alpha quality.
http://robocode.sourceforge.net/download/robocode-1.7.2.2-Alpha-setup.jar
http://robocode.sourceforge.net/download/robocode.dotnet-1.7.2.2-Alpha-setup.jar

It contains upgraded jni4net with support for CLR 4.0
And I drafted first F# robot as well.

Hi Flemming,

I hope you don't mind I jumped into your 1.7.2.2 branch with this all.
Should be zero impact for Java-only users.

Cheers
Pavel

fnl

unread,
Jul 23, 2010, 3:48:15 PM7/23/10
to robocode-developers
Hi guys,

I am very happy that Robocode is now upgraded to CLR 4.0 and we are
able to support F# (a very cool language, that I think is excellent
for robot modelling).
And it is perfect that it has been put in 1.7.2.2 (future release) as
I am working on stabilizing 1.7.2.1 (fixing found bugs) before the
final release.

Pavel: I haven't reviewed your changes yet, but will look at it later
(when I have handled all my mails that have stacked up during my
vacation in Spain).
But I am very confident with your changes. :-)

Cheers,
- Flemming

On Jul 20, 10:23 pm, Pavel Šavara <pavel.sav...@gmail.com> wrote:
> Hi Jason,
>
> I experimented with the same thing last night as well. I got have it
> up & running, but I spent whole night on it and I know what I'm doing.
> So I realized that it was bit unfair to throw you into that with bare
> hands.
>
> Please see and comment on thishttp://code.google.com/p/robocode/source/detail?r=3482
>
> Download preview is there, Alpha quality.http://robocode.sourceforge.net/download/robocode-1.7.2.2-Alpha-setup...http://robocode.sourceforge.net/download/robocode.dotnet-1.7.2.2-Alph...
Reply all
Reply to author
Forward
0 new messages