I'm programming a multiplayer game for mobile phones.I'm working on a distributed server architecture for handling lots of concurrent players.

Here is my architecture on my mind: enter image description here

Some questions about that architecture:

1-) How can i provide a secure login on Login Server?Here is what i'm thinking:

  • Client connects to login server.
  • Login server sends its public key(RSA encryption)
  • Client encrypts its username and password with login server's public key.Then sends that packet to login server.
  • Login server verify username-password information with connecting database server.
  • Login server creates auth token and sends back to client.

2-) How can i secure database queries?Also can that be so slow?Here is what i'm thinking:

  • Client sends its auth token with query packet.Also client sends its random public key.
  • Database server verify that auth token.
  • Database server replies with encrypted(with clients random public key) reply packet.
  • Client decrypt it with its private key.

3-)How can i merge game servers working like a single game server?

Am i on the right way of doing a mmo server design?I'm using Java and Kryonet library for server programming.

  • \$\begingroup\$ Hi! Welcome to the site. Please ask only a single question per post -- your three questions are all rather different, making it harder for reasonable answers to be provided. Consider editing your post down to a single question and posting the others separately. \$\endgroup\$ – user1430 Apr 7 '14 at 23:37

Do not have a client talk to a database server. The client talks only to the frontend game server, and nothing else. That server then distributes client requests to the appropriate backend server.

The frontend servers and (most) of all the other servers are distributed geographically. Not distributing the front-end server as in your diagram defeats almost the entire point of having per-region servers. The only thing you really want to share is an account server, and then only as little as possible.

Client connects to the frontend server. The frontend server then connects to the login/account server, ecommerce server, chat server, and game/map server. The servers can talk amongst themselves as needed since they're all in your private network. The only point of attack is the public frontend servers.

For communication between servers, you can usually use a message queue service of some kind, like RabbitMQ or one of the bazillion similar software packages.

There have been a number of GDC talks and paper on this issue over the years and there's no reason to invent your own architecture when they've already been designed and tested in real-world environments for you. GDC Vault free content

  • \$\begingroup\$ I think using one frontend server will make the frontend server slow,won't it?Can frontend server handle all of login and database requests? \$\endgroup\$ – user7910 Apr 8 '14 at 21:08

Not the answer you're looking for? Browse other questions tagged or ask your own question.