Scalable Multizone Architecture

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

Moderators: Lapo, Bax

Post Reply
djacobs7
Posts: 4
Joined: 13 Sep 2013, 00:42

Scalable Multizone Architecture

Post by djacobs7 »

Hi,

I am working on a project sort of similar in structure to club penguin, and I am wondering how to build it in a scalable way.

We currently have a zone which has maybe 10 public rooms in it (like, "The Street", "The Carwash", "The Stadium", etc..." ). Each room is capped at 10 users. If "The Carwash" is full you have to wait before we allow you to enter it. Everyone connected to the zone sees the same version of "The Carwash".

I would like to have multiple instances of this zone. Each zone instance would have a name ( "Zone 1", "Zone 2", etc... ). When you start the game, you would pick a zone. If you want to play with your friend, you would have to make sure you were in the same zone.

1) Is this a reasonable approach?
2) I'd like to have a server side method to get all the zones on the server, and to return them along with the number of people in each zone. That way users could pick which zone to play in. Is there a java method like 'getAllZones'?
3) I'd like to be able to scale this across multiple smartfox servers. Do you have suggestions for how to do that? I am expecting to create a separate custom server that pings all the smartfox server instances and gets their zone lists.

Thanks!
User avatar
Lapo
Site Admin
Posts: 23438
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: Scalable Multizone Architecture

Post by Lapo »

Working with multiple Zones can be done but under SFS2X we usually don't recommend it unless there's a specific design requirement.
In SFS2X we have introduced the concept of Room Groups which allows to organize Rooms in sub-groups and also avoid to overwhelm clients with colossal room lists. Each client can subscribe to the events of one (or more) Room Groups and only receive events and updates about those.

I would highly recommend to take a look at this overview:
http://docs2x.smartfoxserver.com/Develo ... chitecture

And this architecture white paper:
http://docs2x.smartfoxserver.com/Overview/white-papers
( the 2nd in the list)

If you're still convinced that you need multiple Zones then we can discuss it more in depth but first I'd like you consider the easier routes :)

Hope it helps
Lapo
--
gotoAndPlay()
...addicted to flash games
djacobs7
Posts: 4
Joined: 13 Sep 2013, 00:42

Re: Scalable Multizone Architecture

Post by djacobs7 »

Ok. Thank you for your quick reply. This makes sense to me. I can come up with some structure that uses Room Groups instead, that looks like it will work fine. I suppose I can figure out how to write a server side "Give Me All The Room Groups" in this zone method.

I looked at the white paper, and I think I want to have multiple 'star systems'. In other words, I would like to have multiple servers. I want each server to have several room groups, and I want each room group to represent a complete instance of the game world.

The thing I am confused about, is that I don't know how to connect the client to a server. (We could even assume 1 room group per server here) I'd like to be able to display a list of possible servers to the client, and let the client know what all the possible servers are, and tell the client the load on each server. I'd prefer the client didn't have to ping each server to check its load, and I would prefer that the client didn't have to own a list of servers. I imagine that there are other smartfox projects out there that let you 'pick a server'. Is there an existing best practice for doing that?
User avatar
Lapo
Site Admin
Posts: 23438
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: Scalable Multizone Architecture

Post by Lapo »

djacobs7 wrote:Ok. Thank you for your quick reply. This makes sense to me. I can come up with some structure that uses Room Groups instead, that looks like it will work fine. I suppose I can figure out how to write a server side "Give Me All The Room Groups" in this zone method.
If you call zone.getRoomList() you will get all the available Rooms regardless of their groups.
A Room Group is essentially just a tag that is used from server side to keep clients updated. On the server side itself Rooms are not really grouped, although there are methods to filter Rooms by Group.
The thing I am confused about, is that I don't know how to connect the client to a server. (We could even assume 1 room group per server here) I'd like to be able to display a list of possible servers to the client, and let the client know what all the possible servers are, and tell the client the load on each server. I'd prefer the client didn't have to ping each server to check its load, and I would prefer that the client didn't have to own a list of servers. I imagine that there are other smartfox projects out there that let you 'pick a server'. Is there an existing best practice for doing that?
Yes, there are many, Disney's Club Penguin is probably one of largest among those. Their implementation is not public, so we are clueless as you are :)
In any case there are several ways to do it.
Normally the idea is to let each server publish its current load in a central/shared database every 1 minute or so. When the client gets to the website, and before it connects to any SFS instance, the web page will show you the available servers and their load, providing the client with the "coordinates" for each instance. Then the player chooses the server instance and voilà.

Hope it makes sense.
Lapo
--
gotoAndPlay()
...addicted to flash games
Post Reply