CreateRoom Question

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

Moderators: Lapo, Bax

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

CreateRoom Question

Post by matrix211v1 »

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

Post by GKL »

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

Sorry

Post by matrix211v1 »

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

Post by ThomasLund »

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

Post by p3dro.sola »

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

Post by ThomasLund »

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

Post by p3dro.sola »

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

Post by ThomasLund »

Ahhh - super. Good it works :-)

/Thomas
Post Reply