Search Unity

Non-Auth Multiplayer Without A Server?

Discussion in 'Multiplayer' started by WannaDev, Oct 6, 2011.

  1. WannaDev

    WannaDev

    Joined:
    Feb 12, 2011
    Posts:
    12
    edit: maybe I should have said dedicated server

    I'm just starting to get ahold of networking in unity, but it seems that all of the tutorials I come across assume I want to put out a game wherin clients connect to an authoritative server I maintain. I get why, security and all, but that's not the case with this.

    What I'm working on is a strictly small-scale co-op game, say 1-4 players. There's no need for an authoritative server, as who cares who "cheats" if people are co-operating with friends?

    What I'd like is the ability to have a player load up the game, create a server, and other players connect to that. A server browser would require a maintained server on my part, I believe (right?), but I don't see any reason why the option to directly connect shouldn't also be available.

    I know the Third Person non-auth portion of the networking examples basically does this, but I find myself getting bogged down in either components of the other examples from the project or the superfluous non-networking aspects. I tried modifying that example to simply turn the third person view into a first person one, simply changing the control components and attaching a camera to the actor-prefab, but I've either screwed up the data syncing or somehow made the actors invisible in the process.

    Does anyone know of a tutorial which just shows that simple process? Just allows 2 clients to connect peer-to-peer, perhaps with rudimentary control of a simple primitive for display purposes? This looks right, but requires I run a fox server in the tutorial.
     
  2. ar0nax

    ar0nax

    Joined:
    May 26, 2011
    Posts:
    485
    Last edited: Oct 6, 2011
  3. appels

    appels

    Joined:
    Jun 25, 2010
    Posts:
    2,687
    You don't need an authoritative server at all.
    To make the server non-authoritative, make each user spawn it's own player instead of the server spawning them.
    I assume you are also talking about the master server, you don't need to use it but the problem you will have then is that the client won't get a list of available servers. So you will have to enter the remote ip address yourself.
     
  4. flamy

    flamy

    Joined:
    Feb 7, 2011
    Posts:
    194
  5. WannaDev

    WannaDev

    Joined:
    Feb 12, 2011
    Posts:
    12
    K, but I DO need an auth server to do a server browser/lobby, got it, thanks. I assume it's also possible to mix/match the two. Use an auth to get players into the game, then once it's started they run it themselves. Should be a reasonable means to get something working within the max connection limits of most of the free networking/server architecture out there, as the only active connections would be those waiting to play.
     
  6. appels

    appels

    Joined:
    Jun 25, 2010
    Posts:
    2,687
    nope, you don't
     
  7. WannaDev

    WannaDev

    Joined:
    Feb 12, 2011
    Posts:
    12
    You'd have to, to have a dynamic list of open servers, right?

    edit: I'm sure the Z2H guide will set me straight on this. Thanks for the help.
     
    Last edited: Oct 6, 2011
  8. appels

    appels

    Joined:
    Jun 25, 2010
    Posts:
    2,687
    nope, authoritative != master server.
    Master server = relay host so clients can connect to servers, doesn't have any game logic.
    The only thing it does is send a list of available games to the connected client so it can connect to them.