Random Disconnections

Hello! I am working on game called Warmerise, and I am using Photon Cloud service for multiplayer (Currently using 100 CCU license).
Everything goes well except one strange bug, players are randomly disconnected from rooms (Some players cant even play normally)
So I wanted to know if the way I am connecting to application is right:

First game start from Connect Menu, there I am connect to lobby using next code:

[code2=csharp]void Update(){
//Try to reconnect every 3 seconds
float updateRate = 3;
float nextUpdateTime = 0;
//Do not try connect every frame, but using small intervals (To avoid lag while failed to connect)
if(!PhotonNetwork.connected){
if (Time.time - updateRate > nextUpdateTime){
nextUpdateTime = Time.time - Time.deltaTime;
}
// Keep firing until we used up the fire time
while(nextUpdateTime < Time.time){
PhotonNetwork.ConnectUsingSettings("Some Version");
nextUpdateTime += updateRate;
}
}
}[/code2]

Than after player connect to some room, I turn of networking messages while map is loading

[code2=csharp]PhotonNetwork.isMessageQueueRunning = false;[/code2]
Than turn it on when map is loaded and we ready to receive network messages
When player inside room, it uses another menu, which do now have PhotonNetwork.ConnectUsingSetting part anymore
However it have other part

[code2=csharp]void OnDisconnectedFromPhoton(){
print ("Disconnected from Photon");
StartCoroutine(LoadMap("MainMenu"));
weConnected = false;
}[/code2]

So when connection is dropped, it automatically bring player into main menu

But players reported that it load main menu in the middle of game (For some players it happens too frequently), sometimes they cant even play normally, so I assume that connection is unstable

My question is, should I check for connection even when we inside room.
Or maybe problem not even there.
I am really appreciate any help.
Thank you!

Also here is link to game: http://www.warmerise.com/

-NSdesignGames

Comments

  • The code looks ok. There could always be ping-related timeouts and disconnects. Maybe you ask the players what their ping is.
    I could play your game. There was noone with me, so it still could be a problem that manifests only when there are many players.

    Maybe we can get some customer's player log to check if we can learn something out of that. Aside from this, workflow-wise, this looks ok!
  • Tobias wrote:
    The code looks ok. There could always be ping-related timeouts and disconnects. Maybe you ask the players what their ping is.
    I could play your game. There was noone with me, so it still could be a problem that manifests only when there are many players.

    Maybe we can get some customer's player log to check if we can learn something out of that. Aside from this, workflow-wise, this looks ok!

    ok, thank you for quick response.
    This problem indeed happens when there is many players. I noticed it usually happens when there is more than 6 players

    EDIT: Other Problem fixed, but left the question

    What is the best way to got each player ping?

    Thank you!
  • If you need each player's ping, everyone has to get it (call GetPing()) and send it around.
    Usually, you don't need to send it that often, so you could skip this unless the ping is much different from before.