Search Unity

  1. Unity Asset Manager is now available in public beta. Try it out now and join the conversation here in the forums.
    Dismiss Notice
  2. Unity 6 Preview is now available. To find out what's new, have a look at our Unity 6 Preview blog post.
    Dismiss Notice
  3. Unity is excited to announce that we will be collaborating with TheXPlace for a summer game jam from June 13 - June 19. Learn more.
    Dismiss Notice

Networking UNET and WebGL. Authoritative server.

Discussion in '5.1 Beta' started by medvedya2012, Jun 1, 2015.

  1. medvedya2012

    medvedya2012

    Joined:
    May 27, 2014
    Posts:
    41
    Hi.
    I'm working on the multiplayer game with Unity and WebGL.
    At the moment I use WebSockets and JavaScript wrapper for Unity client. And my custom server as a host. It is working not very well, because I'm not good at network technologies.
    I have a couple of questions about UNet.
    1)Is WebGL supported Unet?
    2)How can I make authoritative server with Unet.
    3) What solution to make multiplayer game with WebGL is better?
     
  2. Whippets

    Whippets

    Joined:
    Feb 28, 2013
    Posts:
    1,775
    I don't know anything about WebGL, but it is possible to make an authoritative server with uNet, although I understand that Phase2 of uNet will be designed specifically with dedicated servers in mind (which is what we want for multiplayer authoritative game scenarios). At the moment, the LLAPI NetworkTransport is the best option for a separate server.

    Maybe someone else can help you with the WebGL parts of your questions :)
     
  3. seanr

    seanr

    Unity Technologies

    Joined:
    Sep 22, 2014
    Posts:
    669
    The new networking system is designed to work in either a peer-to-peer mode with one peer as the "host" or in a dedicated server mode. The HLAPI supports both of these modes with very few code changes. In general with UNet your best option is to use the HLAPI unless you have specific requirements that dont allow it.

    You can run a headless Unity standalone player as a dedicated server using the HLAPI. This is currently the best path going forward for using UNet, and the one we plan to support in future phases.

    Specifically for WebGL, UNet support is not mature on that platform. WebGL does not support UDP networking (which the LLAPI is based on), so it requires additional work from Unity developers to support this platform. It is on our roadmap to fully support WebGL, but the timing is not clear yet.
     
  4. CineTek

    CineTek

    Joined:
    Jul 12, 2013
    Posts:
    98
    I thought Unity had made a workaround for this limitation in WebGl as stated more than one time in other posts? Just for testing the new api I have made a little multiplayer game using UNET and WebGL and the only thing that makes it impossible for me to play it in the browser (using the matchmaking system) is a problem with the CORS header that makes it impossible to access data on another server which is obviously required with the built-in matchmaking functionality.

    You will get errors like these "No 'Access-Control-Allow-Origin' header is present on the requested resource"