Opinion Projects

Robot Overlord: A puzzle in Java

Robot Overlord Java app contains lots and lots of classes, some of which are robots and their gui.

I want robot developers to have an easy time adding their robots to RO. A simple interface, minimal distraction, and examples to work from are Good Things. I’m told that RO can use a Service Provider Interface (SPI) to load a jar it’s never seen before, a jar that contains an implementation of the interface. I would then

  • make a RobotInterface,
  • make every robot I’ve already got use that interface
  • move each robot to a separate jar and load said jars through SPI
  • make a separate github project for each robot
  • advertise these plugins via tutorials so that you can fork a repo, adjust to taste, and publish your new thing.

What I’m discovering is that SPI is tricky tricky.

  • I can’t find any online examples where someone has done this successfully.
  • I have not yet got RO to load my first robot’s jar file, tho I’m trying. Is the jar packaged wrong? Maybe it doesn’t say “yes, I have that interface!” in the right way.
  • Is RO not even seeing the jar? I’m told SPI looks for any jar on the classpath. I printed out the classpath, then put the robot jar in one of those classpath folders and ran the app again. Nothing.

There are several possible points of failure, none of which can be clearly eliminated as possibilities. Worse, I’m not sure how these plugins would be debugged. Running RO would not give a lot of insight into the plugins’ inner workings. Would I still be able to tweak code in real time? That is a must.

So I ask you, dear reader: am I way off track? What do?

I should note here that I do not want to have to run RO from the command line with a custom classpath. While I’m able to do it, I doubt that the people who buy robots and use them will even know how to open a command line. Imagine a grade school teacher trying to set up for their students, or your aged mother who’s used to OSX. It ain’t happening. You don’t want that tech support phone call and neither do I.