Quantcast
Channel: Photon Unity Networking (PUN) — Photon Engine
Viewing all articles
Browse latest Browse all 8947

Trying to JoinRandomRoom for a LobbyType.SqlLobby, but it doesn't work.

$
0
0
Here's my code, I'm not sure what I'm doing wrong:

Trying to join a room..
private void tryJoinRandomRoom()
{
PhotonJoinedRoomSignal.AddListener(onJoinedRandomRoom);
PhotonLeftRoomSignal.AddListener(onLeftRoom);
PhotonRandomJoinFailedSignal.AddListener(onRandomJoinFailed);
PhotonPlayerConnectedSignal.AddListener(onPlayerConnected);
PhotonPlayerDisconnectedSignal.AddListener(onPlayerDisconnected);

// more filter variations:
// "C0 = 1 AND C2 > 50"
// "C5 = \"Map2\" AND C2 > 10 AND C2 < 20"


ExitGames.Client.Photon.Hashtable expectedProperties = new ExitGames.Client.Photon.Hashtable {
{ "Lobby", _dungeonConfig.Name }, // "3v3RandomJungle"
{ "C0", 10} };

byte maxPlayers = (byte)_dungeonConfig.MaxPlayers;
_lobby = new TypedLobby() { Name = _dungeonConfig.Name, Type = LobbyType.SqlLobby };
string sqlFilter = "C0 >= 0 AND C0 < 50";

PhotonNetwork.JoinRandomRoom(
expectedProperties,
maxPlayers,
MatchmakingMode.SerialMatching,
_lobby,
sqlFilter);
}
Trying to join a room, on fail...
private void onRandomJoinFailed(object[] result)
{
PhotonRandomJoinFailedSignal.RemoveListener(onRandomJoinFailed);
PhotonCreatedRoomSignal.AddListener(onCreatedRoom);

// more filter variations:
// "C0 = 1 AND C2 > 50"
// "C5 = \"Map2\" AND C2 > 10 AND C2 < 20"

RoomOptions roomOptions = new RoomOptions();
roomOptions.IsVisible = true;
roomOptions.IsOpen = true;
roomOptions.MaxPlayers = (byte)_dungeonConfig.MaxPlayers;
roomOptions.CustomRoomProperties = new ExitGames.Client.Photon.Hashtable
{
{ "Lobby", _dungeonConfig.Name },
{ "C0", 20 }
};
roomOptions.CustomRoomPropertiesForLobby = new string[] { "C0", "Lobby" };
roomOptions.PublishUserId = true;


PhotonNetwork.CreateRoom(
null,
roomOptions,
_lobby);
}
The problem is, every client doesn't think a room exists, so it creates a new one. I can understand the first client, but when more clients join, the room should exist right?

Here's the message I'm getting:

Operation failed: OperationResponse 225: ReturnCode: 32760 (No match found). Parameters: {}
UnityEngine.Debug:LogWarning(Object)
NetworkingPeer:OnOperationResponse(OperationResponse) (at Assets/Photon Unity Networking/Plugins/PhotonNetwork/NetworkingPeer.cs:1540)
ExitGames.Client.Photon.PeerBase:DeserializeMessageAndCallback(Byte[])
ExitGames.Client.Photon.EnetPeer:DispatchIncomingCommands()
ExitGames.Client.Photon.PhotonPeer:DispatchIncomingCommands()
PhotonHandler:Update() (at Assets/Photon Unity Networking/Plugins/PhotonNetwork/PhotonHandler.cs:157)


Please help!

Viewing all articles
Browse latest Browse all 8947

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>