How to monitor Items that are on different servers?

lazalong
edited August 2011 in Photon Server
Hey

As Photon 3.0 is around the corner I would like to know if I should wait or find now a solution. (I tried to search but couldn't find a doc or post about this).

My world consist of Regions that can each reside on another server. The goal is that a player can move from one region to the other has if he was in a single world (no "jumpsgates" and such). To do this I need something like the Mmo.InterestArea whose area could overlap 1 to 4 regions/servers if the player is in a corner of the Region.

- Does Photon 3.0 provides something to manage this?
- Should I create a Proxy of the Item that uses Fibers to communicate to the original Item?
- Do you have a sample project showing how to track Items that are on another server? Or can you point to a good solution?

A related question concerns the Peer.

- If the player moves to another region/server, must I recreate the Peer to connect to the new server? Or do you provide a "RelocatePeer" method?

Thanks in advance.

Comments

  • A first idea would be to offer the same regions on all servers and to implement a mechanism where the region messages are exchanged between the servers so that interest areas on remote machines will receive them as well. That would work well for region messages, but the high frequent position updates are published by the Item, and not the grid. I would not synchronize such updates between servers, it will be too much data and limit your scalability. So to subscribe to items on other servers you need a second (third, fourth, ...) connection. This can easily lead to too many connections. So it's probably better to host different regions on each server as you suggested and to use a second (third/fourth) connection in side/corner areas. A "RelocatePeer" method wouldn't help because you need more than 1 connection.

    To synchronize the existence of items among servers you can use a server-to-server connection. You could actually use a lite instance for your server communication to reduce the number of connections you have to maintain if there is more than 1 server. Photon 3.0 has huge improvements for server-to-server communication.

    We don't have sample projects for anything like this, sorry.
  • Ok. I will try to design a solution about Items synchronisation.
    My first impulse would be to rewrite Mmo with the Items not being responsible of sending the updates themselves but via the Regions. I must think more about this.

    When you say that a RelocatePeer wouldn't help, do you mean it is not possible?
    Can't I transfer a Peer from one server to another?
    Didn't you implement something like this for load-balancing?

    Something along the line of :
    - The server A detects that a player is moving to a location managed by server B
    - Server A sends server B a "relocatePeer" message with the relevant peer data
    - Server B initialise a new peer
    - When ready server B sends the new connections data to the client.
    - Client modifies his peer to connect to Server B.
    - Server B starts to process

    A relocate should happen only if a player "interest area" is totally in a region.
    At some point the Server B asks the Server A to redirect any operations to him.
  • I really would NOT send position updates from server to server, neither with a proxy item nor per region.
    If you say in corners you are going to switch servers only if the interest areas are fully out of scope you will have blind spots there. You can hide this with a careful level design, or just by maintaining a second connection.
    I am not sure if you could reuse the same peer instance on the client, but remember that you would be completely disconnected for a short time which is equal to going offline.
  • I am now not sure what you mean by "second connection". You mean a fiber to the neighbour server(s) to get positions updates?

    Why would reusing the peer instance incur this short disconnect time?
    Isn't is simply creating a new threaded connection in the background and switch instantly from one to the other (the authentication keys, etc can be reused)?
    The only delay could be to wait that all reliable operations are acknowledged (or -perhaps- the old connection can be kept alive during a few seconds).
  • With a 2nd connection I mean that your game client can establish a separate connection to the other server while he is still connected to the other one.
  • Oh... you mean a Peer can have more than one connections.
    If yes I didn't realise that.
  • No, but each client can have more than one peer.
    You could write a wrapper that makes it look like one though - a wrapper that manages the server switches automatically. The client lib doesn't do this out of the box.
  • Either that or you get a proxy server inbetween player and Photon Cluster that abstracts the nightmare of "which servers are involved at position X,Y,Z" and acts at the same time as load balancer.

    I don't really see it feasable nor doable to handle this from the client side, for more than one reason:

    1. Scaleability gets restricted as you end on static load balancing which requires cluster restarts, reconfigurations etc
    2. You can't runtime / dynamic load balance if the player is directly connected to your region servers
    3. Security and trustability is a concern too with more than 1 connection (duping risk and alike)
  • Hey Dreamora

    Agreed.

    Creating another Peer isn't appealing.
    I thought about your design. But as I don't see yet how to create this proxy and how it communicates with the cluster (via channels?) I was exploring the "simplest" solution of having clients connect to different server.
    Once Photon 3.0 is out I will need to take a hard look on it :)

    Any chance you know a small project of such a proxy & cluster design?
  • lazalong wrote:
    Any chance you know a small project of such a proxy & cluster design?

    Not with photon I fear.

    But that has potentially more to do with the fact that I never worked with the Cluster Addon (had no project that needed it or multi nodes on Photon so far, so I didn't request it), which might solve part of the problem as it likely should have a proxy node / load balancer node.

    There is another reason / use case for the proxy node in front in an MMO and thats login handling.
    You don't want to have that on the game server as a restart otherwise can take down a cluster node again which on most game clusters (aside of those with dedicated seperated zones like ragnarok or EQ) forces a full cluster restart to sync it up again, which is 0.5 - 4h down time once again depending on how many tries you need to sync it up all again. (the more shared data there is between the nodes, the larger the chance of a sync failure)