Several rooms per user

Options
Hi!

(On ObjectiveC/iOS) I would like to know how can I create several rooms per user, change between them and get the room list.

I try to use the RoomList NSDictionary but is empty!

Thanks!!

Comments

  • Kaiserludi
    Options
    Hi @Rurouni.

    It is not possible for a single EGLoadBalancingClient (or EGLoadBalancingPeer) instance to be active inside more than one room at once. This is by design.

    You can create multiple instances, but be aware that each connected instance will be counted against the CCU on Photon Cloud, so this may not make sense to you from a financial point of view.
    This is not the case however with Photon Server, as it does not know the concept of CCU, but is licensed on a per server machine basis.

    Room lists can only be retrieved while the client is inside the lobby, but not when it is inside a room. If you retrieve the room list while inside a room, then you don't get the latest state of the room list, but a snapshot from the time when that client has been in the lobby the last time.

    Please try and access the room list while the client is in the lobby and while there are definitely other clients of your game inside open rooms (on Photon Cloud those clients must use the exact same appID and version strings, otherwise you can't see rooms opened by them).

    If even then your room list is completely empty, then please share the code with us on how and when you retrieve it.
  • Rurouni
    Options
    Hi,

    In our project, our players must play against different players, a game at a time but arranged in rooms so the player can chose against who will play every moment. Something similar to "Tower Dash" or "Spider Square" (from Boombit). Any idea of how implement it?

    Thanks.
  • Kaiserludi
    Options
    Hi @Rurouni.

    Well, you could let all players that should be able to get matched together join the same lobby and then just let 2 players that want to play against each other join the same game room and after their match has ended those 2 players would leave the game room and return to the lobby to choose their next opponent.

    The tricky part is, that inter-player communication is not possible inside lobbies, but only inside game rooms, so that they could not communicate with each other to figure out who they want to play against next. You could however easily solve this by letting each player in parallel to the lobby join a Photon Chat channel, having one channel per lobby. Another advantage of this would be that the clients could continue to stay in that channel even when they are inside a game room and not in the lobby, so that they could keep each other updated about what is happening in other game rooms, if this is needed.
  • Rurouni
    Options
    Hi,

    Ok... but our matches should persist until one of the players leave the game. If some of the players leave the game, another player could enter that room?

    Thanks.
  • Kaiserludi
    Options
    Hi @Rurouni.

    Sure. As long as you let the room property IsOpen (and likely you would also want to let IsVisible as true so that the room can be seen in the lobby) stay true, another player is able to join whenever the amount of players inside that room is below the max players.
  • Rurouni
    Options
    Hi.

    Ok, so... If two players join a room, then the "isVisible" change to false... if both users leave the room, they could rejoin later that room and continue playing?

    Excuse me for the inconvenience.

    thanks!
  • Kaiserludi
    Options
    Hi @Rurouni.

    Well, kind of. It is important in this scenario, that they pass true for the willComeBack flag of opLeaveRoom(), that they pass their previously assigned player numbers on rejoining to be recognized as the same players that have previously left and that you specify the playerTtl when creating the room. The default playerTtl is 0, which means that the room gets closed immediately when no active player is inside anymore.
    However when a player leaves a room with willComeBack set to true or if it simply disconnects, then that player will be treated as still inside the room, but inactive, which means it can rejoin the room until its ttl (time to live) is up.
    A room does not get closed unless it is empty and it does not get considered empty as long as there is any player inside of it, no matter if it is an active or inactive player. Empty rooms still do not get closed until the emptyRoomTtl is up.
    At the moment at which a player turns inactive, the playerTtl for this player starts to count down. If it does not rejoin the room before its playerTtl runs out, then its status turns from 'inactive' to 'left'. The count down stops when the player rejoins and when he afterwards leaves the room again, then the countdown will start again from its original value and not from the one that it had reached by the time when the player rejoined.
    As the playerTtl get specified in ms, a player can at maximum stay inactive for about 25 days in a row, before he can't rejoin that room anymore.
  • Rurouni
    Options
    Hi!!!

    Ok, so I can enter and leave several rooms and then rejoin every time I want to play my turn?

    Thank you!
  • Kaiserludi
    Options
    Hi @Rurouni.

    Yes.