DotNet SDK and Unity3d plugin intercommunication problem

Options
anyachumack
edited March 2015 in DotNet
Hi all! I have a problem when I try to connect players from unity project with Unity3d Photon plugin, and players from console app with photon DotNet SDK. If both players use Unity3d plugin, they can join each others' rooms without problems. If both players use DotNet SDK, the situation is same, two players can join same room. The problem is reproduced when I try to connect DotNet SDK player to room that was created by the player with Unity3d plugin, and vice versa. They just don't see each other.

The case is as follows:
Player1 (from Unity game) is connected to Eu region server and joined to the default lobby.
Player1 creates a room in this lobby.
Player2 (from console app) is connected to Eu region server and joined to the default lobby. This app uses the same Protocol (UDP), PhotonAppId and AppVersion as the Unity game.
Player2 gets the list of rooms in default lobby and receives 0, while it is expected that he would see the room created by Player1.

Why this could happen? Could this players be somehow on different "servers" or in different environments, etc. Basically, how to make this players see each others' rooms?

This code from project, where I using Unity3d plugin. I connect to server:
PhotonNetwork.ConnectUsingSettings ("0.1");
Then. I create or join room:
case PeerState.JoinedLobby:
				var rooms = PhotonNetwork.GetRoomList ();
				bool isJoining = false;
				
				foreach (RoomInfo room in rooms)
				{
					if (!room.open)
						continue;
					if (room.removedFromList)
						continue;
					
					if (room.playerCount == 1)
					{
						if (!isBot|| (isBot && room.name.Contains("BOT") == false))
						{
							PhotonNetwork.JoinRoom (room.name);
							isJoining = true;
							LoadingScreen.Instance.UpdateMessage(TextManager.joinedRoom);
						}
					}
				}
				
				if(!isJoining)
				{
					string roomName = System.Guid.NewGuid().ToString();

					RoomOptions roomOptions = new RoomOptions();
					roomOptions.maxPlayers = 2;
					
					if (isBot)
						roomName += "BOT";
					
					PhotonNetwork.CreateRoom (roomName, roomOptions, null);
					
					LoadingScreen.Instance.UpdateMessage(TextManager.creatingRoom);
				}
				
				break;

And this code from project, where I using DotNet SDK. I connect to server:
public class Bot : LoadBalancingClient
	{
		const string PhotonServerAddress = "app.exitgamescloud.com:5055";
		const string PhotonAppId = "myappid";
		const string PhotonAppVersion = "0.1";

		public bool IsAlive { get; private set; }

		public Bot()
			: base(ConnectionProtocol.Udp)
		{
			IsAlive = true;
			ConnectBot ();
		}

		public void ConnectBot()
		{
			AppId = PhotonAppId;
			AppVersion = PhotonAppVersion;
			MasterServerAddress = PhotonServerAddress;
			PlayerName = "PlayerBot";
			Console.WriteLine("Started connecting to photon");
			ConnectToRegionMaster("Eu");
		}
public override void OnOperationResponse (OperationResponse operationResponse)
		{
			base.OnOperationResponse(operationResponse);
			Console.WriteLine("Operation response: State " + State + ", ReturnCode: "+ operationResponse.ReturnCode + " / " + operationResponse.DebugMessage);

			if (operationResponse.ReturnCode == ErrorCode.NoRandomMatchFound)
			{
				Console.WriteLine("!!!!No free room found. Creating new...");

				string roomName = System.Guid.NewGuid().ToString();
				roomName += "BOT";

				RoomOptions newRoomOptions = new RoomOptions();
				newRoomOptions.MaxPlayers = 2;

				OpCreateRoom(roomName, newRoomOptions, null);
			}

			if (State == ClientState.JoinedLobby)
			{
				Console.WriteLine("!!!!Joined lobby, try joining room...");
				OpJoinRandomRoom(null, 2, MatchmakingMode.FillRoom, null, null);
				
			}
		}

Please, help me! I need to get this working to create AI bot for my online game in unity3d and run it on server!

Comments

  • Tobias
    Options
    PhotonNetwork and the LoadBalancing API are not compatible. Even if you did find games from the other package, the players can't interact.
    The reason why you won't find gamers of the other package is that PUN adds it's version string to the GameVersion you define. It makes sure that clients with a new PUN variant don't crash into older clients which could cause bad behaviour.

    You can use the Photon Unity SDK in Unity and the DotNet SDK for other clients. The LoadBalancing API is in both packgaes. It's just PUN that is different.