Look fish, Personally I suffered a lot with room variables. I tried them in all ways, and each time I come with some type of problem, so my personal advice and what I`m currently doing is using room variables as the name implies only for things that have to do only with things inside that room where only people who can read/change those values are only inside the room.
The problem of seeing room variables outside their rooms has been vastly discussed in this board, and it's probably one of the most popular
RoomVariables are a mechanism for keeping custom data in a Room and get it updated as soon as it changes. Reading those variables from outside the room means that the server has to continuously update all the clients in the Zone to keep them up to date.
Unfortunately this approach is not scalable. As soon as the traffic increases these update broadcasts will eat just too much bandwidth and server resources.
We are planning to enhance the system by allowing a finer grained configuration of Room Variables in order to solve some of the most requested features. Possible ideas are to allow developers to specify in each variable which rooms should listen for changes, including an option for "all rooms".
Developers will anyway have to take into consideration the impact of these settings on the general resources/bandwidth usage, and for certain tasks using custom server side code is still the best option.
One example of using server side code
comes from another discussion that was started in this same board, recently. The developer was in need to show all users inside a game room and for each user he also needed various informations (name, user variables etc...)
He expected to have all these informations were already populated in the client side API, so that he could simply get any variable from any room, every user etc...
What he wasn't realizing is that, in order to keep all this data available on the client side, the server would have to transfer tons of updates on every second to every connected user, eating up humongous quantities of bandwidth and server resources.
It would be just a broadcast-all scenario, where every change in every user/room is fired to everyone.
Suppose you have 1000 connected users and let's say we have an average of 10 variables changing on every second: we'll have to fire 10 x 1000 = 10.000 messages per second. If each message is 100 bytes we'll end with a traffic of 8Mbits/s ( == 1MByte/s ) only for keeping the Lobby up to date (!)
The solution to this issue is that we of course don't transfer all that data automatically, but we do on-demand.
In your lobby you can show the game room names and properties (users, watchers) by using the default API functions. When you want to see more details for that room you
click on it: at this point we call our extension and ask for all the current details for that room and show it (including the user list)
If you want you can add an extra depth-level by allowing the user to click on any player and again ask the server to send all relevant data about it.
This way we can definitely optimize the resource usage without sacrificing any advanced feature in the application.
Additionally if there are values outside of the default ones provided by the API for users and rooms, you can use a custom extension to send them in real-time or by using an interval-based push from the server side.
Hope this helps