hi, i’m trying to use photon cloud to develop a multiply mode for my game, but i really met many troubles…
here is the first one, which just make me crazy and can’t continue my job…
here is part of my code:
local photon = require "plugin.photon" local masterAddress = "app-us.exitgamescloud.com:5055" local appId = "my photon app id" local appVersion = "1.03" local client = photon.loadbalancing.LoadBalancingClient.new(masterAddress, appId, appVersion) function client:onStateChange (state) if state == photon.loadbalancing.LoadBalancingClient.State.JoinedLobby then client:joinRandomRoom() elseif state == photon.loadbalancing.LoadBalancingClient.State.Joined then local myRoom = client:myRoom() for k,v in pairs(myRoom) do print(k,v) end end end
here comes the trouble, sometimes the output will be like this:
(i think it means when i trying to join a random room and no room available, the could auto created one for me)
INFO LoadBalancingClient: State: Uninitialized -\> ConnectingToMasterserver onStateChange ConnectingToMasterserver INFO LoadBalancingClient: Connecting to Master app-us.exitgamescloud.com:5055 TRACE PhotonPeer: create INFO PhotonConnect: app-us.exitgamescloud.com:5055 start connection to host INFO PhotonConnect: app-us.exitgamescloud.com:5055 app-us.exitgamescloud.com 5055 successful start connection INFO LoadBalancingClient: Master: Connected INFO LoadBalancingClient: Master: Encryption Establishing... INFO LoadBalancingClient: Master: Encryption Established INFO LoadBalancingClient: Master: Authenticate... INFO LoadBalancingClient: Master: Authenticated INFO LoadBalancingClient: State: ConnectingToMasterserver -\> ConnectedToMaster onStateChange ConnectedToMaster INFO LoadBalancingClient: Master: Join Lobby nil nil ... INFO LoadBalancingClient: Master: Joined to Lobby INFO LoadBalancingClient: State: ConnectedToMaster -\> JoinedLobby onStateChange JoinedLobby INFO LoadBalancingClient: Join Random Room nil nil ... INFO LoadBalancingClient: Connecting to Game 173.193.192.29:5056 TRACE PhotonPeer: create INFO PhotonConnect: 173.193.192.29:5056 start connection to host INFO PhotonConnect: 173.193.192.29:5056 173.193.192.29 5056 successful start connection INFO LoadBalancingClient: State: JoinedLobby -\> ConnectingToGameserver onStateChange ConnectingToGameserver INFO LoadBalancingClient: Master: Disconnected INFO LoadBalancingClient: Game: Connected INFO LoadBalancingClient: Game: Encryption Establishing... INFO LoadBalancingClient: Game: Encryption Established INFO LoadBalancingClient: Game: Authenticate... INFO LoadBalancingClient: Game: Authenticated INFO LoadBalancingClient: Game: Connected INFO LoadBalancingClient: State: ConnectingToGameserver -\> ConnectedToGameserver onStateChange ConnectedToGameserver INFO LoadBalancingClient: Game: myActor: table: 0x7ffa6bd6ae00 INFO LoadBalancingClient: State: ConnectedToGameserver -\> Joined onStateChange Joined emptyRoomLiveTime 0 isOpen true playerCount 0 loadBalancingClient table: 0x7ffa6bd4db10 propsListedInLobby table: 0x7ffa6bd4de70 cleanupCacheOnLeave false customProperties table: 0x7ffa6bd4de30 uniqueUserId false name 744988e8-0418-419f-9b46-435c90a32cb9 suspendedPlayerLiveTime 0 removed false isVisible true address 173.193.192.29:5056 maxPlayers 0
but sometimes the out put like this:
(nothing happen after “INFO LoadBalancingClient: Join Random Room nil nil …”, the code is the same, but the outputs are different from time to time)
client:joinRandomRoom() INFO LoadBalancingClient: State: Uninitialized -\> ConnectingToMasterserver onStateChange ConnectingToMasterserver INFO LoadBalancingClient: Connecting to Master app-us.exitgamescloud.com:5055 TRACE PhotonPeer: create INFO PhotonConnect: app-us.exitgamescloud.com:5055 start connection to host INFO PhotonConnect: app-us.exitgamescloud.com:5055 app-us.exitgamescloud.com 5055 successful start connection INFO LoadBalancingClient: Master: Connected INFO LoadBalancingClient: Master: Encryption Establishing... INFO LoadBalancingClient: Master: Encryption Established INFO LoadBalancingClient: Master: Authenticate... INFO LoadBalancingClient: Master: Authenticated INFO LoadBalancingClient: State: ConnectingToMasterserver -\> ConnectedToMaster onStateChange ConnectedToMaster INFO LoadBalancingClient: Master: Join Lobby nil nil ... INFO LoadBalancingClient: Master: Joined to Lobby INFO LoadBalancingClient: State: ConnectedToMaster -\> JoinedLobby onStateChange JoinedLobby INFO LoadBalancingClient: Join Random Room nil nil ...