Search Unity

  1. Unity 2019.1 is now released.
    Dismiss Notice

This rumor that Unity has multiplayer support.

Discussion in 'Connected Games' started by scottlee38, Feb 15, 2015.

  1. scottlee38

    scottlee38

    Joined:
    Feb 15, 2015
    Posts:
    15
    I would like to see a video where a person has 5 people in different locations connect to his rented server to play a game while he's gone. After searching for hours I haven't seen this with unity, only videos using the word "multiplayer" in a game that can only be used on local networks.
     
  2. Brent_Farris

    Brent_Farris

    Joined:
    Jul 13, 2012
    Posts:
    881
    Hi there! :D
    I love the idea of networking as a whole and even developed my own networking system. So, basically 99% of the time if you can connect via LAN you can connect via the internet. All you would need to do is open up your firewall on your router (Port Forwarding) and then the client will need to have your external IP. The only time this will not work is if there is explicit code preventing external connections or if your Windows Firewall settings prevent it.
     
  3. christides11

    christides11

    Joined:
    May 19, 2012
    Posts:
    671
    Unity networking does work over internet, it's just that video makers are not going to spend time getting someone from somewhere else to connect while their making a video/in the iteration process.
     
  4. scottlee38

    scottlee38

    Joined:
    Feb 15, 2015
    Posts:
    15
    They don't have to connect from several places. Just at least prove in some way that it works. Nobody ever has shown themselves hosting a server then connecting to their server and just playing around randomly. They always go local access and keep leaving their servers incomplete and unhosted.
     
  5. Brent_Farris

    Brent_Farris

    Joined:
    Jul 13, 2012
    Posts:
    881
    If you wish, you can follow my tutorial series and then make it connect from outside the network rather than relying on others to do the work to prove to you. I'm sure that most people will not have the time to do so. I will say that, yes, you can connect from outside the LAN with Unity built in networking.

     
  6. JamesPro

    JamesPro

    Joined:
    Mar 5, 2012
    Posts:
    509
    Are you just talking native support as in Unity's own Networking... Or third party networking solutions as well?

    Here's is our first Google Hangout we did for Greed Monger Online. It's using the uLink suit from MuchDifferent. We have 4 or 5 of us online at once in this google hangout...


    Here is a newer video showing our Progress... Everything is hosted on a Amazon Cloud Server located on the west coast of the US. I'm located in Maine on the East Coast...
     
  7. christides11

    christides11

    Joined:
    May 19, 2012
    Posts:
    671
    You won't see it, as no game usually ever uses default networking. I can assure it works though. I have developed 2 games that worked fine over network.
    https://dl.dropboxusercontent.com/u/85846965/1GAM/Jan2013/Jan2013.html
    https://dl.dropboxusercontent.com/u/85846965/1gam/Nov2013/Nov2013.html
    of course, I don't recommend default Unity networking until UNet in 5.x.
     
  8. scottlee38

    scottlee38

    Joined:
    Feb 15, 2015
    Posts:
    15
    I meant any source so third party is fine. Are you able to set these games up with any server solution though?
     
    Last edited: Feb 16, 2015
  9. scottlee38

    scottlee38

    Joined:
    Feb 15, 2015
    Posts:
    15
    Great tutorial. I have a few questions though as networking is my weak point. Do you have to leave that PC on with the server running in order to play or do you have a way to leave the game live somewhere else? (I'd prefer the client to not be able to host the server). When you create your client, does it store models and content in the client after install?
     
  10. scottlee38

    scottlee38

    Joined:
    Feb 15, 2015
    Posts:
    15
  11. christides11

    christides11

    Joined:
    May 19, 2012
    Posts:
    671
    Unity has their own master server for general use for people to test their game, but it's recommended to run your own master server as their's is not always up.
     
  12. Brent_Farris

    Brent_Farris

    Joined:
    Jul 13, 2012
    Posts:
    881
    Hi there :). So usually what you want to do with a server is to have it constantly running on a computer somewhere. What most professionals do is run the server on a server in "the cloud", which is just a marketing term for some computer that is running in some warehouse somewhere that you pay for every month.

    Basically you start up the game on that server and then just let it run forever, checking every now and again to make sure it is still up and running. You can run a Unity instance without any Graphics in "batch mode" as well as a "headless linux" build.

    Also the client should already have the models installed from when they installed the game. You can think of a server as just a program that delegates messages and data to all of the clients, they then use this information to update positions, events, etc.
     
  13. JamesPro

    JamesPro

    Joined:
    Mar 5, 2012
    Posts:
    509
    Actually that's not true... It's not just some Marketing term for some computer running in some warehouse... Cloud based Servers are very different from Dedicated Servers or Owning your own hardware that you run in a Colo facility... Totally different tech goes into it. And if you rent a Dedicated Server or own your own hardware you wouldn't say it's in the cloud even if it's being hosted in some Warehouse...
     
  14. Brent_Farris

    Brent_Farris

    Joined:
    Jul 13, 2012
    Posts:
    881
    I'm being very simplistic, obviously there is different tech behind this idea of "cloud computing". However at the end of the day it is a stack of rack servers in a warehouse somewhere. There is software and extra hardware development that went into managing these servers, starting up and shutting down and then setting the specs on the fly. If you read up you will find that the person asking the question is new to networking and such.
     
  15. JamesPro

    JamesPro

    Joined:
    Mar 5, 2012
    Posts:
    509
    True... lol But they are very different... lol But yes in the most simplistic terms you are correct... lol
     
  16. scottlee38

    scottlee38

    Joined:
    Feb 15, 2015
    Posts:
    15
    Im familiar with what a cloud server is, but do you know of any example setups or tutorials available? I just want to make a small scale version of this on any third party server solution. Most give you a small selection of connections for free anyway.

    Edit: After reading some of the other forums it seems part of the game will be missing after a headless set up, such as graphics. There's also something about exporting sections of the game in code to counteract problems. I'll do more research but if you know any sources I can use for help it'd be appreciated. I wish they told you somewhere on the site about this, as it's more important than the models and animations themselves.
     
    Last edited: Feb 17, 2015
  17. Sbizz

    Sbizz

    Joined:
    Oct 2, 2014
    Posts:
    250
    @scottlee38 Unity gives you the source code of their master server, so you can set it up somewhere and try to connect it from your computer (you just have to change MasterServer.ipAddress). You can do the same thing with Photon and the other plugins I guess.

    I'm using Photon and I can connect several clients on my game (I already gave my game to one of my friend, just to try if everything is OK). Of course, I'm using their server, because I don't need my own server ; I don't need more than 20 connections.