Page 1 of 2

RoomList shows always ZERO

Posted: 18 Aug 2011, 10:27
by jamalsoueidan
Hello,

It's weird when I look in the ZoneMonitor I can see something like this.

Lobby(1)
test(2)

But when I go through the roomList in the AS3 client, I get:

0 0 3
0 0 0

Code: Select all

for each(var r:Room in _server.roomManager.getRoomList() ) {
    trace(r.playerList.length, room.userList.length, room.userCount);
}
The one in the ZoneMonitor is correct, but I cannot get the same result :S

Posted: 18 Aug 2011, 11:05
by jamalsoueidan
I have tried almost everything :S

_server.getRoomByName("random").addUser(_server.mySelf);

Then my event listener get dispatched and go through roomList but still the old counts :S

I'm either doing something wrong or their is some errors.

I tried also at the server-side, but it doesn't work either.

Code: Select all

newRoom.addUser(userInvitee);
			
lastRoom.removeUser(userInviter);

Posted: 18 Aug 2011, 13:53
by rjgtav
Hi. To join an user from the server-side, please use the joinRoom() method of the SFSAPI class:

http://docs2x.smartfoxserver.com/api-do ... l#joinRoom(com.smartfoxserver.v2.entities.User, com.smartfoxserver.v2.entities.Room)
jamalsoueidan wrote:_server.getRoomByName("random").addUser(_server.mySelf);
And, from where did you get this line?

Posted: 18 Aug 2011, 16:33
by jamalsoueidan
Thanks for your answer.

My Serverside-Extension Code.

Code: Select all

Room newRoom = getApi().createRoom(extension.getParentZone(), setting, userInviter, false, null, true, false);

getApi().joinRoom(userInviter, newRoom);
getApi().joinRoom(userInvitee, newRoom);

getApi().leaveRoom(userInviter, extension.getParentRoom());
getApi().leaveRoom(userInvitee, extension.getParentRoom());
In my ClientSide Code.

Code: Select all

...
	_server.addEventListener(SFSEvent.ROOM_ADD, roomAdded);
	_server.addEventListener(SFSEvent.ROOM_JOIN, roomAdded);
}

protected function roomAdded(event:SFSEvent=null):void
{
	for each( var room:Room in _server.roomList ) {
		trace(room.name, room.userCount);
	}
}
Before extension call:
Lobby 3
oxziic 0

After extension call:
Lobby 3
oxziic 0

Admin Zone Monitor:
Lobby 1
oxziic 2

getRoomByName is from server-extension.

Posted: 18 Aug 2011, 16:52
by rjgtav
Hum... Please make sure you have the latest SFS installed on your computer (RC3)

Posted: 18 Aug 2011, 17:07
by jamalsoueidan
I have the newest RC3 :)

Their is small bugs here and there...

Now the rooms never get removed, I don't know if you have a timer on that?

setting.setAutoRemoveMode(SFSRoomRemoveMode.WHEN_EMPTY);

and all the rooms have been empty for long time now...

I have to restart the server to delete the rooms.

But this again another issue...

Posted: 18 Aug 2011, 17:11
by rjgtav
Sorry my laptop fried and i dont have sfs installed on this one, so i can't test this. But i'm pretty sure this was working before. Just a note, call the joinRoom and leaveRoom only once. maybe thats whats bugging the server

Posted: 18 Aug 2011, 21:22
by jamalsoueidan
I used another method :)

Thanks for your help.

Posted: 18 Aug 2011, 22:15
by rjgtav
hi. Can you say what method you used? Just for future reference

Posted: 18 Aug 2011, 23:44
by jamalsoueidan
1. Request Create new Room
2. Dispatch extension response
3. User disconnect and connect to new room.

Posted: 19 Aug 2011, 05:46
by rjgtav
hi. Just one thing i remembered today. Have you disabled the server side events such as ROOM_ADD and USER_ENTER_ROOM, etc?

Posted: 19 Aug 2011, 06:45
by jamalsoueidan
Nope why should I disable them?

You can follow this topic or maybe you can help me :D

http://forums.smartfoxserver.com/viewtopic.php?t=12020

This a new bug...it feels like battling with your eyes closed against smartfoxserver. Everything needs to be done in one way, but nobody knows how only the developers behind the server.

Posted: 19 Aug 2011, 06:53
by rjgtav
Well, i asked that because if you disable those events, the client desynchronizes. Could you please turn on the debug flag on the client and please check if you get the proper events? I'll try to test these bugs here

Posted: 19 Aug 2011, 07:03
by jamalsoueidan
if you have skype, you are welcome to add me my friend :)

jamalsoueidan

then we can test it faster and see if their is a bug in smartfoxserver.

Posted: 19 Aug 2011, 07:08
by jamalsoueidan
I cannot see any of these events dispatched to the other room in other group.

lobby (group default)
testing (group game)

the lobby only gets the custom extension response (newGameStarted) but not the events you talking about.

I'm doing the join server-side.

getApi().joinRoom(user, room, null, false, null, true, true);

At the user entering zone level.

addEventHandler(SFSEventType.USER_JOIN_ZONE, UserZoneJoinEventHandler.class);