Networking in games

Hi darkfrog.

I have a question regarding the networking api.

I am trying to implement the JMEGraphicsController in my jME multiplayer

application. All is fine; I can do the Syncing of the 3D parameters and your api

handles it good, but I need advice on how to go about creating these spatials

on the other clients trying to connect or those already connected onto the server.

The SimpleClientTest and SimpleServerTest doesn't quite handle this scenario that well.

Please, if you can provide me with some help, I would appreciate it much!



This is actually a pretty common problem and I've been considering adding additional code to make this a little easier.  However, for now, the way I do it is to create a custom "CreatePlayerMessage" and "RemovePlayerMessage" that can be listened for from the clients and gets sent from the server when a new player joins.  That message would contain the object id and specific information about what model to load, what skin to use, etc. and then the client would create the spatial from that info and then register it passively with the provided id.  After it's registered passively it should start receiving synchronization information and position itself properly.

The same is true for removing, you'd simply send the message out telling the clients to remove the player by the id.

Can you maybe give an example peace of code, because I get a null pointer exception on the ServerSyncListener when the client is not registered at the


Please man, I would appreciate.

Is there a way that you can change the API so that the JGNConnection contain the actual message and object beinig send?

Post the code you're using to do this.