Search Unity

Help Wanted How to get multiplayer on webgl

Discussion in 'Multiplayer' started by zapyray, May 6, 2021.

?

Is it possible to create a multiplayer browser game with unity?

  1. Yes

  2. No

  3. Depends on the requirements

Results are only viewable after voting.
  1. zapyray

    zapyray

    Joined:
    Jul 30, 2019
    Posts:
    2
    Hey guys,

    I am making a website for webgl games. Most of my games will be single player but I will have a couple of multiplayer games. Mainly board games and a platformer that you can play with a few friends. I would probably never have more than 6 players and there is no automatic match making.

    I want to know that with the current unity webgl builds , what are my options(if I have any) so players on my website can play with their friends.

    Some places say its impossible while some suggest it is possible with a few restrictions

    Would love to know what you guys think.

    btw , I don't have any knowledge of unity multiplayer yet but I will pick up a framework and start learning , soon as i know what my options are.
     
  2. Joe-Censored

    Joe-Censored

    Joined:
    Mar 26, 2013
    Posts:
    11,578
    WebGL has significant networking limitations imposed by web browsers. I believe you're limited to acting as a web socket client only. There are several networking API's for Unity which have web socket support for WebGL builds. I believe Mirror is the most popular.
     
    zapyray likes this.
  3. zapyray

    zapyray

    Joined:
    Jul 30, 2019
    Posts:
    2
    Awesome , that's the most clear answer I have ever heard !!

    A quick question,
    Should I start learning mirror or wait(and start learning) the new unity networking solution?
    Also , would one framework work for both mobile and web ?
    of course the way I communicate with the server would change
     
  4. Joe-Censored

    Joe-Censored

    Joined:
    Mar 26, 2013
    Posts:
    11,578
    I haven't done any WebGL networking myself. I see that the original creator of MLAPI (the now official networking solution from Unity), has a web sockets wrapper posted to github.

    https://github.com/MidLevel/MLAPI.WebSockets

    My recommendation would be to try them both and see which one you like. I don't know if web sockets for either networking implementation are also supported on mobile.
     
    zapyray likes this.
  5. DaveA

    DaveA

    Joined:
    Apr 15, 2009
    Posts:
    298
    I'm using Photon with my webGL game, seems to be fine. I do need help with it, will pay, contact me if interested.
     
unityunity