Anyone ever tested RMI for a game ?

Also, if you would rather just do bean data synchronization (particularly useful for game data in a game where multiple clients can modify, or at least read specific data about an object) check out the SharedObject system in JGN. It allows you to define an interface like:

public interface MySharedBean {
	public String getOne();
	
	public void setOne(String one);
	
	public int getTwo();
	
	public void setTwo(int two);
}

Then you can create instances on multiple machines of that bean that synchronize for you. Take a look at the samples:

http://svn.javagn.org/core/trunk/src/com/captiveimagination/jgn/test/so/basic/BasicSharedObjectServer.java

http://svn.javagn.org/core/trunk/src/com/captiveimagination/jgn/test/so/basic/BasicSharedObjectClient.java

You can even add listeners to the SharedObject to be notified when any of the data changes. You’ll know what “field” was changed, what it was changed to, and the MessageClient that is responsible for the change. This is extremely powerful if you’re wanting stateful data synchronized over many clients or even just client to server.

These are just two of the many features JGN provides. I think it’s also relevant to point out that these are “extensions” to the core functionality of JGN. The beauty of this is that this kind of functionality can be written by anyone. It shows the power of the core of JGN to support nearly any usage.

What are the messageServer and messageClient in the above example?

Are they the JGNServer and JGNClient? Or are they actually the MessageServer and MessageClient.

Because I am pretty confused on how the MessageServer and MessageClient are setup. The JGNServer/JGNClient seem more intuitive…

They refer to MessageServer and MessageClient. I’ve considered changing the name of those classes so they make a little more sense. Though they are correct terminology, typical usage of “server” makes it confusing. The MessageServer is the core of JGN, there are two types of MessagesServers: TCPMessageServer and UDPMessageServer. You instantiate a MessageServer and that is responsible for connecting outward to establish new MessageClients and/or listening for inbound connections and creates MessageClients. The MessageServer is a “server” and MessageClients are the individual remote connections that have been established from a MessageServer.

JGNServer and JGNClient are part of the Client / Server convenience classes that provide common functionality for your typical client / server game. They actually encapsulate two message servers (a fast server and a reliable server - typically UDPMessageServer and TCPMessageServer). However, you can define only one or the other if you only want to communicate via TCP or UDP. Both JGNServer and JGNClient have logic internally defined to decide how messages should be sent. For example, a CertifiedMessage (a message with guaranteed deliverability) will always prefer to send via TCP whereas a RealtimeMessage (typically used for things like synchronization) prefers to go through UDP since it’s not critical that every message reach the destination. There are several interfaces that custom Messages simply need to implement in order to gain functionality like this.