Nice to hear from you again. I think most of us have been on summer
vacation, at least I have. So we have not been so productive on Robocode as
we are when we are not on vacation. I know I can only speak for myself. :-)
Your solution/idea with using the Extension API sounds like the right
solution to me. I should love to see the code for it, so perhaps you include
this in your next 0.5 release?
I don't see any problems with using the robocode.repository like you
suggest, but I think Pavel is better at judging this part, as he rewrote big
parts of this recently in order to speed up the robot class loading etc.
(nice speedup Pavel, by the way! ;-)
Do you miss any information from us? I am sorry that I did not write about
how all the scorings are computed for the existing version of Robocode. At
that time, there were several issues/bugs in Robocode, which are solved now,
and which I have merged into your branch.
Currently, I am working on fixing issues for the coming version 1.7.1.4
Beta, and some issues seen with the RoboWiki community with the new robot
movement (updateMovement() and getNextVelocity() in RobotPeer), which needs
to be adjusted one more time. After that, I plan to get back to work with
the obstacle/object detection with the radar etc. for the custom
battlefields, and I want to see if I can implement the R+ algorithm + your
"painters algorithm" like you explained - unless you still want to do it?
Best regards,
- Flemming
-----Oprindelig meddelelse-----
Fra: robocode-...@googlegroups.com
[mailto:robocode-...@googlegroups.com] På vegne af Joshua Galecki
Sendt: 3. august 2009 22:59
Til: robocode-developers
Emne: [robocode-developers] Seperation of the extensions
Yes, the classes should be registered with PicoContainer. You should decide
if the individual class must be instantiated from cache (singleton) or if a
new instance must be created each time you need return an instance using the
factory method. Remember that you should use interfaces everywhere possible
instead of a specific class (of course there are exceptions to this rule).
PicoContainer will create a concrete (actually inject) an instanced object
everywhere where you use the interfaces declared on our static body in the
Module.java file (there is one per project/module). But as I read your mail,
I am confident that you are on the right track here. :-)
Regarding the class loading. Again you are on the right track. However, I am
not sure how to add extension jars to the classpath as I have not tried out
this myself yet. Did you use the addURL() (to your class path) on the
EngineClassLoader instance? If not, this might be the reason why you cannot
"see" the classes from the class loader.
Best,
- Flemming
-----Oprindelig meddelelse-----
Fra: robocode-...@googlegroups.com
[mailto:robocode-...@googlegroups.com] På vegne af Joshua Galecki
Sendt: 5. august 2009 22:44
Til: robocode-developers
Emne: [robocode-developers] Re: Seperation of the extensions
sorry about the delay, I was busy recently.
> I have a jar file with all the extension classes in it, but I'm having
> trouble loading from the jar.
For more info look at
net.sf.robocode.core.Container class
loadFromPath(), loadJars(),
look at system property robocode.class.path
Or even deeper
net.sf.robocode.security.HiddenAccess
getClassLoader()
createClassLoader()
It seems that I load robocode.core+pico+robocode.jar into system classloader.
Then I enumerate rest of jar files in lib directory and create
robocode.class.path from them.
Then I call Container in core, which creates EngineClassLoader, which
uses robocode.class.path.
So, the rule is to have your .jar in correct directory and then it
will be accessible in engine classloader.
But not in class loader of any robot. Which is maybe your problem.
If yes, please let me know. I do have already solution for that in my
.NET branch, so I can merge it.
It's new mechanism of registering exceptions to visibility rules for
classloaders and propagating the class to common system classloader
which is parent of both engine and robot's classloader. Therefore the
class is then visible to both spaces.
But before we get too far with that, it would be extension of Robot
API. Is there more than onObjectScanned() interface now ?
My understanding was that you will extend robocode.jar which is in
robot classloader all the time.
Cheers
Pavel
Nice to have another version committed. I haven't try it yet, but I
wonder why don't you have CTFBot in project robocode.sample?
Best,
- Nat
2009/8/12 Pavel Šavara <pavel....@gmail.com>:
sounds like you are real expert on Robocode engine now :-D
Good work, thanks a lot!
Only comment I have now, without looking at code yet, is that I
expected that we will create one general API and include it into
robocode.jar as part of Robot API. You rather propose that each
extension vendor will distribute his own library with robocode and
that robots will be now compiled with more than one library.
I'm not sure why I don't like it, but have mixed feelings about that.
It sounds to me as path to anarchy, where lot of people will create
lot of extensions and break APIs often. This will kill ground for
competition and stability. Probably they will start implement
cheatable rules and undermine security by bad design of extensions.
Maybe that just me. What all people around think ? Should we retain
strict control over Robot API or we should be more open ?
Guys, please elaborate, this is key question.
Thanks
Pavel
I have not looked into all the details yet, and I really look forward to review the code in depth. I hope I will be able to do this in the end of the weekend. :-)
At first when I read about the extension, I thought why not, this would be a good idea. But when Pavel's is bringing up the issues about security (making harm to the users system), cheating (through the robots) and also stability, I am really getting worried about this feature. As it is now, we already fight with stability, but here we are in total control of developing on every part of Robocode. If we allow extensions, we should ensure that the security cannot be compromised, and also make sure that cheating is not possible. Regarding stability, we'll never be able to guarantee this when somebody is responsible for his/her extension. Perhaps we could "just" put a disclaimer on this part. But the security might be very challenging, unless we make sure that the extension will be ruled by the RobocodeSecurityEngine, and extend it everywhere where we find holes. I also expect that we need more intelligent class loading that will filter out bad code, if it is detected. Perhaps all this is possible, but we need to do a lot of hacking attempts etc. to test that the security is preserved.
I will return with review comment, when I have had a good look at the source code.
- Flemming
-----Oprindelig meddelelse-----
Fra: robocode-...@googlegroups.com [mailto:robocode-...@googlegroups.com] På vegne af Pavel Šavara
Sendt: 14. august 2009 22:03
Til: robocode-...@googlegroups.com
Emne: [robocode-developers] Re: Seperation of the extensions
I agree with you regarding how you want the robjects as a part of the
Robocode API etc.
Regarding security, the extensions are running inside Robocode, which is the
one defining the SecurityManager for the whole JavaVM instance/process.
Hence, the extensions will automatically have to obey the policies and
restrictions we have in our RobocodeSecurityManager. However, we need to
make sure to find all (new) security holes that we can possible find. We
should do this when testing the extensionAPI.
Hmm.. so whould we have ClassicRobocode as an extension? Then I understand
your idea in the code with letting ClassicRules inherit from CustomRules.
Sorry that I did not get that. I wanted the ClassicRules as build-in rules
in Robocode, but actually it might be better to provide this in an
independent module/extension, which the users can remove if he/she don't
want it. :-)
I also like your idea of requiring extension to be open-source. At least we
should recommend this, and then let it up to the user if he/she will risk to
use it.
So in general, I agree with you. :-)
Best,
- Flemming
-----Oprindelig meddelelse-----
Fra: robocode-...@googlegroups.com
[mailto:robocode-...@googlegroups.com] På vegne af Joshua Galecki
Sendt: 15. august 2009 18:09
Til: robocode-developers
Emne: [robocode-developers] Re: Seperation of the extensions
But I can see why you ask for that. For example ICaptureTheFlagApi
contains isOwnFlagAtBase() method.
My proposal is to expose new general way how to query battlefield
state without necessity of very specific API.
It could be simple name-value collection. Something like
String getBattleFieldState(String key)
Which could be used this way
getBattleFieldState(isOwnFlagAtBase).equals("true")
Then in robots land, people could implement libraries to wrap that for
specific rules. I.e. CaptureTheFlagApi wrapper.
This will give us generic API for robocode, which trusted data
transmision, but keep the opportunity to extend.
By trusted transmission I mean the way how exec commands and exec
results are used.
Pavel
I introduced ExecCommands and ExecResults as safe communication
between robot and battle. (ver 1.6.2)
ExecCommands are coming from robot to battle. ExecResults contains
state of battle field and all events for robot.
They are immutable as soon as they leave sender. Exchange is done
using interloacked primitives, so it's really fast.
It brings
- security -> no shared object to block(synchronize) on
- better synchronization -> speed, up to 9k tps.
- serlizability -> .NET robots, robots over network
Please do _not_ communicate with robot by any other way, it's really
internal API between battle and robot.
If you need to pass state of flag for example, you make ExecResults
extensible and the use that as one way ship to send it to robot.
After you send something to robot, you should not change or access it
from battle thread.
Easier way how to imagine what I'm saying is this: let's have each
robot on different machine and battle class as well. Then all you
could do is to send messages. In order to do that the messages must
serialize and deserialize. See serialize() and deserialize() methods.
The extension of ExecCommands could be simillar to DebugProperties
which are there already.
Same for extension of ExecResults.
I think I use List because it's better serializable than dictionary,
but not sure now.
Then in robot space, you could expand it into hash for fast access, if
you feel that necessary.
> Regarding security, I've already been able to use basic FIle IO to the
> robocode directory within my extension. Is this supposed to be
> allowable?
In extension of robocode yes. Because it's considered trusted code.
In robot which is using extension, no.