Page 1 of 1

Join Room Problem

Posted: 06 Nov 2008, 12:37
by wallis2xk
SFS 1.6.3

In a previous development with AS2 and 1.5.5 I had a structure of a limbo lobby extension which managed users and created and joined users to the dynamic game rooms when they were enough players in the lobby, which worked fine., so for example

Code: Select all

_server.createRoom({name:"Game" + gameCount, maxU:4, isGame:true, xtName:"mgame", xtClass:""}, null, false, false, roomVars, null, false);
if(newRoom != null) {
   var roomId = newRoom.getId();
   var isJoin1 = _server.joinRoom(user1, globalRoomId, true, roomId);
        var isJoin2 = _server.joinRoom(user2, globalRoomId, true, roomId);

I'm now trying to do the same thing with AS3 and users still get put to the room fine(checked in the Admin) but, I'm getting client side errors:

Code: Select all

[Sending]: <msg t='sys'><body action='verChk' r='0'><ver v='154' /></body></msg>

[ RECEIVED ]: <cross-domain-policy><allow-access-from domain='*' to-ports='9339' /></cross-domain-policy>, (len: 91)
[ RECEIVED ]: <msg t='sys'><body action='apiOK' r='0'></body></msg>, (len: 53)
[Sending]: <msg t='sys'><body action='login' r='0'><login z='moonminer'><nick><![CDATA[]]></nick><pword><![CDATA[]]></pword></login></body></msg>

[ RECEIVED ]: <msg t='sys'><body action='logOK' r='0'><login n='guest_18' id='20' mod='0'/></body></msg>, (len: 90)
[Sending]: <msg t='sys'><body action='getRmList' r='-1'></body></msg>

[ RECEIVED ]: <msg t='sys'><body action='rmList' r='0'><rmList><rm id='1' priv='0' temp='0' game='0' ucnt='0' lmb='1' maxu='10000' maxs='0'><n><![CDATA[global]]></n></rm></rmList></body></msg>, (len: 178)
[Sending]: <msg t='sys'><body action='autoJoin' r='-1'></body></msg>

[ RECEIVED ]: <msg t='sys'><body action='joinOK' r='1'><pid id='0'/><vars /><uLs r='1'></uLs></body></msg>, (len: 92)

[ RECEIVED ]: <msg t='sys'><body action='joinOK' r='196'><pid id='1'/><vars><var n='numPlayers' t='n'><![CDATA[2]]></var></vars><uLs r='196'><u i='20' m='0' s='0' p='1'><n><![CDATA[guest_18]]></n><vars></vars></u></uLs></body></msg>, (len: 218)
[Fault] exception, information=TypeError: Error #1009: Cannot access a property or method of a null object reference.
Fault, handleJoinOk() at

The problem seems to be that the client-side can't get the room. Is there something different in the way this is done with AS3 or am I missing something else?


Posted: 06 Nov 2008, 13:43
by orthiac
Make sure you are compiling against the new 1.6.3 AS3 API. I just went through the same thing and found I was using the old API.
It's a place to start anyway.

- Mike

Posted: 06 Nov 2008, 13:56
by wallis2xk
Thanks, I've double-checked, and yep, I am using the the AS3 1.6.3.

Posted: 09 Nov 2008, 14:54
by Lapo
The problem is that the room list of the client is out of synch.
If you take a look at the message dump you have reported you will note that the room list contains only the Limbo room, which is auto-joined.

After that the client receives and update for having successfully joined room with id=196 which was never notified to the client.

I presume you're creating the room on the server side without letting the server notify its creation which in turn causes the problem.
AS 2 would not complain of a method call on a null object, but AS 3 does.

Simply turn on the notification from server side (on the createRoom method), that's the right way to do it.