SQL Matchmaking doesnt put players in same room
Options
I'm currently trying to use SQL matchmaking however whenever I have two clients running, they never seem to join the same game. They should connect to the same game since the server sql string is the same as the room settings!
Here is my code:
This method is called within OnConnectedToMaster().
Here is my code:
This method is called within OnConnectedToMaster().
void MakeSqlMatchmakingJoinAttempt() { if (joinAttempt < maxSkillDeviation) { string sqlLobbyFilter = "( C0=1 )"; PhotonNetwork.JoinRandomRoom(null, 4, ExitGames.Client.Photon.MatchmakingMode.FillRoom, newLobby, sqlLobbyFilter); joinAttempt++; Debug.Log("Attempt failed.. trying again."); } else { Debug.Log("No rooms found. Creating Room"); CreateSqlMatchmakingServer(); } }When game attempts to join room:
void MakeSqlMatchmakingJoinAttempt() { if (joinAttempt < maxSkillDeviation) { string sqlLobbyFilter = "( C0=1 )"; PhotonNetwork.JoinRandomRoom(null, 4, ExitGames.Client.Photon.MatchmakingMode.FillRoom, newLobby, sqlLobbyFilter); joinAttempt++; Debug.Log("Attempt failed.. trying again."); } else { Debug.Log("No rooms found. Creating Room"); CreateSqlMatchmakingServer(); } }When creating Matchmaking Room
void CreateSqlMatchmakingServer() { RoomOptions newRoomOptions = new RoomOptions(); newRoomOptions.isOpen = true; newRoomOptions.isVisible = true; newRoomOptions.maxPlayers = 4; //alter this for game mode type. //C0 = Map //C1 = Mode (2v2,3v3) //C2 = Skill level newRoomOptions.customRoomProperties = new ExitGames.Client.Photon.Hashtable() { { "C0", 1 } }; newRoomOptions.customRoomPropertiesForLobby = new string[] { "C0" }; Debug.Log("Custom props: " + newRoomOptions.customRoomProperties); PhotonNetwork.CreateRoom(Random.Range(0, 10000).ToString(), newRoomOptions, newLobby); }please help!!!!
0
Comments
-
Yeah in Start() I have
newLobby = new TypedLobby("ChampionBrawlLobby", LobbyType.SqlLobby); newLobby.Type = LobbyType.SqlLobby;
and I have two clients running, I will create a room in one client, then when the second client tries to join a game, it doesn't recognize a game has already been created by the first client and creates another room. So in the end there are two rooms, both with one player in them instead of the desired two players in one room. I've also tried to use "C0 = 1" no luck0 -
Please can you tell us which PUN version do you use?0
-
Please make sure your clients are on the same server and use the same virtual app (region, appid, GameVersion and PUN version must match). But I assume it's the same build in your test case.
Also make sure the first client created the room a moment before the second searches for it.
If you use an older PUN version, please update. We figured out that Unity has a little bug with C# properties. When we didn't use a backup field, they were not assignable as the demo code shows (with curly brackets)...0 -
I'm on version 1.66 according to the Changelog.
I'm also just building the game and running the same client twice so region, appid, game version and PUN versions must match. (Same build.)
I also waited 10 seconds before running the second client.0 -
We could not reproduce the issue yet. We checked if the brackets in your "where" clause are OK for Photon, checked other variations, etc. It all works fine, as far as we can see.
I can't see how your code decides that you couldn't join a room. You just state it failed, directly after calling JoinRandomRoom(). I hope you do realize this takes a roundtrip and PUN either calls OnPhotonRandomJoinFailed() or OnJoinedRoom() eventually?0 -
Actually, I used your code in our scripts (rough, quick copy paste job) and it worked for me.
Check this: http://pastebin.com/RTN0y8fu
In doubt, please change the GameVersion before you try again. Maybe you used C0 for a string value first, then switched to numbers. This would confuse our server about the type of values you intend to use.0 -
Hi @Tubbly,
In your first post there is a duplicate code blockMakeSqlMatchmakingJoinAttempt
. Is this intended? Do you call it in both cases? ("within OnConnectedToMaster()" and "when game attempts to join room").
Sometimes the issue "is not what we think it is". How do you initialize and resetjoinAttempt
andmaxSkillDeviation
?0 -
the duplicate code block was actually a mistake, I never noticed that lol, I think I pasted it in twice. I've now resolved the issue using Tobias' pastebin example. Working great now! Thanks for the support!!JohnTube said:Hi @Tubbly,
In your first post there is a duplicate code blockMakeSqlMatchmakingJoinAttempt
. Is this intended? Do you call it in both cases? ("within OnConnectedToMaster()" and "when game attempts to join room").
Sometimes the issue "is not what we think it is". How do you initialize and resetjoinAttempt
andmaxSkillDeviation
?
1 -
Good to know you could make it work.
Did you analyze what went wrong originally? Can you let us know?0