CreateRoom Question

Post here all your questions related with SmartFoxServer .Net/Unity3D API

Moderators: Lapo, Bax

matrix211v1
Posts: 61
Joined: 16 Jan 2009, 14:48

CreateRoom Question

Postby matrix211v1 » 01 Mar 2010, 21:41

I am trying both of these:

Code: Select all

String roomName = "P-Bob";
NewRoomDescriptor roomObj = new NewRoomDescriptor(roomName, 15, true);
Debug.Log("Create Room");
smartFoxClient.CreateRoom(roomObj);
smartFoxClient.JoinRoom(roomName);

and

Code: Select all

String roomName = "P-Bob";
Hashtable roomObj = new Hashtable();
roomObj.Add("name", roomName);
roomObj.Add("isGame", true);
roomObj.Add("maxUsers", 15);
Debug.Log("Create Room");
smartFoxClient.CreateRoom(roomObj);
smartFoxClient.JoinRoom(roomName);

and both fail to create a room BUT it doesn't give any error. Any thoughts?
GKL
Posts: 1
Joined: 22 Mar 2010, 20:14

Postby GKL » 22 Mar 2010, 20:21

I'm having the same problem. Any help would be greatly appreciated.
matrix211v1
Posts: 61
Joined: 16 Jan 2009, 14:48

Sorry

Postby matrix211v1 » 22 Mar 2010, 20:32

Nope. Sorry, never got it solved.
ThomasLund
Posts: 1297
Joined: 14 Mar 2008, 07:52
Location: Sweden

Postby ThomasLund » 23 Mar 2010, 07:36

Missed this one - sorry.

You have to wait for the response from the server before you can join the created room. SFS is a response/request system, so if you fire off commands right after each other, then its not guaranteed that the server has had time to create the room for you yet.

You can check out the tic-tac-toe tutorial code, where I create a game room that is then joined. But basically wait for the joinroom until server has responded that the room has been created.

/Thomas
p3dro.sola
Posts: 25
Joined: 22 Dec 2009, 17:00

BUMP

Postby p3dro.sola » 11 May 2010, 02:43

I'm having a similar problem. I understand the need to first create a room, and then attach the joinRoom to the rommlist update event. (once the server responds) However, when i use this code to create a room (straight from the sfsTris example) i don't get a roomCreateError, or a roomListUpdate. It just hangs.

Any ideas?

Code: Select all

function createRoom()
{
   
   var gameRoom:Object = new Object()
   gameRoom.name = 'newRoom'
   gameRoom.password = null
   gameRoom.maxUsers = 2
   gameRoom.isGame = true
   gameRoom.isTemp = true
   
   smartfox.createRoom(gameRoom)
}
ThomasLund
Posts: 1297
Joined: 14 Mar 2008, 07:52
Location: Sweden

Postby ThomasLund » 11 May 2010, 06:25

Anything written on the server console? Or in the player.log of Unity?

Room creation works - as proven in the TTT example (and all other games that use dynamic room creation) - so there must be something else happening

/Thomas
p3dro.sola
Posts: 25
Joined: 22 Dec 2009, 17:00

Working

Postby p3dro.sola » 11 May 2010, 06:32

ThomasLund wrote:Anything written on the server console? Or in the player.log of Unity?

Room creation works - as proven in the TTT example (and all other games that use dynamic room creation) - so there must be something else happening

/Thomas


I'm not sure what it was, but it's working now.
Thanks for the prompt reply though.
ThomasLund
Posts: 1297
Joined: 14 Mar 2008, 07:52
Location: Sweden

Postby ThomasLund » 11 May 2010, 14:02

Ahhh - super. Good it works :-)

/Thomas

Return to “.Net / Unity3D API”

Who is online

Users browsing this forum: No registered users and 17 guests