1 vs 1 matchmaking not by JoinRandomRoom

what's the best way to achieve the following:

1 player starts a game, if no player near him created a room (by near him I mean gps longtitude and latitude), he creates a room. if someone near him created a room, he joins the first room he finds thats "near him".

I already have the gps longtitude and latitude, and I can measure the distance between players in km's, I need a way to achieve this with photon, help please.


  • Hm, tricky question.
    I think this could be done with the "SQL Lobby". It uses custom room properties (you could set longitude and latitude) and you can find matches based on your own, custom filters which include < and > comparison. A JoinRandomRoom request will fail if no room was created with coordinates close enough, based on your own.
    If you don't find a match, just try again in a moment with a wider area accepted.

    The client side of that is described here (not for PUN but you should be able to "transfer" the description easily):
    http://doc.exitgames.com/en/realtime/cu ... -and-lobby

    You might want to use PhotonNetwork.countOfRooms to check if there are just a few or a lot of rooms available. With few players, you have to make sure they find a match quickly - no matter how far away. With more players and rooms, you should make the matchmaking more fine grained.
    It's more important to match players than to keep them apart from each other waiting for others to join.

    Let us know how this works out for you.