One Account for Multiple Servers

Post here your questions about SFS2X. Here we discuss all server-side matters. For client API questions see the dedicated forums.

Moderators: Lapo, Bax

User avatar
Zelek
Posts: 36
Joined: 24 Jun 2010, 22:36

One Account for Multiple Servers

Postby Zelek » 27 Oct 2013, 07:40

I have a system set up where multiple games run simultaneously, and each game has its own SmartFox server instance in Amazon EC2. What I'd like to do is have a single "Account" database that's shared between these multiple server instances. The basic flow would be something like this:

1) User launches client and enters Username/Password
2) This info is checked against a single Account database for authenication
3) The user then selects a game and is sent to the appropriate SmartFox server instance

I'm not sure quite how to go about this. Should each game server have a separate "login" Zone where the Database Manager points to the central account database? That would require the user selecting a game (server) before authenticating, though.

If anyone knows of some examples or existing documentation about sharing data and coordinating between multiple SmartFox servers, that'd definitely help. Thanks!
User avatar
Lapo
Site Admin
Posts: 21077
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: One Account for Multiple Servers

Postby Lapo » 27 Oct 2013, 09:11

Yes the idea is correct, you can use a central DB where multiple SFS instances will connect to.
It seems to me your main problem is one of "load balancing" or "redirection" based on the type of game a User selects.

Couple ideas to tackle this problem:

1) Let the user choose the game type before login time, so they can be sent directly to the right server instance.
2) Use a separate Login Server that just works as a Lobby and redirection system.
With this second option you could literally use two separate connections, one for the Lobby server and one for the Game server. It requires a bit more extra coding and coordination but it can be pretty efficient, especially if you need users to remain in the Lobby (for notifications and buddy list interaction) while playing.

Ultimately it will depend on your game requirements
Lapo
--
gotoAndPlay()
...addicted to flash games
User avatar
Zelek
Posts: 36
Joined: 24 Jun 2010, 22:36

Re: One Account for Multiple Servers

Postby Zelek » 27 Oct 2013, 17:52

Lapo wrote:2) Use a separate Login Server that just works as a Lobby and redirection system.
With this second option you could literally use two separate connections, one for the Lobby server and one for the Game server.


For this option, how does authentication work for the Game server? Does the Lobby server tell the Game server that the user is already logged in, or does the player have to reauthenticate, or something else?

Thanks for your help, Lapo!
User avatar
Lapo
Site Admin
Posts: 21077
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: One Account for Multiple Servers

Postby Lapo » 28 Oct 2013, 08:55

It can be done in several ways.
Since you have a centralized DB you could flag the User as "Logged In" when it initially logs into the main Lobby server.
When the client logs into the GameServer you can just send the username without any password and the system will allow the client in (or not) based on the "Logged in" flag. This way only people successfully logged in from the Lobby will be allowed inside a game.

Makes sense?
Lapo

--

gotoAndPlay()

...addicted to flash games
User avatar
Zelek
Posts: 36
Joined: 24 Jun 2010, 22:36

Re: One Account for Multiple Servers

Postby Zelek » 31 Oct 2013, 03:27

That makes sense, and I was able to get things up and running. Thanks, Lapo!

Return to “SFS2X Questions”

Who is online

Users browsing this forum: No registered users and 8 guests