Search Unity

"Old style" FPS Multiplayer

Discussion in 'Multiplayer' started by HolBol, Sep 19, 2012.

  1. HolBol

    HolBol

    Joined:
    Feb 9, 2010
    Posts:
    2,887
    Okay, to start with, I'm not looking for code, just an if-possible-then-how type question to be answered.

    Is there some way I could set up multiplayer like older games have? As in- you can host the game, using your PC as a server, and clients join directly to you. Of course, you have to do the old port forwarding trick etc but that's hardly a tough task.

    Each 'host' (the player who is hosting the game) can create rooms of up to a certain number of players, and decide the map to play etc. The name of the map should be sent to the client which would load it from files they already have (coming preinstalled with the game), so all players are on the same map.

    Is that possible- to have the host player as the server?

    And here's another question- if that was possible, how would you go about getting lists of people who are hosting games? Would you then need a central server to control that?

    Thanks.
     
  2. PrimeDerektive

    PrimeDerektive

    Joined:
    Dec 13, 2009
    Posts:
    3,090
    That's exactly what Unity's built-in networking is designed to do. If you download the Networking Example, or get better yet, Leepo's Ultimate Networking Project, it'll walk you through everything. The networking example project has a master server scene. I think the star trooper tutorial goes over the master server too.

    Players host games, the master server is only a server application that maintains a list of available games and their IP addresses.
     
  3. HolBol

    HolBol

    Joined:
    Feb 9, 2010
    Posts:
    2,887
    So do you reckon it would be simple to do, to an extent?

    And would I need to buy my own server eventually?
     
  4. PrimeDerektive

    PrimeDerektive

    Joined:
    Dec 13, 2009
    Posts:
    3,090
    Yeah, dissect the networking example from the resources section and do the star trooper tutorial first (just ignore the touch stuff, you could swap it out for regular input). That will get you started.

    If you plan to have a server browser list in the game that lists currently hosted player games, then yeah, you'll eventually need a server. Unity provides a public one for development purposes only. You could host it on an amazon EC2 instance though, the master server is a really lightweight application that doesn't do much.
     
  5. HolBol

    HolBol

    Joined:
    Feb 9, 2010
    Posts:
    2,887
    Turns out I can't run an EC2 cos whatever- I need something UK based. Does anyone know of an alternative?
     
    Last edited: Sep 21, 2012
  6. PrimeDerektive

    PrimeDerektive

    Joined:
    Dec 13, 2009
    Posts:
    3,090
    is EC2 only for north americans?

    I actually have a VPS from burst.net because its dirt cheap and I live in Scranton, PA; their one datacenter is like a mile from my house. But it looks like they have one in Machester. You're not going to beat $5.95/mo :) (well, actually, micro instances of amazon EC2 are free, but if they're not available to you, boo)
     
    Last edited: Sep 21, 2012
  7. HolBol

    HolBol

    Joined:
    Feb 9, 2010
    Posts:
    2,887
    So VPS' will work, right?
     
  8. PrimeDerektive

    PrimeDerektive

    Joined:
    Dec 13, 2009
    Posts:
    3,090
    As long as they provide root access, yeah (burstnet's do).
     
  9. hesa2020

    hesa2020

    Joined:
    Jul 27, 2011
    Posts:
    261
    Last edited: Sep 23, 2012