Convert from Photon Realtime to Server

ZZyrex
edited May 2015 in DotNet
Is there an easy way, or a simple set of principles to follow to easily switch over an application from Photon Realtime to Photon Server?

Comments

  • The Photon Server comes with a "LoadBalancing Application". That is pretty much fully compatible with the Photon Cloud / Realtime and you just have to run the pre-built binaries and adjust the client to connect to your own server. That's it.

    This helps starting the server:
    http://doc.exitgames.com/en/onpremise/c ... er-in-5min
  • I got that all setup, which is kind of self-explanatory any way. What I am unsure of is how do I convert some of my client/server code into a client - server - client format.

    With realtime each client acts as a server as well as a client, so setting up the gamelogic was just a simple few edits in the OnEvent()/OnOperationResponse fields which I can't seem to find any where with the server demo. I do have this all setup with an edited version of the loadbalancing client API class library is it not possible to just sort of "plug'n'play"?

    If not, how/what do I edit on the server side to reproduce my goals such as sending a create room event, handling that event and sending a response back to all the clients. The documentation http://doc.exitgames.com/en/onpremise/current/reference/load-balancing just describes the concept of loadbalancing which I understood from the realtime doc anyway.

    Thanks for your help
  • Basically LoadBalancing applications works like Photon Cloud but locally. In best case you do not need to change anything on client side.

    After cloud switched to nameserver use some month ago, connection workflows become different. If your client already uses nameserver, make it connect to master server instead (LoadBalancingClient.Connect() method).
  • Ah thanks, that's awesome! Where/What do I edit to input things to handle the events sent from clients? I'm currently looking at the LoadBalancing Server demo and can't seem to find a place to do this.

    Also, I run a
    if (!Connect()) {
        DebugReturn(DebugLevel.ERROR, "Can't connect to MasterServer: " + MasterServerAddress);
    }
    

    The console returns, it successfully connects to the gameserver/master server. But when attempting to create a room using opCreateRoom it just returns a "Connection not ready" and after about 10-15 seconds it just times out. What is going on here?
  • 1.) To analyze the connection problems:
    Are you running client + server on the same machine?

    If yes - please set the Photon Control -> GameServer IP Config to "localhost". If no - please set it to an "internal" IP if client + server are in an internal network, set it to "auto-detect / public IP" if Photon is hosted on a separate server with a static, public IP.

    Then copy /deploy/bin_tools/loadbalancing.client to the machine from which you want to run your own client, modify the server address in the *.config and run the loadbalancing client.

    If that works, you have verified that you have set up the server correctly. If that does not work - please let us know and provide the /deploy/log/GSGame.log + MSMaster.log files.

    2.) if that works and you still can't connect with your client, please show the full code of your own client, so that we can see what is missing.

    3.) to modify the handling of client events, take a look at the /src-server/Loadbalancing/GameServer/GameClientPeer class as a starting point, especially the OnOperationRequest method.