Search Unity

Connecting browser clients to Unity for a Jackbox style game

Discussion in 'Multiplayer' started by Jomsss, Dec 30, 2018.

  1. Jomsss

    Jomsss

    Joined:
    Jun 19, 2017
    Posts:
    3
    Hi everyone, I am creating a party game where the players connect to a desktop Unity app through browser, like the Jackbox games. The problem is, I have no idea how to setup the networking between the two. I was wondering if anyone could point me in the right direction.

    I was doing some research and came to the conclusion that I should use UNet to host the server on the Unity app and NodeJS on the website to connect to it. Am I on the right track here?

    If that's the case, should I worry about the UNet deprecation or just start developing with it?

    One last question: Jackbox games use a four character keyword that the players input onto a website. To have something like this, would I have to have an outside server to keep track of all the running games?

    Thanks a bunch!
     
  2. mgear

    mgear

    Joined:
    Aug 3, 2010
    Posts:
    9,448
    Jomsss likes this.
  3. Jomsss

    Jomsss

    Joined:
    Jun 19, 2017
    Posts:
    3
    Alright I ended up using a Socket.IO server that the web pages and Unity app all connect to.

    Does anyone here know if there’s a way to make this without a dedicated server? As in, the Unity app starts a socket.io server on the user’s machine when a game starts and the web pages all connect to that, instead of having the socket.io server hosted elsewhere.
     
  4. Joe-Censored

    Joe-Censored

    Joined:
    Mar 26, 2013
    Posts:
    11,847
    My understanding is browsers don't allow WebGL to act as a server, only a client. I haven't confirmed this independently. Even if it could, you'd need a strategy to handle hosts with non-routable IP addresses (behind NAT router) which generally requires you to set up a server anyway.
     
    Last edited: Jan 3, 2019
  5. MindTipGames

    MindTipGames

    Joined:
    Oct 1, 2016
    Posts:
    10
    I'm going to follow this as I'm interested in the overall solution and potential asking to license it from who ever comes up with it. Right now, airconsole.com appears to be the closest product in existence today to develop towards. But I don't like their subscription terms and the limit to using the browser only. Prefer that Jackbox model of create and distribution. LMK if anyone is actively working on a project and could use a dev mind to consult and work with.
     
  6. BlinksTale

    BlinksTale

    Joined:
    Dec 15, 2013
    Posts:
    13
    I went down this path and found a solution robust enough for my game's needs! Small but professional indie title. Sharing here in case anyone is deep diving this question and wants a robust but affordable solution:

    1. Heroku server is running Node.js with Socket.IO
    2. Unity client uses "SocketIO for Native and WebGL builds" from the asset store by DasPeTe (the free one didn't work for my needs)
    3. Phone browsers use html5 pages delivered by the server

    Then use Socket.IO rooms to ensure nothing is accidentally sent between different gameplay sessions, and write your own code for handling how a socket/connection translates into either a host or a player, rejoining, persistence, etc. Jackbox gave a great AWS talk in 2015 about how they did this at a larger scale entitled "Quiplash: Multiscreen, Multiplayer Game for 10,000"

    tl;dr: for hobby with minimal control, use AirConsole. For indie with small amounts of control, Heroku + Node + SocketIO. For larger audiences and control, AWS + Node + SocketIO probably still (Jackbox used websockets at the time I think, but a lot has developed in the world since then).

    Hope this helps someone! I want to play more games in this format. :)
     
    krougeau and influjensbahr like this.