Page 1 of 1

creating game room = automatic join?

Posted: 05 May 2005, 23:45
by brandon
I am attempting to have a lobby where players can start a game but without leaving the lobby - they will just update a user variable to reflect a 'busy' status that the others see. But I don't even get far enough to use the 'dontLeave' flag on an joinRoom() call, because it seems like creating a game room autojoins the user who created it. How should I accomplish this?


Posted: 06 May 2005, 12:57
by Lapo
At the moment when a game room is created, its creator is auto-joined so that he can wait for the other (or others) player(s)

This is done because usually the guy who starts a game room is the one who also wants to play. If we don't autojoin him in the game room he will not be 100% sure to play.

Let's say a user creates a game room for 2 players, but he doesn't join it.
Maybe two other players with faster reflexes and connections may enter the room and start playing, leaving the creator out. (He would have to create a new room again)

A possible solution to this is to allow the room creator to stay in both rooms (the current one and the new game room). This way he could still interact in the old room while keeping his player slot occupied, so no one else can get it.

This option is already supported by the server but I am quite sure it's not yet implemented in the API. We didn't implement it because we thought this would be a pretty rare case... but maybe you proved us wrong! :D

Activating this new feature wouldn't take too much time and if you're interested we can implement it in the next days and send you a new version of the API, meanwhile we'll do some more tests and we'll publish the new stable API as soon as they're enough tested.

Also I'd like to know better how your application is supposed to work, maybe I could suggest some other ways to get to the same result.


Posted: 06 May 2005, 15:25
by brandon
Ok, thanks for clarifying that - I suspected that was the case and it does make sense. And yes, perhaps I can accomplish what I want through other means. If you wouldn't mind, I'll send you an email with a rough screen mockup of the type of lobby I'm thinking about.

thanks again,

Posted: 06 May 2005, 15:40
by Lapo
sure! no problem :)


Posted: 07 May 2005, 09:56
by Lapo
I was wrong: the feature is already present in the current SmartFoxServer API!

We just forgot to mention it in the createRoom() method documentation. Now it's been updated!

By default when you create a game room you're automatically joined in the new room leaving the one you were in before.
If you don't want to leave the old room you can set the "exitCurrentRoom" property to false.

Here's a code example:

Code: Select all

var rObj:Object = new Object() = "myGameRoom"
rObj.isGame = true
rObj.maxUsers = 4
rObj.exitCurrentRoom = false


The above code creates a new game room and allows the user to stay in the current room and the new one at the same time.

Posted: 09 May 2005, 00:41
by brandon
Swell! that's good to know. thank you