AoTTG-2/AoTTG-2-API

AoTTG2: Self Hosted Photon Server Discovery Protocol

Lithrun opened this issue · 0 comments

REQUIRES INTEGRATION WITH THE AOTTG2 Photon Server

This issue will be spread between the three repositories (API, Server & Client). In regards of the API:

  • Add three new endpoints to swaggerhub (controller: SelfHostedServer):

    • "Register". This POST endpoint will be called when starting up any AoTTG2 Photon Server which has the "Self Hosted Photon Server Discovery Protocol" enabled. (Should the API return an API key or an ID?) The request body contains:
      • Name (Used by players when looking up a server in the client)
      • IP Address (Used in order to connect to the server.)
      • Port (By default this is 5055. Can this ever change? If not, then it's not required)
      • CCU Limit (Used to determine the max capacity of the Photon Server. Can we read this from the license?)
      • Mode (Used to determine if the Photon Server runs AoTTG2, AoTTG Legacy or Hybrid logic. By default AoTTG2 is always assumed)
    • "HealthCheck". This PUT endpoint will be called by the AoTTG2 Photon Server. This will be used to update the Photon Servers status. If the Photon Server is not registered, this endpoint should return a 409 with an error message to indicate that the Photon Server needs to Register itself. The request body contains:
      • ID / API KEY
      • Amount of Users connected
      • Ping / Latency
    • "Discover". An endpoint which will return all active Photon Servers. This endpoint MUST use pagination. The response body will return an paginated array of: Name, IP, Port, CCU Limit, Mode, Amount of Users, Ping / Latency
  • Add a hosted service which runs automatically every minute. This hosted service will "unregister" / delete Photon Servers which did not send a health check within 5 minutes.

Nice to haves (but not required. If these take a significant amount of time, rather create a new issue):

  • API Keys. These could be given to trusted self hosted Photon Servers to give them a "semi-official" status, unlocking additional features on its Photon Server such as unlocking access to the other API endpoints.

Original message @Lithrun

Although, I think it will more be like this

  1. Registering the self-hosted photon server
  • You host an AoTTG(2) Photon Server locally
  • It will send an HTTP Request to the "Photon Server Discovery API".
  • This server has now registered itself, and can be chosen within the game
  • Every few minutes, a health check will be send to assure that the server is still available, including the available CCU left.
  1. Using the Photon Server Discovery API
  • Upon opening the game, there will be a list of "official" & "unofficial" servers.
  • When selecting the unofficial servers, the game will call the "Photon Server Discovery API", and give you a list of self hosted Photon Servers you can use
  • Select a server, and you will connect to this self-hosted Photon Server

Major advantage of this, is that hosting costs will be kept low, and that players can host the servers which assures that even if the community scales in a large size, that there will be more than enough server capacity.