Can rejoin room in demo load balancing(C++)

guipong
guipong
edited April 2015 in Native
Hi everyone,

I run demo load balancing v4-0-1-1 to test rejoin the last room, but it doesn't work.
This is the code in demo:
case INPUT_2: // join Game
                        mpOutputListener->writeLine(L"\n=========================");
                        // remove false to enable rejoin
                        if(mLastJoinedRoom.length())
                        {
                            mpOutputListener->writeLine(ExitGames::Common::JString(L"rejoining ") + mLastJoinedRoom + " with actorNr = " + mLastActorNr + "...");
                            mLoadBalancingClient.opJoinRoom(mLastJoinedRoom, true, mLastActorNr);
                        }
Server responses error:
opJoinRoom failed with errorcode -1: Rejoin failed: unknown actor nr=1. Client is therefore returning to masterserver!
Does anyone have the same error?

Comments

  • Hi guipong.

    Have you actually joined the room before?
    Rejoining won't work, if that client has never been in that exact room before.

    When creating a room by a call to opCreateRoom() or by a call to opJoinRoom() with createIfNotExists set to true, you can specify values for the playerTtl and emptyRoomTtl. Setting both those values to 0 deactivates rejoining. A non-zero value for the playerTtl specifies for how much time after a player has left that room it is allowed to rejoin it. A non-zero value for the emptyRoomTtl specifies for how much time after the last player has left, an empty room keeps existing.

    If the room still exists and also still accept rejoins from a certain player, then it will recognize that player when it leaves the room by a call to opLeaveRoom(true) (the default value for the parameter willComeBack is false, but a player can only rejoin a room that he has left with willComeBack set to true) and rejoins it by specifying the actorNr that is got assigned by that room on its initial join.
  • Hi Kaiserludi, thanks for quick response.

    Now I can rejoin with opLeaveRoom(true). However, I want to rejoin in case that a client loses the connection when it is in the room(playing game with lag network). In that case, that client could not call opLeaveRoom(true), it can only reconnect and join to the last room with last actor. Therefore, I still can not rejoin to the room. My configure: playerTtl(10000), roomTtl(10000)
  • Oh, I can rejoin now with playerTtl(100000). Thanks for your support.
  • Hi guipong.

    When a player disconnects while being inside a room that allows rejoining, then a disconnect will be treated like opLeaveRoom(true).
    Probably your client just did not manage to rejoin the room within 10 seconds after leaving, so it could not rejoin with a ttl of 10 seconds, but it could with one of 100 seconds. You will have to see what ttl values will suit your game best: They should not be too short so that your clients have enough time to rejoin, but they should also not be too long, to avoid having lots of abandoned rooms with "dead" players, that won't ever come back - if a player doesn't come back for some time, one should just assume that he won't come back anytime soon.