BUG in AS3 API, getRoomList returns WRONG room variables
-
Pippoflash
- Posts: 135
- Joined: 30 Jan 2006, 17:16
- Contact:
BUG in AS3 API, getRoomList returns WRONG room variables
Hi,
sfs 1.6.9, latest AS3 API.
This is causing serious issues to a recently launched game.
When I call getRoomList, the list of rooms returned has wrong room variables.
In the admin tool, as well as in server side extensions, the variables are listed correctly.
Also on room updates, the variables are changed correctly.
But, refreshing the room list, no matter what, the variables returned are wrong, causing all kinds of issues.
Thank you
sfs 1.6.9, latest AS3 API.
This is causing serious issues to a recently launched game.
When I call getRoomList, the list of rooms returned has wrong room variables.
In the admin tool, as well as in server side extensions, the variables are listed correctly.
Also on room updates, the variables are changed correctly.
But, refreshing the room list, no matter what, the variables returned are wrong, causing all kinds of issues.
Thank you
-
Pippoflash
- Posts: 135
- Joined: 30 Jan 2006, 17:16
- Contact:
Some more info:
there is a room variable called "p", that lists the number of subscribed players.
It is set initially correctly to 0, than a player subscribes, it moves to 1.
If I am logged in main lobby, I receive the room vars update correctly.
On getRoomList, the refreshed room list has the PREVIOUS room var, telling me again users are 0, instead of the new one (1).
This makes the game unusable.
Any help is appreciated.
there is a room variable called "p", that lists the number of subscribed players.
It is set initially correctly to 0, than a player subscribes, it moves to 1.
If I am logged in main lobby, I receive the room vars update correctly.
On getRoomList, the refreshed room list has the PREVIOUS room var, telling me again users are 0, instead of the new one (1).
This makes the game unusable.
Any help is appreciated.
-
Pippoflash
- Posts: 135
- Joined: 30 Jan 2006, 17:16
- Contact:
Following a post from 2009 from someone else (which didn't receive any answer) he claimed that commenting:
Now, the bug doesn't happen.
What is that function for?
Why commenting that the bug is gone?
What consequences whould I expect doing this?
thank you
I have noticed a strange piece of code in SysHandler.handleRoomList()
method:
Code:
/*
* Merge with current room list data, to avoid destroying previous data
* @since 1.6.0
*/
var oldRoom:Room = roomList[roomId]
if (oldRoom != null)
{
room.setVariables( oldRoom.getVariables() )
room.setUserList( oldRoom.getUserList() )
}
if i comment this line:
Code:
//room.setVariables( oldRoom.getVariables() )
Now, the bug doesn't happen.
What is that function for?
Why commenting that the bug is gone?
What consequences whould I expect doing this?
thank you
-
Pippoflash
- Posts: 135
- Joined: 30 Jan 2006, 17:16
- Contact:
When and where are you getting the room list from the server? (that is using the getRoomList method). Upon login and after leaving a game room?
Are you disabling any broadcast events in your extensions? Such scenario is preventing of sending updates to save bandwidth.
Are you disabling any broadcast events in your extensions? Such scenario is preventing of sending updates to save bandwidth.
Smartfox's forum is my daily newspaper.
-
Pippoflash
- Posts: 135
- Joined: 30 Jan 2006, 17:16
- Contact:
I am getting it each time I log back in the main lobby.
It is required in order to update game table statuses.
Bandwidth is small, it is anyway data I have to receive, and sending custom events would just use the same if no more bandwidth.
Everything works fine, but when I do refresh rooms list, value of room variables is all messed up. It seems like is stuck at last status. It doesn't reflect the real value of room variables.
I do need to refresh room list. And I do need correct room variables.
Do you have nay idea why commenting that line it works fine? Could it cause malfunctions?
There is a post with the same exact problem: http://forums.smartfoxserver.com/viewto ... 1216#51216
Nobody ever replied.
It is required in order to update game table statuses.
Bandwidth is small, it is anyway data I have to receive, and sending custom events would just use the same if no more bandwidth.
Everything works fine, but when I do refresh rooms list, value of room variables is all messed up. It seems like is stuck at last status. It doesn't reflect the real value of room variables.
I do need to refresh room list. And I do need correct room variables.
Do you have nay idea why commenting that line it works fine? Could it cause malfunctions?
There is a post with the same exact problem: http://forums.smartfoxserver.com/viewto ... 1216#51216
Nobody ever replied.
-
Pippoflash
- Posts: 135
- Joined: 30 Jan 2006, 17:16
- Contact:
Here are further info:
- The room which owns the variables is a game room.
- Variables are public, and owned by server.
- They are setup by server at the moment of room creation.
- Variables are sent together with room list.
- When the user is in the room, variables are received correctly.
- Other users in main lobby, receive variables update notification correctly.
- When the user in the game room, leaves the room to go back in main lobby, he refreshes the rooms list, and once rooms list is refreshed, room variables are all messed up.
- Checking rooms on admin tool, and through other players in main lobby, they are correct.
- Only on room refresh variables are messed. It seems like they keep a previous value stored.
- Commenting that line (as described in previous post) seems to prevent this bug, but I don't know what other consequences it may cause.
Please let me know if you need further info.
thanks
- The room which owns the variables is a game room.
- Variables are public, and owned by server.
- They are setup by server at the moment of room creation.
- Variables are sent together with room list.
- When the user is in the room, variables are received correctly.
- Other users in main lobby, receive variables update notification correctly.
- When the user in the game room, leaves the room to go back in main lobby, he refreshes the rooms list, and once rooms list is refreshed, room variables are all messed up.
- Checking rooms on admin tool, and through other players in main lobby, they are correct.
- Only on room refresh variables are messed. It seems like they keep a previous value stored.
- Commenting that line (as described in previous post) seems to prevent this bug, but I don't know what other consequences it may cause.
Please let me know if you need further info.
thanks
-
Pippoflash
- Posts: 135
- Joined: 30 Jan 2006, 17:16
- Contact:
Thank you for your patience.
We have a possible solution we would like to test further and release soon, but in the meanwhile you might want to apply it yourself.
In the SysHandler.handleRoomList() method you have:
followed by:
You should reverse the order of the two code blocks. In this way previous room variables are preserved (there's a reason for this) and then they are overwritten with new values coming with the event.
We have a possible solution we would like to test further and release soon, but in the meanwhile you might want to apply it yourself.
In the SysHandler.handleRoomList() method you have:
Code: Select all
// Handle Room Variables
if (roomXml.vars.toString().length > 0)
{
populateVariables(room.getVariables(), roomXml)
}Code: Select all
/*
* Merge with current room list data, to avoid destroying previous data
* @since 1.6.0
*/
var oldRoom:Room = roomList[roomId]
if (oldRoom != null)
{
room.setVariables( oldRoom.getVariables() )
room.setUserList( oldRoom.getUserList() )
}Paolo Bax
The SmartFoxServer Team
The SmartFoxServer Team
-
Pippoflash
- Posts: 135
- Joined: 30 Jan 2006, 17:16
- Contact:
I was also getting this problem due to this workflow:
1. Player #A creates a race. The race has a variable called 'isBegin' and is initially set to '0'.
2. Player #B joins the race. Player #A begins race thus updates its 'isBegin' variable to '1'
3. Player #B leaves race (not straight away) and joins lobby. The entire room list is was then received again.
4. According to the raw data, the 'isBegin' variable for that particular race was '1' which shows that it have been updated correctly.
5. However, the resulting variable was '0' (when using Room.getVariable method) thus showing the race status as 'not started' which was incorrect.
The solution posted by Bax resolved this issue.
1. Player #A creates a race. The race has a variable called 'isBegin' and is initially set to '0'.
2. Player #B joins the race. Player #A begins race thus updates its 'isBegin' variable to '1'
3. Player #B leaves race (not straight away) and joins lobby. The entire room list is was then received again.
4. According to the raw data, the 'isBegin' variable for that particular race was '1' which shows that it have been updated correctly.
5. However, the resulting variable was '0' (when using Room.getVariable method) thus showing the race status as 'not started' which was incorrect.
The solution posted by Bax resolved this issue.
Smartfox's forum is my daily newspaper.
-
Pippoflash
- Posts: 135
- Joined: 30 Jan 2006, 17:16
- Contact:
Re: BUG in AS3 API, getRoomList returns WRONG room variables
Thank you Paolo,
Sorry for my late reply: I had found a way not to use variables updates, but then I got to the point where I couldn't avoid it, so I tried your fix and it does the job.
thumbs up
Filippo
Sorry for my late reply: I had found a way not to use variables updates, but then I got to the point where I couldn't avoid it, so I tried your fix and it does the job.
thumbs up
Filippo