Loadbalancing different from Cloud Server

Our client asked us if we could make their application work in a place with poor or no internet connection.

We continued developing in the cloud and when we were happy with the game we started testing it on our self hosted server.
We quickly noticed that some configurations / settings of the LoadBalancing solution are a bit different then working in the cloud.

1) We had to authenticate our user by setting PhotonNetwork.AuthValues (otherwise we could not connect)
2) We noticed that some events were not being passed on to the player that was setting them. I.e. When we were settings player / room properties in the cloud everything was being passed on to ALL the players, including the player that was sending out these events.
3) We also noticed that room properties (& player properties) were often erased after level load. We are not sure if this was or was not happening in the cloud. I assume room properties should keep existing when the level reloads? In our project immediately when the new level was loaded the masterclient had correct roomproperties, the second client did not. We temporary hacked it by resending the roomproperties from the master client. A few seconds later the master client received empty room properties (don't know where they came from). Could someone explain me what is happening here?

We were wondering if it is possible to get a LoadBalancing setup that immitates the Cloud properly. This would allow us to develop our application in the cloud and afterwards move to a self hosted solution seamlessly. Is there such LoadBalancing setup / config available?

Are there any other differences between the cloud and the loadbalancing setup?


  • hi, @date

    The thing is that self-hosted SDK is quite old. and we changed a lot for a new version. Although we keep compatibility where it is possible

    1) how did you do an authentication in cloud? and what do you pass in AuthValues now?

    2) What is the size of your properties? What maximum size they may have after serialization?

    3) I assume level reloading happens in Unity. This question is better to ask in PUN forum section. I just can assume that you could lose connection to the server because of a timeout. In this case, the server will remove the game and properties will be lost

  • hi @chvetsov,

    Thank you for your quick reply!

    Do you think it is possible to get the same behavior in the self hosted version by editing the server code or do I need to patch this in my client code? If it's in the server code, any pointers where to start?

    1) I never did authentication in the cloud. It worked without. I started from an older photon boilerplate and updated my code to be compatible with the new version. I assumed authentication needs to be unique and the same for the whole session so for a quick fix I used this: PhotonNetwork.LocalPlayer.NickName+ " " + UnityEngine.Random.Range(0, 100).ToString();

    2) The size of the roomproperties could get larger. Is it limited? We are keeping track of all id's of an event that has been emitted. The more times the event gets emitted the more id's I am keeping in the room properties. The player properties were only keeping readyness of the player and their score.

    3) The logs never speak of connection lost neither do I reconnect to photon in between the levels and everything keeps on running. The levels are quite small so loading happens fast. But maybe it's a server thing somewhere that's why I thought it was appropriate here. I will ask again in the PUN forum section.
  • Hi, @date

    I will able to answer to 2) only
    2) what is MaxMessageSize in your PhotonServer.config? I assume that it is small that is why if a message gets lager it will be dropped

  • Hi @chvetsov,

    I will report back to you when I have a chance to test. It might take some time as we are currently working on a different project.

Sign In or Register to comment.