RMI, Sockets or ...?

Hi all,

I’m new to this forum and could not find a decent answer to my question. Please let me know when this question is already answered in another topic.

I have a couple of years Java experience and have made some simple mini games. Now I want to make a multi player game (in an Applet). But for networking I still doubt using RMI or just Sockets (or maybe something else?). I red for example about JMS, but I think that is to abstract to use in game development.

My main question is; what is the best to use for networking in the Applet?
Regarding to networking, what do you use?

Thanks! :slight_smile:

sockets, and mind you that you can only connect to the server that the applet is downloaded from as it is sandboxed.

sockets indeed.
RMI depends on serialization, and lots of serialization can stress the garbage collector.

Not to mention the distributed full GC’s in RMI, which might be less or more annoying.

Not anymore since 6u10 !!

I use sockets for my game, seems its the best way to go.

The problem on applets is, that they can only connect to their server. This requires a program to run on the server which forwards any messages to other players. A standalone Java application would be able to send messages direct to other players, not requiring a distributor on the server side.

Games usually go with UDP. But depending on the number of players and messages, TCP can be just as fine or even better.

-JAW

Untrue, read above

There are plenty of solutions for your problem, I’m facing the same one right now. JMS is designed to work with J2EE as far as I know. RMI works bad on long distance with an important latency, that’s why I decided not to use it. Sockets are very low level but very efficient, it depends on how you use them. AltRMI and JRemoting are alternatives to RMI, I don’t know if they are used currently. Apache MINA seems interesting too. JNAG project seems unactive. I don’t know if project darkstar may interest you. Have a look to Java Game Networking : http://javagn.org/wiki

Hi

  1. Where exactly, i cant find it?

  2. I think signed applets should allow free connections too, as an alternative?

  3. Even if they change it in a current version, I am still developing and targeting Java 1.5. Sadly, many people dont run the newest version. Automatic Updating helps a lot, but there are still plenty of clients which are not up to date.

-JAW

here

signed applets allow you to connect anywhere, right