Forum Multiplayer error when roomId = null

Discussion and help relating to the PlayerIO Multiplayer API.

error when roomId = null

Postby gingan » May 14th, 2010, 5:21 am

HI,

I'm trying out the Tic Tac Toe example in my local machine.
I'm able to start the server and I changed the gameID

However, running the swf I get the following error:

Sucessfully connected to player.io
false
Got Error: Sorry, but you can't set room data when using createJoinRoom with roomId==null

the createJoinRoom call in the Lobby.as file has roomId as null
Code: Select all
private function createGame(name:String):void{
         hideCreateRoom();
         showLoader()
         _client.multiplayer.createJoinRoom(
            null,                        //Room id, null for auto generted
            _serverType,                  //DLL type to spawn, bounce is a simple bounce server
            true,                        //Hide room from userlist
            {name:name},                  //Room Join data, data is returned to lobby list. Variabels can be modifed on the server
            {},                           //User join data.
            handleJoin,                     //Join handler
            _handleJoinError               //Error handler
         )


Should that be null or should I change that with something like "tictactoe"?
gingan
 
Posts: 2
Joined: May 14th, 2010, 2:44 am

Re: error when roomId = null

Postby ben » May 14th, 2010, 11:28 am

Hi, I run into the same problem. In my opinion there are two options. 1: Set the room id manually (not to null) and you room data to what ever you want. 2: Set the room id to null and define no room data.
Cheers,
Ben
ben
 
Posts: 10
Joined: April 13th, 2010, 10:11 am

Re: error when roomId = null

Postby gingan » May 14th, 2010, 7:20 pm

Thanks Ben. Your suggestion helped.

Now I observe new problems in the Tic Tac Toe example.
The problem seems to be the listRoom function.

Problem 1:
The rooms do not show up in the lobby.
I added a trace line in the code and it always return 0 rooms.
I assume the array "rooms" gets populated from the server.
Code: Select all
_client.multiplayer.listRooms(_serverType, {}, 50, 0, function(rooms:Array){
            //Trace out returned rooms
            trace("There are ", rooms.length, " rooms");
            for( var a:int=0;a<rooms.length;a++){
               roomContainer.addChild(new RoomEntry(rooms[a], joinRoom))   
            }
            
            base.reset();
         }, function(e:PlayerIOError){
            trace("Unable to list rooms", e)
         })


Problem 2:
When a new player click "create new game", despite entering a new game name, it always joins the first existing game.

I'm testing this by running multiple swf in my local computer.
I'm fairly new to flash and AS, please bare with me.
gingan
 
Posts: 2
Joined: May 14th, 2010, 2:44 am

Re: error when roomId = null

Postby ben » May 15th, 2010, 12:02 pm

Hi, I think the code should work. Have you set the _serverType to your own server class? Is the developing server running or have the playerio server the latest .dll? In my opinion there are also some syntax issues, maybe try out the following code:


Code: Select all
_client.multiplayer.listRooms(Your game name / server typ, {}, 50, 0, function(rooms:Array){
            //Trace out returned rooms
            trace("There are ", rooms.length, " rooms");
            for( var a:int=0;a<rooms.length;a++){
               roomContainer.addChild(new RoomEntry(rooms[a], joinRoom))   
             }
             base.reset();
            }
            function(e:PlayerIOError){
            trace("Unable to list rooms", e)
            })
ben
 
Posts: 10
Joined: April 13th, 2010, 10:11 am

Re: error when roomId = null

Postby Benjaminsen » May 19th, 2010, 9:58 am

Hi Both of you

This is actually our fault, we changed the default behavior of null arguments being parsed to createJoinRoom. We are looking to find a solution that does not break the old code.

/Chris
Benjaminsen
.IO
 
Posts: 1444
Joined: January 12th, 2010, 11:54 am
Location: Denmark


Return to Multiplayer