Client encounters an error when it joins room

Options
iwahara
iwahara
edited January 2015 in Native
Hi.

In my game, when multiple clients join room, Photon sometimes says to a third client.
"Client.cpp onOperationResponse() line: 700 - opJoinRoom failed with errorcode -1: Join failed: UserId already joined the specified game.. Client is therefore returning to masterserver!".

I looked into this issue, joinRoomReturn() seems to be called from onConnectToMasterFinished().
What should I do?

FYI, all clients connect to room by the same way and a second client is fine, but third one, forth, fifth.... sometimes encounter this error.

Comments

  • Kaiserludi
    Options
    Hi iwahara.

    Please assure that whatever you pass to the constructor of class Client as username is unique per client.
    This is a unique identifier and no two clients should share the same username.

    If you want it to be possible for your users to have the same nick name, then please either just use a custom display name player property or use a combination of their displayed nickname + some extension to make it unique as their Photon username.
    demo_loadBalancing from the Client SDK for example attaches the current timestamp to assure a high likelyhood of uniqueness. You may even want to use a combination of the current timestamp and a random value in case two clients manage to start the game within the same millisecond.
  • iwahara
    Options
    Thanks, your point is correct.
    I'm setting same username between multiple clients sometime.
    You helped me a lot!