_server.setRoomVariables

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

Moderators: Lapo, Bax

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

Postby Lapo » 18 Sep 2008, 11:10

I know, that's where I wanted to point you ;)
Lapo
--
gotoAndPlay()
...addicted to flash games
x.Mara.x
Posts: 23
Joined: 18 Dec 2008, 20:03

SQL

Postby x.Mara.x » 18 Dec 2008, 20:24

What if i want to save the rooms created in a SQL? is that possible? can you tell me how it would work?
User avatar
Lapo
Site Admin
Posts: 23026
Joined: 21 Mar 2005, 09:50
Location: Italy

Postby Lapo » 19 Dec 2008, 07:33

I don't understand. Can you elaborate?
Lapo

--

gotoAndPlay()

...addicted to flash games
x.Mara.x
Posts: 23
Joined: 18 Dec 2008, 20:03

Confused

Postby x.Mara.x » 19 Dec 2008, 13:45

The thing is that i am really confused.. i want to do a multiplayer game.. where they have their own room or house .. but i dont know still how the private room creations work.. would i have to completely change it in SQL in order to achieve this? i need to know the "logic" of what exactly happens when you create a room thats all because i am really confused right now :( please?

And when i put this code:

function crearcasa() {
room = new Object()

room.name = "The Cave"
room.isGame = true
room.maxUsers = 15


smartFox.createRoom(room)

}

It gives me bad room id! always.. :S even for other events
dotan
Posts: 2
Joined: 14 Jul 2009, 08:22

can you give an extension example for updating room var

Postby dotan » 14 Jul 2009, 09:20

can you give an extension example for updating room vars and users on all rooms for users in a specific room (lobby), so i can show all the users in each room for users in the lobby?

what is a better solution?
interval-based extension or is there a way to extend the onRoomListUpdate event?

Another related thing:
does implementing AbstractExtension override all default server events? and if so do i have to implement all of them in "handleInternalEvent"?
if so can you give an example of how to implement all the events. if not how do i override some of the events and not the others.

And to the point:
How do i override the "roomUpdate/userCountChange/roomListUpdate" event (witch one/s) so i can send the list of users on that room/room vars to all users in a specific room (lobby). can you give an example please?

dotan


Lapo wrote:
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
flarb
Posts: 131
Joined: 15 Oct 2007, 21:07
Location: Home of the Body Bag
Contact:

one solution....

Postby flarb » 28 Sep 2009, 20:30

One solution might be to have "Room Attributes" -- static attributes you apply to a room that can be seen outside of the room. The reason why I'd like to see room variables outside of a room is when filtering a room list--I want to only list rooms that have games appropriate for my character's level etc. Right now I embed this info in the name of the room...but if you could attach some static ints to a room that never change then it could make this process easier. And it wouldn't generate a ton of traffic because these values would never change.

(I'd also like a way to request a filtered list of rooms based on the values of these attributes)
User avatar
Ross Przybylski
Posts: 70
Joined: 24 Jan 2008, 03:56
Contact:

Postby Ross Przybylski » 02 Jun 2010, 22:06

Greetings again, Smart Fox Community!

I’ve had some additional questions for this forum tabled for almost a year, and with some recent changes I’m adding to my game engine, I think it’s time to reopen this discussion.

The Awesome Power of the SFS Remote Admin Tool
The Smart Fox Server Remote Admin tool has some very powerful features that I would love to recreate in my game client. Namely, you can browse each room and get the up-to-date room variables for each room that you click on AND get a list of all the users currently in that room.

How is this being accomplished without server side extensions? I tried using the getRoomVariables function to grab room variables, but this will only give me the value of the variables that were retrieved when I first logged on; it does not get the up-to-date variables for that room.

Regarding Overhead and Bandwidth Usage
I understand what Lapo is saying about the scalability problem- that as the number of rooms and users increase, you’re exponentially driving up bandwidth to keep everything up to date. However, in the same token, why does Smart Fox allow real-time updates to the user counts in each room? If the preferred, bandwidth saving method is to only give access to room variables on a per user request basis, wouldn’t it be more efficient to only update the room user counts on a user-requested update as well?

Since my game is allowing the game host to add computer opponents and close active player slots, the SFS user count is irrelevant. If I’m going to provide updates at all, they should be telling users in the lobby how many humans and computer players are in the game as well as the total number of open player slots available (not just the max number of human users). Is it possible to eliminate the default functionality of the room’s user count being sent by the server?

Also, why doesn’t the scalability problem apply to user variables? In my current engine, my user variables store the player’s avatar and rating statistics. Using the onUserVariablesUpdate listener, I can have my room’s user list make real-time updates to any changes a player makes to these properties, allowing everyone in the lobby to see the change. Ideally, I’d like this same powerful functionality to apply to my game list such that any updates appear for all users in real-time.
Check out my SFS Multiplayer Game:
www.heromages.com
User avatar
Lapo
Site Admin
Posts: 23026
Joined: 21 Mar 2005, 09:50
Location: Italy

Postby Lapo » 03 Jun 2010, 06:56

The Smart Fox Server Remote Admin tool has some very powerful features that I would love to recreate in my game client. Namely, you can browse each room and get the up-to-date room variables for each room that you click on AND get a list of all the users currently in that room.

You can do this with extension code. You can read any Room's data from server side and send it to the client to generate the appropriate output.

Regarding Overhead and Bandwidth Usage

All this and a lot more is addressed in the next major release due later this year and called SmartFoxServer 2X:
http://www.smartfoxserver.com/2X/

Each Room will be configurable to the most minute detail including which event it should fire, which properties it have, new flags, settings and permissions.

Also the UserCountUpdate message will be totally under control via a throttling system that you can configure per Zone and that allows to control how quickly the server fires those updates (from real-time to as many seconds as you wish)

Is it possible to eliminate the default functionality of the room’s user count being sent by the server?

Yes by either using the <DisabledSysEvents> in the Zone ( http://smartfoxserver.com/docs/docPages ... s.htm#zone ) config or creating Rooms with the uCountUpdate attribute turned off ( http://smartfoxserver.com/docs/docPages ... roomConfig )

Also, why doesn’t the scalability problem apply to user variables?

UserVariables are broadcast only to the Users "seeing" the client that has updated.
UserCountUpdates must be broadcast to all users, every time.
Lapo

--

gotoAndPlay()

...addicted to flash games
User avatar
Ross Przybylski
Posts: 70
Joined: 24 Jan 2008, 03:56
Contact:

Postby Ross Przybylski » 03 Jun 2010, 14:40

Lapo wrote:
The Smart Fox Server Remote Admin tool has some very powerful features that I would love to recreate in my game client. Namely, you can browse each room and get the up-to-date room variables for each room that you click on AND get a list of all the users currently in that room.

You can do this with extension code. You can read any Room's data from server side and send it to the client to generate the appropriate output.


I understand this can be accomplished with extension code; my question was how does the remote admin tool accomplish this without using extension code? Or, maybe it is using it's own built in extension? If this is the case, which file contains this as examining it would prove highly useful in recreating the functionality.

Lapo wrote:
Regarding Overhead and Bandwidth Usage

All this and a lot more is addressed in the next major release due later this year and called SmartFoxServer 2X:
http://www.smartfoxserver.com/2X/

Each Room will be configurable to the most minute detail including which event it should fire, which properties it have, new flags, settings and permissions.


While I am very excited about the upcoming release of 2X, the one FAQ I did not see on the page was whether or not 1X will still be supported. While ideally I'd want to rewrite my code to support the new engine, I'd like to know if I can still count on updates and support for my 1X license in the meantime.

Lapo wrote:
Is it possible to eliminate the default functionality of the room’s user count being sent by the server?

Yes by either using the <DisabledSysEvents> in the Zone ( http://smartfoxserver.com/docs/docPages ... s.htm#zone ) config or creating Rooms with the uCountUpdate attribute turned off ( http://smartfoxserver.com/docs/docPages ... roomConfig )


This is good to know! And, I presume if I'm going to write my own room update function that disabling this functionality will help bandwidth usage, correct?

Thanks, as always, for the prompt and helpful response, Lapo.
Check out my SFS Multiplayer Game:

www.heromages.com
User avatar
Lapo
Site Admin
Posts: 23026
Joined: 21 Mar 2005, 09:50
Location: Italy

Postby Lapo » 03 Jun 2010, 19:32

I understand this can be accomplished with extension code; my question was how does the remote admin tool accomplish this without using extension code?

The AdminTool uses a server side extension :) That's why I suggested using the same approach.

While I am very excited about the upcoming release of 2X, the one FAQ I did not see on the page was whether or not 1X will still be supported. While ideally I'd want to rewrite my code to support the new engine, I'd like to know if I can still count on updates and support for my 1X license in the meantime.

Absolutely! We'll continue to maintain and support SmartFoxServer 1.x. We're just adding a new product to the family :)

This is good to know! And, I presume if I'm going to write my own room update function that disabling this functionality will help bandwidth usage, correct?

Yes, that's correct.
Lapo

--

gotoAndPlay()

...addicted to flash games

Return to “SmartFoxServer 1.x Discussions and Help”

Who is online

Users browsing this forum: No registered users and 63 guests