How to add seperated custom GS to LoadBalancing Project

Options
N D
N D
edited October 2012 in Photon Server
Hi, while working with Load Balancing on my own server setup, I realized I need to develop new game server for handling some logging information to and from my DataBase.
How can I add a new GS and what considerations I have to take? Is there any sample or documentation (except that one on the ExitGame web site) for helping me?
And also I want to publish the new GS to another server. Do I need to copy the whole deploy folder to new server and run the photon on that machine with new IP and port in config file?


Thank you...

Comments

  • N D
    Options
    Most boring forum I ever seen. Is there anyone here?
  • dreamora
    Options
    Yes
    But I guess most people didn't consider doing what you try to do and instead go by the split of master and game server, implementing the game logic on the game server and stuff like login on the master server

    There is no documentation on the matter beyond the general LoadBalancing documentation (as it is, like all other Photon applications, just an example of what you can do with the Photon Socket server and the libraries) but you have the sources at hand and the Server2Server communication to achieve whatever you basically
  • Hi,
    N D wrote:
    How can I add a new GS and what considerations I have to take? Is there any sample or documentation (except that one on the ExitGame web site) for helping me?

    As dreamora pointed out: You can change the GS code in any way you want - if you read the Loadbalancing section of our docs (http://doc.exitgames.com/photon-server/LoadBalancing/), you should get a good understanding of the basic concepts. I guess your "GS" should not actually handle clients, you want it only to transfer data between your "real" game servers and the database - right? In that case, you can have a look at the "LoadBalancing.GameServer.OutgoingMasterServerPeer" and the "LoadBalancing.MasterServer.GameServer.IncomingGameServerPeer" classes as a starting point, for example - that's the place where we handle communication between Master and Game Servers, and I guess you want to do something similar between your "regular" Game Servers and your custom GS.
    And also I want to publish the new GS to another server. Do I need to copy the whole deploy folder to new server and run the photon on that machine with new IP and port in config file?

    Basically, yes. (Ports can be the same on all servers, in most cases).
    Most boring forum I ever seen. Is there anyone here?

    Exit Games is based in Germany, Europe - we are here, but at a different time. ;)

    Let us know if you have any more questions.
  • N D
    Options
    @dreamora
    Having 2 game servers and some clients connected to, I want to be able to log kill counts and some scores to database. I think I have to have another game server specified for this purpose beside the 2 main game servers. But I don't know how to pass data from one sever to another.

    @Nicole: I'll check "LoadBalancing.GameServer.OutgoingMasterServerPeer" out soon.

    Thank you.
  • dreamora
    Options
    That would be a job for the Server2Server API that the LoadBalancing server has.
    That or naturally communication through the database itself.

    And no you don't need another game server for that. Just take the sources you have for the GameServer and expand its logic so it can do that :)
    While the stock LoadBalancing GameServer is focused on offering 'message routing and relay', that is not all it can do :) We added calls to Mathematica for example to offer mathematical calculations for our application, doing DB is no different than that and in .NET generally pretty easy to do actually
  • N D
    Options
    The logic is done but by calling unity's wwwForm from masterclient machine to an asp.net web service. I want to add this .Net functionality to my GameServer and delete the unity www calls. And you're right I wouldn't need another GS only If the all game servers inherit from one single GameServer class [how the LoadBalancing seems to be structured]. So by adding custom logic to GameServer Class and deploy on 2 separate machines, all will have the added logic?

    Now the game calls some of my custom functions on MasterServer for initilizing the game information from Database in lobby. It works very well with my custom operation codes and handlers. But for GameServer I didn't get results. I'll try harder soon.

    Now I have 2 questions:
    - Question #1 : how much Photon opCustoms (UDP) are faster and more secure than encrypted WWW calls? I mean do I need to change my www calls to photon operations at all?

    - Question #2 : Do I need to separate DataBase server's machine from PhotonServer? I'll use a normal VPS with 1 or 2GB RAM. I'd like to have them on the same machine, the network delay would get much lesser than any other situations. But somewhere I read once to separate them if possible!

    Thank you.
  • dreamora
    Options
    N D wrote:
    The logic is done but by calling unity's wwwForm from masterclient machine to an asp.net web service. I want to add this .Net functionality to my GameServer and delete the unity www calls. And you're right I wouldn't need another GS only If the all game servers inherit from one single GameServer class [how the LoadBalancing seems to be structured]. So by adding custom logic to GameServer Class and deploy on 2 separate machines, all will have the added logic?

    Yes.
    All GameServers are equal code wise. They are just 'load distributors'

    N D wrote:
    Now the game calls some of my custom functions on MasterServer for initilizing the game information from Database in lobby. It works very well with my custom operation codes and handlers. But for GameServer I didn't get results. I'll try harder soon.[/code]

    That would be the job for Server2Server communication. That or make the master server init the stuff in db and hand back the id of the 'config item in db' to the master client which upon creating the room passes it as init.
    N D wrote:
    Now I have 2 questions:
    - Question #1 : how much Photon opCustoms (UDP) are faster and more secure than encrypted WWW calls? I mean do I need to change my www calls to photon operations at all?

    The two things have nothing in common and not even the same use case.
    WWW is to talk to a webservice, ops is to execute a command on the master server or game server (not reachable through WWW)

    in both cases the security relevant code is under your control so security wise you can consider them equivalent if you put the equal effort in.

    And no you have no need to change anything on that end. Actually handling Login for example through a webservice is a good idea especially when a website is in the mix too. The webservice upon verified login can return a session token the client then provides to the game server (and potentially master server depending on your lobby implementation) to allow user lookup in the db and verification of validity of the token.

    N D wrote:
    - Question #2 : Do I need to separate DataBase server's machine from PhotonServer? I'll use a normal VPS with 1 or 2GB RAM. I'd like to have them on the same machine, the network delay would get much lesser than any other situations. But somewhere I read once to separate them if possible!

    You don't need to do it if you don't want to, but it limits your scalability as the DB will use one or more cores of your machine.
    You first should always '80-90% max out' one machine with photon before adding multiple ones in especially when you add db, as you then can make use of less game servers and instead use larger memory caches in the game server to reduce the number of db requests required.

    Also with DBs being pretty RAM intense and with this little ram, you might definitely want to have it on an own vps, at least when hitting live / large scale usage.

    For the tests and alpha, potentially even beta, using a single vps with 1-2 gb ram is enough, just ensure that it has appropriate cpu power (photons support to hook into windows own performance measurement is a great tool here to detect if the cpu is insufficient. on the db side, you will get to see it on the query times)