JoinRandomRoom isn't random?

Options
I'm pretty new to Photon (PUN) so I'm sorry if I'm just missing something :s but whenever I set up two rooms, and get a bunch of clients to join them via PhotonNetwork.JoinRandomRoom() they all preferencially join one room first.

Now this may just be my terrible luck but I've run the test a few times and it seems like all the clients will attempt to fill one room before the other. A particular case I tested to further prove this precidence in room choice is to fill the first room, let the remaining clients start joining the second room, and then if I clear up some space in the first again it regains its priority and is filled full again before the second.

It looks like maybe it works off of a randomly ordered list and fills from the first rooms to the last...? I've tried it both in and out of a Lobby (e.g. via JoinLobby()) and that didn't seem to change anything.

Am I doing something wrong here? Is it just not really random? Or is my luck so bad that it looks like it isn't random :p

Thankyou for taking your time to read this! I'm looking forward to learning more about PUN and appreciate any help I can get.

Comments

  • Tobias
    Options
    Well. Yes, JoinRandom is not entirely random. It attempts to fill rooms instead of distributing players evenly. This makes most sense (we think) when games need X players to start.

    There is an option to distribute players, if you wanted to have "some" players visiting any room available.

    In PUN 2, use PhotonNetwork.JoinRandomRoom with the MatchmakingMode parameter. The mode has 3 options, which are explained in the docs / comments.
  • AppleZaft
    Options
    Thank you Tobias for clearing that up!

    Glad I'm not going crazy :p ! You raise a very fair point and I'll look into the MatchMakingMode :)