[Marmalade] Auto Join Lobby/Auto Match-making

edited December 2012 in Native
I am using marmalade's cloud example now. I've got it running too. This example uses 2 buttons, one creates a room and another joins a random room.
Now my problem is I need to have iOS Gamecenter kind of match-making. Where one user connects and waits for any other player to join or if any other player is also in waiting mode, it'll just connect to any random player and can start playing the game.

The issues are I still don't get few things:-

1. There's a sendEvent() method, but where can I receiveEvent? (Sorry couldn't figure it out)
2. How do I use getautojoinlobby() method or any way to create auto-join lobby? When I call joinlobby(), getautojoinlobby() or setautojoinlobby() method, nothing seems to happen. No callback gets called.
3. Is there any way to limit player count in a single game?

It'd be great if I can see any working example, if any of you have one.

Thanks for the help :-)


  • I got the first one, but still can't figure out the rest.
  • 2. If you have set the autoJoinLobby flag to false and manually call opJoinLobby() and it returns true, then joinLobbyReturn() will be called, when the joinLobby operation has been finished. If opJoinLobby returns false, then it has already failed and you won't get a callback (that can happen, if you are already in either the lobby or a gameroom, as one peer can't be in multiple rooms at the same time). If autoJoinLobby is set to true (the default), then you do not have to (and should not) call opJoinLobby() yourself, but it will always be joined automatically, when you connect to the master server or when you are leaving a gameroom (and are therefor under the hood reconnected from a gameserver back to the master). In that case connectReturn() and leaveRoomReturn() are not called until the lobby has successfully been joined, so as soon as you get these callbacks, you know, that you are in the lobby.
    3. Yes, that's the purpose of MutableRoom::setMaxPlayers()
  • Thanks for the answer. I'll try these into my game.

    Currently I am facing problem in sending and receiving data. I've posted my question on StackOverflow here.
  • Ok the only problem I am facing now is how do I get values in correct data type, like int, string, float etc. from eventContent object of Hashtable. It does return value of type integer but when I output it, it shows some random no. What is the format of getting value back from Hashtable? Currently I am using this

  • I have just answered your linked stackoverflow question.
Sign In or Register to comment.