Search Unity

Match Based Multiplayer Game

Discussion in 'Multiplayer' started by DZeb, Dec 17, 2018.

  1. DZeb

    DZeb

    Joined:
    Sep 17, 2015
    Posts:
    10
    Hello,

    I need to implement a multiplayer game using web sockets to support WebGL and native
    Android/iOS app. The game needs to be room based, meaning that a player can create a two person room and another player can join. That needs to be in a lobby like environment where people join on other player's rooms.

    The problem(s) I face with the above, or I think I do (because I really hope some of them are just me understanding stuff the wrong way), trying with UNet, are:
    • WebGL doesn't support matchmaking or being host/client at the same time, so I need a dedicated server, which is fine, I am planning on deploying it on Linux on an Azure VM.
    • With web sockets active, trying with editor or native windows client I then cannot connect to said dedicated server. I can connect only with WebGL builds. Is this my fault, or is it normal and something that I can handle in the server? Otherwise it would be a problem for the native Android/iOS clients, as they wouldn't be able to communicate with the WebGL app.
    • Dedicated server (unlike a client being a host at the same time, hence multiple clients = multiple hosts), can have up to one match active as it then changes scene and other clients cannot create or join rooms. Do I need to create a master server that spawns server instances? Is there a working commercial solution, or a semi-good tutorial?
    I of course do not expect a complete answer nor for someone to build my game. I really appreciate any suggestion for any of my problems, be it theory, corrections in the above, an asset that may help or even a push in the right direction for me to search on my own.

    I am already aware of some other frameworks like Forge, which don't seem big on match-like multiplayer. Seen that TNet might be a good one for that. I am hesitant to pay for some "master server" solutions as they are based on UNet and might get abandoned with the deprecation of it.

    Thanks again in advance for any help!
     
    Last edited: Dec 17, 2018
  2. mischa2k

    mischa2k

    Joined:
    Sep 4, 2015
    Posts:
    4,347
    UNET can only do either Websockets or regular sockets, not both at the same time.
    I think UNET and Mirror(fork of UNET) are the only two networking solutions that support Websockets.
    We are working on replacing Mirror's Websocket code right now, and will work on simultaneous WebGL+Standalone afterwards. The simultaneous part shouldn't be more than a day of work, so it's definitely doable and probably released by the time that you finished your game.
     
  3. DZeb

    DZeb

    Joined:
    Sep 17, 2015
    Posts:
    10
    Thanks a lot for the suggestion, looks like a solid Asset and hope it can tackle the simultaneous support of web and native builds.
    Will definitely give it a try!
     
    Last edited: Dec 18, 2018