getting list of rooms to client (need suggestion)

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
levancho
Posts: 71
Joined: 27 Jun 2011, 16:03

getting list of rooms to client (need suggestion)

Postby levancho » 26 Aug 2011, 05:50

Hi,

I have a following problem that I am trying to handling it two different ways:

I have 5 room categories. 1 lobby and 4 different game types.

when User joins the lobby I am subscribing that user only to lobby category group so list of other rooms is not getting to the user (lobby category is the only default group category entry).

my need is to get list of all rooms that are under 4 categories (minus lobby) to user, as soon as that user logs into the lobby.

so I have 2 options to do it and wanted to ask which would be more efficient way :

1) as soon as user logs into the lobby to automatically subscribe that user to 4 game type categories and get room list.
and whenever clients needs to get only (for example) 2 types of rooms then to unsubscribe and resubscribe to only those two categories? and request list again? but this way I still need to filter out lobby room from that list on client side.

2) create custom command "get room list" that client requests as soon it loogs in, also passing a parameter that says which type of rooms it needs to get from custom ext, and do the logic on serverside to obtain room list and create SFArray and send it as custom response back to client.

basically my question is how efficient will it be for client to subscribe/unsibscribe to/from group categories just to get different room list content vs to handle all this as a custom request?
jamalsoueidan
Posts: 153
Joined: 15 Aug 2011, 16:33

Re: getting list of rooms to client (need suggestion)

Postby jamalsoueidan » 26 Aug 2011, 08:03

1) as soon as user logs into the lobby to automatically subscribe that user to 4 game type categories and get room list.
and whenever clients needs to get only (for example) 2 types of rooms then to unsubscribe and resubscribe to only those two categories? and request list again? but this way I still need to filter out lobby room from that list on client side.


What information do you want to get from these game room types?

Because you can only know how many users is joined, you can't get the playerList as username etc.

Too much bandwidth, if 300 users is online.

2) create custom command "get room list" that client requests as soon it loogs in, also passing a parameter that says which type of rooms it needs to get from custom ext, and do the logic on serverside to obtain room list and create SFArray and send it as custom response back to client.

basically my question is how efficient will it be for client to subscribe/unsibscribe to/from group categories just to get different room list content vs to handle all this as a custom request?


It's very easy, I made a lobby for my game, but my choice was was server-side extension.

Because I have more control and I dont get all the subscription events etc for the other group.

and I can ask for these information every 10 sek so the server doesn't work to much and doesn't use too much bandwidth, if I have too many users connected at the same time.

and I can choose whatever information I want to sent to these users.

:-)

You need freedom you choose 2, you just need room list with userCount on the different groups then stick to 1 :)

Hope this help..
User avatar
levancho
Posts: 71
Joined: 27 Jun 2011, 16:03

Postby levancho » 31 Aug 2011, 16:02

I opted for second option using custom request, plus I can send response from server without a request anytime so that helps too,
anyways I am building predefined tables at server startup and then caching it on model object of my extension so I do not have to regenerate tables list unless there are changes to tables or new table etc ...) even then I am trying to comeup with strategy to only update one table from the list insted of regenerating the ehole list whenever one table var changes, that is still on my todo list though :), either way it works so far pretty fast, I will test it more once I get more tables running
thanks for suggestions
Kind Regards.

Return to “SFS2X Questions”

Who is online

Users browsing this forum: No registered users and 148 guests