Showing users in games originating in a particular room

Need help with SmartFoxServer? You didn't find an answer in our documentation? Please, post your questions here!

Moderators: Lapo, Bax

Posts: 27
Joined: 10 Dec 2007, 00:32

Showing users in games originating in a particular room

Postby delany » 22 Mar 2008, 19:47

I'm operating a 2 player turn based game. I have a number of rooms in which players can challenge each other - when they are paired up, a game room is created. The originating room they came from determines various things about the game - whether they can use adult words, for instance. When the game is over, the players return to the room they came from.

Currently, after going online, the client receives the room list which tells the user the number of players in an originating room. They then log in and get the list of players in the originating room - which does not include players who are currently in a game room that originated in that room.

What I want to be able to do is, for each room, tell the user what users are in both that originating room and in any games that originated in that room.

The problem is that without this functionality the originating room looks empty when really there are many users playing games.

Is this something that can be done with default SFS functionality?


*EDIT* One way might be to use the multi room join functionality - is this the intended use of this?

If this is the way to go - is it possible to stop the user from receiving updates about the originating room while he is playing? Essentially the only room functionality that is needed is to show other users that the game-playing user is there, but are busy.
Last edited by delany on 24 Mar 2008, 17:12, edited 1 time in total.
Posts: 27
Joined: 10 Dec 2007, 00:32

Postby delany » 24 Mar 2008, 11:10

Thinking about this some more - I believe the smallest bandwidth option for this would be to use a room variable (or a combination of a room variable and the room name - which is not displayed anywhere in this setup).

When the game room is created, I add a room variable (or use the room name) to store the originating room and the names of the two players in the game.

By doing this and setting the send room variables in config.xml to on, all rooms in the zone will receive details of the originating room and the players in the game both when they log on (in the room list) and after they log on when a room is created. All rooms in the zone are also notified when the room is destroyed. In addition, the originating room is notified when a player re-enters.

By keeping track at the client side of the game rooms and - via the room variables - who is in them, I can fake a list of everyone in a particular user's originating room (which includes those playing games originating in the room) by combining the list of people actually in the originating room and adding to it from the room variables all the people in game rooms originating in their room.

I think this doesn't add much bandwidth - every room in the zone already receives the list of rooms being created and destroyed in that zone. The only addition is the room variable ... and the only actually redundant room variable information being sent is the room variable for game rooms that did not originate in the user's own originating room. I can keep the room variable small so I don't think this is an issue.

Am I overcomplicating things here? - is there a lower bandwidth way without fighting SFS like this?


User avatar
Site Admin
Posts: 21639
Joined: 21 Mar 2005, 09:50
Location: Italy

Postby Lapo » 25 Mar 2008, 11:00

It sounds ok.
An alternative would be to send custom updates from the server side when a room changes status (player names etc..) This could be done very effectively by using the raw protocol and minimizing the amount of data transmitted.
...addicted to flash games

Return to “SmartFoxServer 1.x Discussions and Help”

Who is online

Users browsing this forum: No registered users and 27 guests