Spawning Game Servers with central Master Server

n0f34r
edited October 2011 in Photon Server
Hi,
I've been researching on how to create a list of Game Servers whenever the user is done with the authentication process on one single Main Server, and I've found that version 3 of photon provides an example that does precisely this, LoadBalancing. By looking at the code, I was wondering if something like this was possible to achieve only by using the latest version of Photon, or also version 2, which is the one I currently developed the server and client in.

Thanks!

Comments

  • loadbalancing does not spawn game servers, they are always there actually.


    Theoretically nothing prevents you from implenting the same on Photon 2, but you would have to do it all yourself as the LoadBalancing is photon 3. Also there is the problem that there was little to no server 2 server api in Photon 2, which it uses too if I recall right
  • Even though LoadBalancing doesn't spawn game servers, would it be still possible to do so? In your experience, how much needed is really spawning different instances of servers using Photon, compared to just using a single instance? I'm not sure what's the maximum amount of players that can be handled by one instance, and how much it's feasible for MOGs, compared to doing something like LoadBalancing.

    Thanks!
  • No its not possible.
    Photon can not fire up new instances and applications at runtime, you have to restart it.
  • Depending on the game you can handle at least 1k of players at the same time, being very active. Most likely you can get around 5k players.

    Depending on your cloud hosting service, you can fire up new machines through an API. If setup correctly, with Photon running as auto-started service, you can ramp up new GameServers which would auto-connect to the Master. This is pretty advanced and is needed later on. If you just follow the example workflow that Photon Unity Networking has, you can handle most users with hand-started machines anyways.
  • Thanks Tobias, I've looked again at the Photon Unity Networking example and I've noticed that it uses the same structure of the Load Balancing project used in the photon 3.0 SDK. I have a few other questions regarding this:

    1) Is it possible to start up new Game Servers on a given machine, maybe one per core, automatically at run time, or will I need to do that manually by adding new Application in the config file before running PhotonControl.exe?
    2) Is it possible to retrieve the current number of players from the server and compare it with its maximum capacity so that you will know when to connect to a different Game Server?

    Thanks!
  • 1) manually in the config file. And its also not really needed as a single gameserver can use more than one core. The idea of gameservers is to spread them over machines :)

    2) I might be a tad stupid but why would you need to know that? If you ever have a pressing need to know about it then your design has a flaw to a major flaw that makes it load balancing incompatible (it shouldn't matter on which game server the room is as its just 'photon' to the client and master client, you have no further knowledge over where you even are)
  • dreamora wrote:
    1) manually in the config file. And its also not really needed as a single gameserver can use more than one core. The idea of gameservers is to spread them over machines :)

    2) I might be a tad stupid but why would you need to know that? If you ever have a pressing need to know about it then your design has a flaw to a major flaw that makes it load balancing incompatible (it shouldn't matter on which game server the room is as its just 'photon' to the client and master client, you have no further knowledge over where you even are)

    1) Yes, that's what "Load Balancing" means.

    2) We need to know that for various reasons, to determine server load to determine if we need to add more servers. What we're trying to do is to not instantiate a simple lobby system but create a Master Server -> Slave Networking Model. This allows us to Load Balance and allow more than 5,000 players to be connected at once.
  • Denko wrote:
    dreamora wrote:
    This allows us to Load Balance and allow more than 5,000 players to be connected at once.
    QWell, thats exactly the task, which the LoadBalancing-application will care about for you, so that you do not have to do this yourself.
  • The load level is reported from the game server to the master server. The master server then makes sure that your game clients are redirected to the server with the lowest load -or to the one that is not yet full depending on how you configure it. You can define a load level limit in the loadbalancer constructor to return a "server full" message when all servers exceed it. This load level can depend on different factors, per default it just uses the peer count. But it's a single line that you can change to include operation execution time and CPU as well. The master server does not start new servers out of the box, you would have to add this if you need it.
  • Boris wrote:
    The load level is reported from the game server to the master server. The master server then makes sure that your game clients are redirected to the server with the lowest load -or to the one that is not yet full depending on how you configure it. You can define a load level limit in the loadbalancer constructor to return a "server full" message when all servers exceed it. This load level can depend on different factors, per default it just uses the peer count. But it's a single line that you can change to include operation execution time and CPU as well. The master server does not start new servers out of the box, you would have to add this if you need it.
    We understand that it doesn't add new servers out of the box, our question is in terms of scaling can you dynamically add different server machines and the master server will automatically keep track of the slave server list? Or are the game servers locally on the same machine?
  • you can add new game servers any time, they don't have to be on the same machine.
    They just need to know the master server address.
  • Boris wrote:
    you can add new game servers any time, they don't have to be on the same machine.
    They just need to know the master server address.
    Thanks Boris, this helps a lot.