Search Unity

Multiplayer architecture and logging to web server

Discussion in 'Multiplayer' started by devrandomzero, Sep 4, 2021.

  1. devrandomzero

    devrandomzero

    Joined:
    Aug 2, 2020
    Posts:
    43
    Hi, I hope this is the right place in the forum to ask this question.
    Let's say that I'm about to create a 2D multiplayer game with this requirements:
    1) dedicated server (so no host/client nor p2p)
    2) from a web server the game master will be able to setup some gameplay options before the start and also be able to send events and messages back to the players within the game (like spawn an enemy). The game master interface will be purely web based (php or similar) with text and graphs.
    3) some player actions during the game (like clicking on a certain button) need to be logged and sent to the same web server for check the game ongoing status and for late analysis.
    4) latency is not a problem (ok if it's near 1 sec)


    For the point n° 1 I was thinking to use Mirror and hosting the server build on a Linux Machine.
    For n° 2 how can I send data to the server build so the game master can setup some gameplay options? With UnityWebRequest.Get?
    For n° 3 I'm wondering if:
    a) let the clients send the data to the web server directly (like a POST requests with JSON body)
    b) send everything to the server build and use it to relay the data to the web server
    c) send everything to the server build and let the web server pool data every second.

    Thank you in advance.

    Bye
     
  2. qbvbsite

    qbvbsite

    Joined:
    Feb 19, 2013
    Posts:
    83
    From the sounds of it you are going to want all your game options stored in a database that can be read by your server and your configuration website. As far as all the client actions they can all be sent to your server and if your wish to store game state those requests can also be saved to your database. If you interested you can check out my blog which is currently doing a 2d multiplayer game:

    https://forum.unity.com/threads/creating-an-isometric-2d-rpg-mmo-ongoing-series.998851/

    --James
     
  3. devrandomzero

    devrandomzero

    Joined:
    Aug 2, 2020
    Posts:
    43
    Hi James,
    thank you for the advice, now it's a bit more clear. About you blog, cool I'll check it out!
    Just another question, without dive in too much in details how can I have multiple matches (or game session) on a single server?

    Thank you again

    Bye
     
  4. qbvbsite

    qbvbsite

    Joined:
    Feb 19, 2013
    Posts:
    83
    Grabbed this from a different thread from @Joe-Censored

    "Unity can run multiple scenes at the same time through additive scenes, but they exist in the same world space. Unity doesn't have a straight forward way of creating multiple independent world spaces. Separate server instances would be the most direct way. A master server which manages server instances is a common approach. How efficient that is would depend on the resource requirements of your game server I suppose. You'll also find that AWS and other cloud platforms are fairly expensive for the resources and data you're allotted once you start scaling up."

    https://forum.unity.com/threads/multi-player-and-multi-matches-online-game.859468/
     
    Joe-Censored likes this.
  5. devrandomzero

    devrandomzero

    Joined:
    Aug 2, 2020
    Posts:
    43
    Thank you for the link.

    Bye