Question

I'm looking for some direction to learn about hosting other languages from Java. So far I've found things like JSR 223 and the Bean Scripting Framework but my knowledge and experience isn't enough to tell me if these are suitable starting points.

The application is a mud where the game systems are run as services that connect (via a socket) to a JVM-based server.

Ideally I would like my mud to take care of all networking, so I was thinking of writing a small networking module that could load code from any language, or at least a number of popular languages. When someone wanted to write a game module they would take my networking module and package it with their code. On startup my networking module loads their code and talks to my server.

For example a game developer writes a combat program in Lua. I would like my networking program, which connects to my server, to 'host' this Lua code by 'loading' it (somehow). I would prefer not to embed Lua in my Java program (the same goes for Jython, JRuby, etc.) as I seek a more general solution, however I understand if that simply isn't practical.

I'm using this approach so developers can write the game systems in any language.

I've also considered services such as Bridge RPC, but I would prefer a solution not tied to a specific vendor.

Was it helpful?

Solution

Some options:

  • For good performance I'd suggest a binary format: something like Google's Protocol Buffers.
  • For general flexibility and a lot of different language implementations might be worth looking at Apache Thrift
  • It's also plausible to implement your own REST or text-based services. You might consider using JSON as a message format.

OTHER TIPS

Unless you expect your wire protocol be obscenely complex i would suggest that you:

  1. heavily document the wire protocol
  2. provide a simple open source, java-based client-side reference library

thus a client side developer can either use your library in a java program, or write their own version in another language. having the documented protocol and a reference library should be sufficient for any developer to re-implement in the language of their choice.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top