Game Rooms vs Normal Rooms Enumeration

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

Moderators: Lapo, Bax

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

Game Rooms vs Normal Rooms Enumeration

Postby delany » 03 Apr 2008, 13:40

Hi, could you enumerate the difference between Game Rooms and Normal Rooms. The documentation seems to be all over the place on this one.

For instance, in the SmartTris example it is stated:

A game room behaves a little differently because it will be removed as soon as the last user leaves it. This is the only difference.


But, playing around and looking on these forums it seems that game rooms do not receive onRoomDelete and onRoomAdded events.

This is also not stated in the onRoomDelete and onRoomAdded documentation.

Also, there seems to be something going on when the creator of the game room leaves - a room vars update event is dispatched un-setting variables that were set when that user created the game?
Last edited by delany on 04 Apr 2008, 15:38, edited 3 times in total.
delany
Posts: 27
Joined: 10 Dec 2007, 00:32

Postby delany » 04 Apr 2008, 02:50

Even more problems, now.

Similar errors to this thread below, though I'm following the sequence you suggest in it:

viewtopic.php?t=2135&highlight=markup+document+following+root+element+wellformed

Quoting you from that thread:

This is correct.
The sequence should be this:

1 -> you are still in game room
2 -> user clicks "LEAVE GAME"
3 -> you call getRoomList()
4 -> handle the event and finally connect back to, say, the Lobby

Do you mean that the problem arises when a user in the current game room leaves while you are between point 3 and 4?


Yes - I'm having serious issues when a user leaves the room between 3 and 4 ... which happens a lot because users leave around the same time because the game has ended.

What is to be done?

--------

Reading more on this is see the rather worrying statement in this thread:

viewtopic.php?t=2398&highlight=getroomlist+issues

In any case, usually the roomList is received only once per user session... requesting an updated roomlist should be used very carefully and in specific situations, not as a common behavior.


Yet this seems to be recommended in the examples - indeed how can SFS possibly keep the room list updated (which it must or the SFS API causes flash to start throwing errors when certain methods are used) without this getRoomList given that game rooms do not receive the new/deleted room events?!
delany
Posts: 27
Joined: 10 Dec 2007, 00:32

Postby delany » 11 Apr 2008, 15:32

Any thoughts on any of these questions?
Menser
Posts: 111
Joined: 13 Nov 2007, 18:32

Postby Menser » 11 Apr 2008, 20:31

Heya-

Couple quick things.

One) If i remember correctly from reading the docs. When the creator of a game room leaves. The room is destroyed. This could account for what our seeing with the room variables resetting.

If this is the case. If the owner of the game room clicks leave "first" have it remove the other players(to limbo or something) from the room first, then the player who created the room.


IF you want the room to exist after the creator leaves, i think you can set the owner of the room to the server (by passing null?) in which case the room will exist till deleted. This of course would require you to handle the creation of new rooms in a server side extension instead of through the client.

two) Are you creating these rooms dynamically? And if so, from the server or client side? If from the server side, make sure you are passing "true" in the sendUpdate field. If you are using a false here, it will not broadcast the event to the clients about the new room creation.

If you are doing it from the client side, i can not be sure how smartFox handles that in the background. The client side api has no option for the sendUpdate parameter i assume it automatically assign the owner to the user who passed the call.

three) If indeed you are unable to track the creation of new rooms while in a game room. You could create your own tracking system using a zone extension. On the server side simply broadcast your own update message to the clients when it detects if a room is added or removed.


four) Your messages were kinda vague and over the place and a bit hard to follow. So if im off on anything, or not following your properly just let me know.


_-Menser-_
delany
Posts: 27
Joined: 10 Dec 2007, 00:32

Postby delany » 11 Apr 2008, 23:17

Hi Menser,

Thanks for your reply. On your points:

One) I don't think this is true. A game room will persist until everyone leaves it, even if the creator leaves before others.

Two) The game rooms are created dynamically using the SF Client side API. But yes - there is a method for sending updates to user variables - the normal setUserVariables API method, which will result in update events for others in the room. My question surrounds the fact that this event also appears to be triggered on the room creator leaving the room - which I can't find documented and does not make much sense.

Three) I've proposed a workaround for keeping track of rooms in relation to their originating room without resorting to an extension in this thread:

viewtopic.php?t=2725

I've got it up and running. But have to work around several anomalies in SFS - such as the room variable update being triggered and the total collapse of SFS when it loses room list integrity which happens under recommended conditions - that I'm asking about in this thread.

Four) Hm - sorry about that.

Lapo or other SFS person - I would really appreciate your response on these issues. It's beginning to seem to me that the number of ways the room list can lose integrity (and thus crash SFS client) under normal conditions is a serious flaw. I'm sure I'm wrong but without any response from you, what can be done.

I'm working on an implementation for a large website and the lack of response from SFS team on these issues is jeapardising things to say the least.
User avatar
Lapo
Site Admin
Posts: 23008
Joined: 21 Mar 2005, 09:50
Location: Italy

Postby Lapo » 12 Apr 2008, 06:52

delany: are you familiar with this article from our docs? -> http://www.smartfoxserver.com/docs/docP ... ecture.htm

It describes all the features and details about rooms, the different types available, their events and whatnot

I've got it up and running. But have to work around several anomalies in SFS - such as the room variable update being triggered and the total collapse of SFS when it loses room list integrity which happens under recommended conditions - that I'm asking about in this thread.


When you say "total collapse of SFS" I guess you're actually saying that the client application throws an exception due to a broken room list. Right? Sorry but it is difficult to follow you when you don't call things with their names.
Unless ... you say that the server chrashes and stop responding... in such case I don't undestand how this relates with the room list.

It seems to me that you've skipped quite a bit of documentation and examples... our tutorials are there to show how to create lobbies with games, joining in multiple rooms, creating extensions and a lot more.
It takes some time but it is really necessary to go through that material in order to take advantage of the server capabilities.

Usually multiplayer development requires a lot of server side coding and low level stuff. SmartFoxServer tries to hide a lot of this complexity and simplify many processes, however it's not possible to jump right into coding without taking some time in studying the basics.

With this said we're always available to help with any problem that may arise from the server usage but we can't keep repeating over and over what's already written in the documentation.

I'm working on an implementation for a large website and the lack of response from SFS team on these issues is jeapardising things to say the least.

When dealing with large projects it is always recommendable to write down requirements and pinpoint the critical part of the application.
Then you move into a prototype phase where you create small proof-of-concept apps that specifically address those crucial sections.
This allows you to immediately see if the most complex part of you projects work as expected, which problems may arise during the implementation and if, what was initially thought as the solution, actually works.
My question surrounds the fact that this event also appears to be triggered on the room creator leaving the room - which I can't find documented and does not make much sense.

When you set one or more RoomVariables the update is broadcasted to everyone in the room, including the user who sent the request.
This is shown in all examples using Room Variables and it can be useful in certain cases. (See the SFSTris game) If you think it's not in your specific case simply ignore the event.

Hope it helps
Lapo
--
gotoAndPlay()
...addicted to flash games
delany
Posts: 27
Joined: 10 Dec 2007, 00:32

Postby delany » 13 Apr 2008, 19:04

Lapo,

Thank you for responding. I was not familiar with the document you pointed to because it is not part of the documentation that comes with the product that I bought - SFS Basic.

In addition, while it does gather things into one place, it does contradict the documentation that I referenced and does not address the user variables update issue.

Given this, I do not really appreciate the condescending style of your reply. A lecture on basic software development planning was not really necessary and certainly didn't address the issues I brought up. In reference to your lecture: I am evaluating SFS for a big project and the jeapardising I was referring to was SFS's chances of being used.

I will admit that I may not have been clear enough for you so here I will state the issues again. I am quite willing and expecting to be wrong but I would appreciate the courtesy of you actually reading and properly addressing the issues, which I do not believe are as basic as you make out.

1) When the creator of a game room leaves, a user variable update event is received by other members of the room. This seems unnecessary - is this intended?

2) Many of SFS client methods, in the underlying code, use a client side room list. If this room list is not up to date and one of these methods is called on a room the client does not know about, an error is throw and the SFS client engine stops working.

This presents a problem because room lists, by the current SFS architecture, are not kept up to date automatically in a number of circumstances.

One of these circumstances is entering a game room.

This is where the SFS team and documentation start to differ.

In the docs and by Lapo it is suggested that you should call getRoomList() when re-entering a 'Loby'. However, bax, who is also, I believe, part of your team, suggest that using getRoomList() more than once a session should be done only in exceptional circumstances.

And with good reason, it seems - as SFS gets very unstable if certain other events occur around the same time a room list is requested.

One of these times is the recommended way of dealing with the game room issue:

1 -> you are still in game room
2 -> user clicks "LEAVE GAME"
3 -> you call getRoomList()
4 -> handle the event and finally connect back to, say, the Lobby

If something occurs between 3 and 4, I believe, not only does the room list get out of date - leading to the issues noted above - but other things seem to go wrong and the socket itself seem to have to be reset to get the client back up and running. This is a common occurrence because users leave a game room at the same time time - when a game ends.

Is there a recommended way of dealing with these issues that keeps SFS stable?

Thanks,

D
User avatar
darnpunk
Posts: 229
Joined: 22 Jun 2007, 02:58
Location: SG

Postby darnpunk » 14 Apr 2008, 09:24

Hi delany,

1) I noticed a user variable update event too but as for the reason, I have no clue.

2) From what I know, you do not receive the updated room list when in game rooms. To get the updated list, you have to request for the roomlist when you leave your game room by calling getRoomList().

However I found that it is a waste of bandwidth instead as it downloads the whole roomlist.

I did some modifications to the client side API to accomodate my application (calls for updated game roomlist only instead of the whole list). And I have to make sure the list is updated on the client side instead of overwritten. Not a friendly solution as each update I have to remind myself to adjust those lines again but working well for me now.

1 -> you are still in game room
2 -> user clicks "LEAVE GAME"
3 -> you call getRoomList()
4 -> handle the event and finally connect back to, say, the Lobby



If anything happens between 3 and 4, it will most probably break the application for some cases. Maybe a requirement check will help. If 3 does not complete do not proceed to 4. You can do custom functions to handle events where 3 does not finish as you expected (request for list again/disconnect clients if ping too high, lag etc).

I know you wish to avoid custom extensions but I believe you can do more things with the expanded capabilities of SFS PRO.

Cheers,
darnpunk 8)

Return to “SmartFoxServer 1.x Discussions and Help”

Who is online

Users browsing this forum: No registered users and 35 guests