Search Unity

  1. Check out our Unite Austin 2017 YouTube playlist to catch up on what you missed. More videos coming soon.
    Dismiss Notice
  2. Unity 2017.2 is now released.
    Dismiss Notice
  3. The Unity Gear Store is here to help you look great at your next meetup, user group or conference. With all new Unity apparel, stickers and more!
    Dismiss Notice
  4. Introducing the Unity Essentials Packs! Find out more.
    Dismiss Notice
  5. Want to see the most recent patch releases? Take a peek at the patch release page.
    Dismiss Notice
  6. Unity 2017.3 beta is now available for download.
    Dismiss Notice

How does a client start a server instance?

Discussion in 'Multiplayer Networking' started by orionburcham, Mar 19, 2017.

  1. orionburcham


    Jan 31, 2010
    I've been learning more about Multiplayer game architecture this weekend. There are amazing resources out there, and I've been learning as much as I can about client-side prediction, physics state synchronization, packet compression, and other techniques.

    But there's something super basic I don't know, which I've had trouble finding info about: In an authoritative server setup, how does a client actually start an instance of the sim server?

    I assume there aren't servers always running, destroying some company's energy bill. So does he client call a php (or other) script on the server machine which starts a sim server with some initial parameters?

    I'm pretty sure I'm talking dumb :p, so if anyone would explain how this works, I'd be forever grateful. :)
  2. donnysobonny


    Jan 24, 2013
    Well since you've started reading, keep going! Some tips: take a look at the client-server and peer-to-peer architectures. In short:
    • the client-server architecture involves a client-side (the game/application that you ship out to your players) and a server-side (an application that you run on a dedicated server, most likely hosted by you). In this case, you are responsible for the server-side logic
    • the peer-to-peer architecture is pretty much identical to the client-server model, except that one of the players acts as both the client AND the server. This strips back the need for you to host your own dedicated server, but the drawbacks are many...
    Definitely have a further read into these, but that should give you a basic idea of the general architectures that are used.

    To answer your question though, what you are referring to sounds like "matchmaking", which is a high-level concept normally built on top of your server architecture. The idea is:
    • you have one central server, often referred to as a "matchmaking sever"
    • this server is responsible for holding lists of available players (including rank etc) and lists of current games
    • so that players can join games, the game list contains the ip address and port that can be used to access the game
    Games themselves, or "instances" as you have referred to them, are hosted either by players (peer-to-peer) or on separate dedicated game servers (client-server). Which ever way that the game is hosted, it's ip address/port is stored on the central matchmaking server for others to be able to join.

    It can obviously get a lot more complex than this. This would really be the most basic setup. What you tend to find though is that a game's server architecture is rarely just one server. There will often be many servers, each running different server applications with different purposes.

    Hopefully this helps!
  3. Joe-Censored


    Mar 26, 2013
    In an authoritative server setup, clients don't actually start any servers. Generally you will have at least 1 server running at all times that manages players looking for games. Call this a master server, matchmaker, lobby server, whatever. Once this server sees conditions that call for a new game to start (enough players have readied up in a game lobby for example), this master server sets up a gameplay server instance in some manner (launching one from scratch, repurposing one already running, etc), and tells the clients to connect to it to start their game.