8
\$\begingroup\$

I am currently making a MMORPG game, which is turn-based. The client is supposed to run on Android. Now, my friend is doing the graphics, and I have been doing the game classes (player, weaponry, etc.). Now, if the fight is started, the classes can be manipulated by interfaces (actually for my partner, it is like working with pure interfaces, he does not need any access to the implementaton classes).

Now we need to introduce a game server to allow for multiple players. And a few very important questions arise:

1) Shall I copy the game model to the server completely, leaving no classes on the client or is it better to have 2 copies of the model - 1 on the server and 1 on the device and to complete periodic synchronization between those?

2) Which method of connection to choose between the client and the server (client in sight is android phone)? As for the server - I am turning towards java cause I have some experience with it. But now the questions is - is it better to use sockets for this task or I can use REST services, or it is even possible to connect it somehow to Java EE server which is cool from my point of view cause it removes a lot of programming complication? Even though the game is multiplayer, it is turn based, so it does not need to be renewed very often.

3) What about threading? Should every client have his own thread(in case of sockets)?

4) Are there any books on REAL MMORPG server game programming out there???

\$\endgroup\$

2 Answers 2

7
\$\begingroup\$

Do not copy the entire game model to the server, you wouldn't like to load all the textures and detailed meshes on your server. Keep it as simple as possible, handle all the important processes like the location, health, any movement but do not load everything. - NEVER TRUST THE CLIENT.

There are many books, along with multiple wiki's. Every engine supplier like IdeaFrabrik, Epic Games, Exitgames, Unity (also supports mmo's) has very good documentation for their products. Most of that stuff is public so you got access to complete solutions and you can actually find out how stuff works.

The easiest way to find a book you need is to search Amazon for MMORPG, then go to the book category and choose the "programming" sub category. If you google it you will get unwanted results...

Here is the list of books I found

I haven't gone deeply into server programming, but as the matter of fact, I was close to choosing the Unity+Photon Cloud engine solution for my MMORPG project. (HeroEngine won) The server side is done in this one in C# and one thing I strongly remember is the way things were explained in the tutorials.

\$\endgroup\$
3
  • 1
    \$\begingroup\$ We are not using any engine because the game does not require one. It lacks cool graphics. So we are in no need for Unity with its supreme features for 3D. The books you provided seem to be too broad - still no reference to the book which explains how to write a multiplayer high-load server. But thanks for advice. \$\endgroup\$ Commented Jun 10, 2013 at 1:55
  • \$\begingroup\$ You have to learn about TCP server-client programming. "Saying it the brutal way, server programming is also used in games". You have to learn its basis. This could get you started with it in Java. edn.embarcadero.com/article/31995 \$\endgroup\$ Commented Jun 10, 2013 at 2:05
  • \$\begingroup\$ Yes, I know that already =) I have programmed enough of those in conjunction with JMS and simple string-message servers =) Thats why I asked which is better + sockets are quite low level in comparison to Java EE with which I worked previously) I just dont know how it is done with multiplayer games because so far it seems programming game-server is totally different from programming web sites or simple message-exchange programs) \$\endgroup\$ Commented Jun 10, 2013 at 2:27
4
\$\begingroup\$

1) Shall I copy the game model to the server completely, leaving no classes on the client or is it better to have 2 copies of the model - 1 on the server and 1 on the device and to complete periodic synchronization between those?

Agreed with Mikolaj do not copy everything. Send as few data as possible. You can have same classes (representing just the data model, not other assets) in client and server, but do not send them over the net. You want to serialize them on server and deserialize on client. Client should send only commands to server.

2) Which method of connection to choose between the client and the server (client in sight is android phone)? As for the server - I am turning towards java cause I have some experience with it. But now the questions is - is it better to use sockets for this task or I can use REST services, or it is even possible to connect it somehow to Java EE server which is cool from my point of view cause it removes a lot of programming complication? Even though the game is multiplayer, it is turn based, so it does not need to be renewed very often.

You are planning a turn-based MMORPG (no idea how that would work though). So speed is not much of a problem. You can use any kind of service, REST might be good, it's simple. Usually MMORPGs use UDP (not secure, smaller, faster) for things like movement updates where a lost packet or two doesn't matter and TCP (secure, overhead) for secure communication. Most of the games probably use some kind of encrypted, compressed custom protocol over UDP and TCP to make it fast and hard to crack.

3) What about threading? Should every client have his own thread(in case of sockets)?

Typically you want to have a thread pool. Each thread from the pool services one request, then gets recycled. When you don't have enough threads, you can consider blocking or allocation of more threads.

4) Are there any books on REAL MMORPG server game programming out there???

Mikolaj already googled that for you...

\$\endgroup\$
5
  • \$\begingroup\$ Could you elaborate more on the thread pool? If there are sockets, then the server is listening on requests and allocates a new socket for each. Those sockets with all incoming information can be encapsulated as a job to the thread. But how are threads retrieved from the thread pool if every time those threads have different jobs? + how many open sockets can hold an average server? Will it be more resource intensive than REST or not? + in REST there is no session state so its hard to maintain the player information. But rest in java has a perfect integration into enterprise server whch is good \$\endgroup\$ Commented Jun 10, 2013 at 2:48
  • \$\begingroup\$ The books introduced are all about OOP design of MMORPG as seems from the comments. For that Id rather stick to GoF. Again, it seems like server-side multiplayer online game programming is some kind of sacred knowledge passed through generation =) All forums/posts/books come to those ideas: "dont try programming MMO/Programming MMO is really hard/MMO is not for a newbie"...and NO ADVICE at all... \$\endgroup\$ Commented Jun 10, 2013 at 2:52
  • 1
    \$\begingroup\$ Look at this example: tutorials.jenkov.com/java-multithreaded-servers/… \$\endgroup\$ Commented Jun 10, 2013 at 2:52
  • \$\begingroup\$ The books introduced are all about OOP design of MMORPG as seems from the comments. For that Id rather stick to GoF. This sentence makes no sense. Also building a MMORPG is equivalent to building a jet plane. I'd say earn your wings with paper planes. \$\endgroup\$ Commented Jun 10, 2013 at 2:56
  • \$\begingroup\$ You are right 100% about paper planes =) But those books are not even about paper planes (by paper planes I mean the mmo server-side programming) - I already learned that from the comments on amazon =) Some of those books deal with design patterns for MMORPG games, which can be learned from other, better books, in the same context of making games. + I am already building a B-2, so I appreciate any advice I can get. Thanks=) \$\endgroup\$ Commented Jun 10, 2013 at 3:08

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .