Performance Issue

Options
Hi I am new at this, and I cannot find the best information regarding the next question:
I am trying to create a racing game, it will have some players in the same scene. The issue is that I am loading a scene with a couple of static prefabs with a big amount of triangles and seems to be braking the load of the multiplayer and make the player Disconnect the room.

could anyone tell me how to make it work? I did by reducing the pollys of the prefab to 5% but actually this is not an option, I did try with different percentages and narrow down to 15% of Poligons but I would like to know:
- How to identify the issue, it is possible to resolve it?
- Why is photon braking because a static prefab in the scene?

Answers

  • Tobias
    Options
    Wouldn't you load this async? That should not affect the connection.

    The question is if you want to pause executing incoming messages, when some updates may depend on the scene? Check out the usage of IsMessageQueueRunning / PhotonNetwork.LoadLevel(), as mentioned in the docs.
  • Hi Tobias
    Thank you for answering so quick.
    It is a static object in the scene and I am loading the scene this way:

    - PhotonNetwork.AutomaticallySyncScene = true;
    - PhotonNetwork.LoadLevel(1);

    So would you mean to change the automaticallySync to false?

    So basically my game will connect people to an existing room when there is already players running in it. Asking if they want to start at the begining or with the position of the last player.

    But when I am trying to load the Scene with this prefab that is with a lot of detail, it fails and disconnect the player.
    Is there a way to load a scene with huge amount of data but in batches or something? then all the objects in the scene are static so it shouldn't be a problem as then don't move or anything.

    I will have a look to the docs you send and try a couple of things in the mean while. Thanks

  • Tobias
    Options
    You can set PhotonNetwork.AutomaticallySyncScene = true; in all clients. The Master Client should then use PN.LoadLevel() and the others will load it, too.

    How long does your loading take??
  • virtualsportroom
    edited March 2021
    Options
    Hi Tobias
    The Scene take to Load around 8 seconds aprox.
    The issue seems to be that when loading a huge quality scene, the track I am using seems to be the problem.
    I am using in my players Rigidbodies and the physic engine, could this send a lot of trafic to the server causing the problem?

    Here is my LobbyController methods:
    private void Start()
        {
            PhotonNetwork.AutomaticallySyncScene = true;
        }
    
    public void ConnectNetwork()
        {        
            if (PhotonNetwork.IsConnected)
            {
                PhotonNetwork.JoinRoom(RoomName);
                isConnecting = false;
            }
            else
            {
                PhotonNetwork.GameVersion = gameVersion;
                isConnecting = PhotonNetwork.ConnectUsingSettings();
            }
        }
    
        public override void OnConnectedToMaster()
        {
            if (isConnecting)
            {
                PhotonNetwork.JoinRoom(RoomName);
                isConnecting = false;
            }
        }
    
        public override void OnJoinRoomFailed(short returnCode, string message)
        {
            PhotonNetwork.CreateRoom(RoomName, new RoomOptions { MaxPlayers = Constants.MAXPLAYERSPERROOM });
        }
    
        public override void OnDisconnected(DisconnectCause cause)
        {
            isConnecting = false;
        }
    
        public override void OnJoinedRoom()
        {
            PhotonNetwork.LoadLevel(1);
        }
    

    I called the ConnectNetwork when the user enters a RoomName, then the process starts.
    Let me know if you need me to provide with anything else.
    It is hard for me to understand why a bigger prop for the scene would cause the disconnection of a user.

    Thank you so much
  • Also I might not presented the case I am chasing.
    Multiplayer Racing game for WebGL Platoform with many players in the same room although they don't necessarily start at the same time in the room.

    For the last part I can understand that the PhotonNetwork.AutomaticallySyncScene = true is needed.
    As I said earlier the issue seems to be at the moment with the set, as appears too large as if I reduce the quality I can load the scene with no problems. This issue is happening even when loading the masterclient into the scene.

    Not sure how to optimise the scene so photon don't suffer.