Menu

Robot DLL makes robocode unable to list any robots at all.

Help
2017-05-06
2017-05-06
  • Torstein Alvern

    Torstein Alvern - 2017-05-06

    I'm making a program that generates robot dll's for use in robocode, but when I add the path to the folder where the .dll is located and go to "New Battle", not a single robot gets listed. Apart from that, the robocode GUI works just fine. If I remove the path, they show back up again.
    Also, if I have the path listed and restart robocode, it won't load. It'll stay in the loading screen indefinitely loading that DLL.

    This is robots written in C#, and uses the newest released DotNet version of robocode.

    I assume there's something wrong with my .dll, but I don't have the faintest clue where I'd go to error search.

    Stack Trace when unsuccessfully loading robocode:

    C:\robocode>java -Xmx512M -cp libs/robocode.jar;libs/jni4net.j-0.8.7.0.jar robocode.Robocode
    Loaded net.sf.robocode.api
    Loaded net.sf.robocode.core
    Loading plugins from C:\robocode\libs
    Loaded net.sf.robocode.battle
    Loaded net.sf.robocode.dotnet.host
    Loaded net.sf.robocode.host
    Loaded net.sf.robocode.repository
    Loaded net.sf.robocode.sound
    Loaded net.sf.robocode.ui
    Loaded net.sf.robocode.ui.editor
    Reading robot database
    java.net.MalformedURLException: no protocol:
    at java.net.URL.<init>(Unknown Source)
    at java.net.URL.<init>(Unknown Source)
    at java.net.URL.<init>(Unknown Source)
    at net.sf.robocode.dotnet.repository.root.DllRoot.createItem(DllRoot.java:89)
    at net.sf.robocode.dotnet.repository.root.DllRoot.visitItems(DllRoot.java:83)
    at net.sf.robocode.dotnet.repository.root.DllRoot.updateItems(DllRoot.java:72)
    at net.sf.robocode.dotnet.repository.root.handlers.DllHandler.visitDirectory(DllHandler.java:57)
    at net.sf.robocode.repository.root.handlers.RootHandler.visitDirectories(RootHandler.java:35)
    at net.sf.robocode.repository.RepositoryManager.update(RepositoryManager.java:112)
    at net.sf.robocode.repository.RepositoryManager.refresh(RepositoryManager.java:91)
    at net.sf.robocode.repository.RepositoryManager.reload(RepositoryManager.java:178)
    at net.sf.robocode.ui.WindowManager.showSplashScreen(WindowManager.java:355)
    at net.sf.robocode.core.RobocodeMain.run(RobocodeMain.java:129)
    at java.lang.Thread.run(Unknown Source)</init></init></init>

    java.net.MalformedURLException: no protocol:
    at java.net.URL.<init>(Unknown Source)
    at java.net.URL.<init>(Unknown Source)
    at java.net.URL.<init>(Unknown Source)
    at net.sf.robocode.dotnet.repository.root.DllRoot.createItem(DllRoot.java:89)
    at net.sf.robocode.dotnet.repository.root.DllRoot.visitItems(DllRoot.java:83)
    at net.sf.robocode.dotnet.repository.root.DllRoot.updateItems(DllRoot.java:72)
    at net.sf.robocode.dotnet.repository.root.handlers.DllHandler.visitDirectory(DllHandler.java:57)
    at net.sf.robocode.repository.root.handlers.RootHandler.visitDirectories(RootHandler.java:35)
    at net.sf.robocode.repository.RepositoryManager.update(RepositoryManager.java:112)
    at net.sf.robocode.repository.RepositoryManager.refresh(RepositoryManager.java:91)
    at net.sf.robocode.repository.RepositoryManager.reload(RepositoryManager.java:178)
    at net.sf.robocode.ui.WindowManager.showSplashScreen(WindowManager.java:355)
    at net.sf.robocode.core.RobocodeMain.run(RobocodeMain.java:129)
    at java.lang.Thread.run(Unknown Source)</init></init></init>

    java.net.MalformedURLException: no protocol:
    at java.net.URL.<init>(Unknown Source)
    at java.net.URL.<init>(Unknown Source)
    at java.net.URL.<init>(Unknown Source)
    at net.sf.robocode.dotnet.repository.root.DllRoot.createItem(DllRoot.java:89)
    at net.sf.robocode.dotnet.repository.root.DllRoot.visitItems(DllRoot.java:83)
    at net.sf.robocode.dotnet.repository.root.DllRoot.updateItems(DllRoot.java:72)
    at net.sf.robocode.dotnet.repository.root.handlers.DllHandler.visitDirectory(DllHandler.java:57)
    at net.sf.robocode.repository.root.handlers.RootHandler.visitDirectories(RootHandler.java:35)
    at net.sf.robocode.repository.RepositoryManager.update(RepositoryManager.java:112)
    at net.sf.robocode.repository.RepositoryManager.refresh(RepositoryManager.java:91)
    at net.sf.robocode.repository.RepositoryManager.reload(RepositoryManager.java:178)
    at net.sf.robocode.ui.WindowManager.showSplashScreen(WindowManager.java:355)
    at net.sf.robocode.core.RobocodeMain.run(RobocodeMain.java:129)
    at java.lang.Thread.run(Unknown Source)</init></init></init>

    at System.Reflection.RuntimeModule.GetTypes(RuntimeModule module)
    at System.Reflection.Assembly.GetTypes()
    at net.sf.robocode.dotnet.host.seed.AppDomainSeed.FindRobots()
    System.Reflection.ReflectionTypeLoadException: Unable to load one or more of the requested types. Retrieve the LoaderExceptions property for more information.
    at System.Reflection.RuntimeModule.GetTypes(RuntimeModule module)
    at System.Reflection.Assembly.GetTypes()
    at net.sf.robocode.dotnet.host.seed.AppDomainSeed.FindRobots()
    at System.AppDomain.DoCallBack(CrossAppDomainDelegate callBackDelegate)
    at net.sf.robocode.dotnet.host.seed.AppDomainShell.FindRobots()
    at net.sf.robocode.dotnet.repository.root.DllRootHelper.findItems(String dllPath)
    at net.sf.robocode.dotnet.repository.root.__DllRootHelper.findItems2(IntPtr __envp, JniLocalHandle __class, JniLocalHandle dllPath)
    at net.sf.robocode.dotnet.repository.root.DllRootHelper.findItems(Native Method)
    at net.sf.robocode.dotnet.repository.root.DllRoot.visitItems(DllRoot.java:80)
    at net.sf.robocode.dotnet.repository.root.DllRoot.updateItems(DllRoot.java:72)
    at net.sf.robocode.dotnet.repository.root.handlers.DllHandler.visitDirectory(DllHandler.java:57)
    at net.sf.robocode.repository.root.handlers.RootHandler.visitDirectories(RootHandler.java:35)
    at net.sf.robocode.repository.RepositoryManager.update(RepositoryManager.java:112)
    at net.sf.robocode.repository.RepositoryManager.refresh(RepositoryManager.java:91)
    at net.sf.robocode.repository.RepositoryManager.reload(RepositoryManager.java:178)
    at net.sf.robocode.ui.WindowManager.showSplashScreen(WindowManager.java:355)
    at net.sf.robocode.core.RobocodeMain.run(RobocodeMain.java:129)
    at java.lang.Thread.run(Unknown Source)

     
  • Torstein Alvern

    Torstein Alvern - 2017-05-06

    We have an earlier version of the project that does create MyFirstRobots and successfully runs them.

     
  • Flemming N. Larsen

    Does it help if you clean the robot cache. That is select Options -> Clean robot cache.
    I'm not sure, if this will work. But you can try it out.

    Otherwise. Try a divide-and-conquer by first creating as simple .dll files as possible with no logic. Check if those .dll files shows up in Robocode. If so, add more logic to the .dll.
    I have no idea, what causes the problem with the .dll in your case.

     
  • Torstein Alvern

    Torstein Alvern - 2017-05-08

    I'm assuming our problem stems from the fact that our robot is trying to reference separate .dll files that we have made alongside the robot. When looking at the robot .dll with Jetbrains DotPeek, everything seems just fine, but the .dll we made ourselves comes without a public key, which we assume could lead to trouble loading these .dll files.

    Implementing a basic MyFirstRobot has worked just fine, which supports this idea. I guess I'll continue to divide-and-conquer

     

Log in to post a comment.