Forum Multiplayer Returning to Lobby from Game

Discussion and help relating to the PlayerIO Multiplayer API.

Returning to Lobby from Game

Postby Swoopjockey » February 27th, 2010, 3:56 am

Hi there,

I'm building my game off the TicTacToe example.

I want users to be able to leave a Game instance and return to the lobby.

I know I should call player.Disconnect() serverside, but what is the best way to handle things from the clientside?
(I'm assuming this method only disconnects the player from the room, and not the entire server, correct?)

For example, removing the chat and showing the lobby screen again?

Should I reconnect the player to the playerio server again? Or simply reshow the lobby screen and refresh the list?
Swoopjockey
 
Posts: 21
Joined: February 5th, 2010, 2:17 pm

Re: Returning to Lobby from Game

Postby Cyclone103 » February 28th, 2010, 2:14 am

I think createJoinRoom disconnects from current room, but I am not entirely sure. Check the documentation...
Cyclone103
 
Posts: 155
Joined: January 18th, 2010, 6:47 pm

Re: Returning to Lobby from Game

Postby Oliver » March 1st, 2010, 9:11 am

I know I should call player.Disconnect() serverside, but what is the best way to handle things from the clientside?
(I'm assuming this method only disconnects the player from the room, and not the entire server, correct?)


You don't need to do that. You can also call connection.disconnect() from the clientside or just not disconnect the user if you want him to be in two rooms at the same time.

You should think of the connection class as representing "a users connection into a room" -- you can be active in more than one room at a time if you want.

Should I reconnect the player to the playerio server again? Or simply reshow the lobby screen and refresh the list?


Easiest thing to do is probably to just show the lobby screen, and then if the users chooses another room, disconnect the original connection and use joinRoom() to start a new one.

I think createJoinRoom disconnects from current room, but I am not entirely sure. Check the documentation...


False :-)

Best,
Oliver
User avatar
Oliver
.IO
 
Posts: 1159
Joined: January 12th, 2010, 8:29 am

Re: Returning to Lobby from Game

Postby Cyclone103 » March 1st, 2010, 8:43 pm

News to me, but okay :P
Cyclone103
 
Posts: 155
Joined: January 18th, 2010, 6:47 pm

Re: Returning to Lobby from Game

Postby Swoopjockey » March 2nd, 2010, 5:09 am

Thanks for clearing things up!
Swoopjockey
 
Posts: 21
Joined: February 5th, 2010, 2:17 pm

Re: Returning to Lobby from Game

Postby Benjaminsen » March 2nd, 2010, 9:12 am

I will look into updating the TicTacToe example to include a back to lobby button.
Benjaminsen
.IO
 
Posts: 1444
Joined: January 12th, 2010, 11:54 am
Location: Denmark


Return to Multiplayer