Search Unity

Question Server to Server Communication

Discussion in 'Game Server Hosting' started by Baene, Nov 14, 2022.

  1. Baene

    Baene

    Joined:
    Jun 1, 2014
    Posts:
    9
    Is it possible for the running hosted game instances to communicate with each other. Not between games, but between the running instances of a single game?

    Planning out a game, and whether or not this would be possible, factors heavily in the design. We are heading down a "cluster" designed, and the ability for one server to be able to send messages to another server is pretty key to the design.

    I've looked through the MultiPlay docs and couldn't find anything that spoke to this at all.
     
  2. Alexis_UGS

    Alexis_UGS

    Unity Technologies

    Joined:
    Mar 2, 2022
    Posts:
    30
    Hi!

    Interesting question! Do you mind sharing here or in a private message what is you're trying to achieve?

    As for your immediate needs, we do not expose any feature that would facilitate server to server communication. But there is nothing that prevents your servers to talk to one another. Here is a couple of examples suggested by one of our engineers:
    • If for instance is a fixed number ie 2 servers that always need to communicate with each other then I presume they could do it during matchmaking. Do an allocation to 2 servers and share their ips with each other. Then possibly just some rest api's. Almost just peer-to-peer but for their servers.
    • If for a dynamic number of their servers they could have a primary server that works as the central node. Then spin up new servers that know about the primary. The primary can be used as a relay to all the others. ie Server A and B starts and will let the Primary know they exist. Then when Server A communicates to the Primary server that then broadcasts the data to all other servers thus server B.
     
  3. Baene

    Baene

    Joined:
    Jun 1, 2014
    Posts:
    9
    Thank you very much for the response.

    The second idea there is along the lines of what we are planning. We were just not sure if we would have to have the servers contact each other via external IPs, or if there was a way they could communicate directly, privately (i.e. a private virtual network). It sounds as though, give your above responses, we would have to do it via their externally accessible IP addresses.

    My hope was that there would be a channel for private internal communication, as some of the messaging we would not want to be surfaced publicly. Would this be an option at all?

    The use case is that the game will have many running instances for different locations in the game, very likely a static number, or, at least, not runtime dynamic. Then, we have various features in game that span across the instances, such as chat, mail, knowing locations and status of friends on other instances, etc. Grouping the instances into a "cluster" then lets us skip single points of failure for these cross-cutting services.

    Hopefully that makes sense to you. :)
     
  4. Alexis_UGS

    Alexis_UGS

    Unity Technologies

    Joined:
    Mar 2, 2022
    Posts:
    30
    It totally makes sense.

    By channel, do you mean like a message queue between your backend and your game servers / game servers clusters?
     
  5. Baene

    Baene

    Joined:
    Jun 1, 2014
    Posts:
    9
    That would work, or a kind of virtual private network that contains the fleet so that they can see each others private IPs.

    The latter would then allow us to use whatever messaging mechanism we wanted since its just IP addresses, but if you would prefer your own messaging mechanism, that would be doable as well, but would obviously require some sort of API on your end for us to access.
     
  6. Alexis_UGS

    Alexis_UGS

    Unity Technologies

    Joined:
    Mar 2, 2022
    Posts:
    30
    Thanks. At the moment, we do not offer out of the box support for VPN on a Fleet, and it is not on the roadmap.
    Same for the messaging queue: it is not something we offer as part of our product, and we probably will never build either, as it is far removed from our expertise.

    My take on this would be:
    • VPN: I will ask my colleagues if we had any previous customer who built something themselves.
    • Message queue: use any off the shelf solution out there, like GCP pubsub. Please note, this will have egress costs on your game servers
     
    korlinga likes this.
  7. Baene

    Baene

    Joined:
    Jun 1, 2014
    Posts:
    9
    Thank you very much for the information, and look forward to hearing if anyone else has implemented anything similar.
     
  8. Alexis_UGS

    Alexis_UGS

    Unity Technologies

    Joined:
    Mar 2, 2022
    Posts:
    30
    After a short internal discussion, none of our customer had previously asked for VPN/VPC support, and it is not something Multiplay can support for now.

    In your scenario, your game servers will need to know about the other servers IP through a form a service discovery, either as described above, or through a backend service.