Using SpiderMonkey with non-Java Servers or Clients

Hello everyone,

I’m currently evaluating jME for a game idea I have, that includes massive multiplayer gameplay. I just had a look into SpiderMonkey and so far it look pretty good and easy to use.

The only problem right now is the definition of the protocol. In SpiderMonkey all the messages will be represented by serializable classes derived from AbstractMessage which is nice as long as both sides, the server and the client, are written in Java. For my use case the server should not be written in Java.

Now two approaches came into my mind:
The first one is to integrate a custom, externally defined, protocol into SpiderMonkey and have them handled like normal messages.
The second approach would be to “mimic” the message structure on the server side so that SpiderMonkey recognizes them as serialized SpiderMonkey classes. (Is there a documentation about the serialization, or does it use the standard java serialization method?)

Beside that the last, and not very sophisticated, approach would just use the java nio api for communication.

What do you guys think is the best way to handle this issue?

Thanks a lot :slight_smile:

Spidermonkey does internally use nio for communication. Spidermonkey uses a very lean serialisation, as the default java one is pretty bloated. If you do the server in some language with low level capability it might be pretty easy to just parse them.
Alternativly there are dozens of other ways to serialize java objects, like json, xml, protobuffers, ect.

1 Like