views:

95

answers:

1

I'm building a Monopoly game in Java and I want it to be able to support games over the net (the point was so me and my friends over in the US of A could play).

Networking is a whole area of programming I have yet to enter so I have been finding it quite hard to decide how exactly to pull it off. In general, I felt that the correct way for it to work would be to have a server app with all the Monopoly game code and then app client with just a GUI with remote method calls.

Is RMI going to be too complex for this project or is it the best way to proceed? Have you any suggestions or tips for me?

Update: This game is going to be 100% Java. So no worries about clients needing to have Java installed. Also, it would be great to get some tips on using RMI.

+7  A: 

RMI is not a complex thing, it's the opposite.

It allows you to develop your game protocol without caring about having Message objects going between server and clients with long if chains to check which kind of message it is and do whatever is required.

What you can actually do with RMI is to have a centralized object (on the server) on which you directly call methods from clients like iWantToMoveThere(position) or iWantToBuyLand(where) and so on. This simplifies the protocol while putting some overhead that you would have in any case since I discourage you from implementing a binary procotol. A XML or a serialized Java one would be a good compromise since you don't really need realtime for a game like this one.

Another advantage of RMI is that you will easily manage a master server on which many game servers may attach to give players the opportunity to play in them, and also many other little things like managing a separated lobby or so on.

Just as direct experience: I used RMI to manage a server that allowed developers to publish their own game plugins allowing players to automatically connect to the server and download the content to be able to play. Everything was handled by RMI except for the fact that I needed a backward TCP connection to be able to handle asynchronous events whenever I needed. The whole source code was just ~1k lines in a bunch of 7-8 classes

Jack
See this was my impression. I didn't want to dive straight in without asking here first though. Thanks :)
Oetzi
Could you possibly give me some example source for a simple RMI app is its not too much trouble? It seems like you really know what you're doing with it.
Oetzi