LAN with PUN?

Options
Dibbie
Dibbie ✭✭
Hey, im trying to make a LAN setup with PUN.

Im trying to use the method "PhotonNetwork.ConnectToMaster", cause to my understanding, I cant use the Photon Cloud for a LAN setup, cause they still need to be connected to the internet, however, as long as Photon can actually connect to some type of server (in this case, something local, like the users computer or router), then it can use them as the "master server and client", so that other computers on the same network can connect and see eachother run around.

I tried 127.0.0.1 (localhost), and my computers IP, and my routers IP, but they all give me the same error...
ERROR: Receive issue. State: Connected Exception: System.Net.Sockets.SocketException: An existing connection was forcibly closed by the remote host.

WARNING: InternalReceiveException while connecting to: 127.0.0.1:144. Check if the server is available.

Maybe im looking at it wrong, im new to using PUN, so does anyone who might know how to setup a LAN with what im trying to achieve, mind explaining to me what I might be able to do, if what I am doing is wrong? And if not, provide a possible solution to setting one up?

Comments

  • vadim
    Options
    What is ip your Photon Server running on?
    You should be able to check or switch ip's in "Game Server IP Config" menu of Photon Server tray icon.
    Clients should connect accordingly to the settings.
    Also make sure that port set correctly.
  • Dibbie
    Dibbie ✭✭
    Options
    vadim wrote:
    What is ip your Photon Server running on?
    You should be able to check or switch ip's in "Game Server IP Config" menu of Photon Server tray icon.
    Clients should connect accordingly to the settings.
    Also make sure that port set correctly.

    Currently, the default IP (127.0.0.1), and I have never seen a tray icon anywhere for Photon, only an additional menu item in the Windows tab of Unity.

    And for the port... I legit have to go into my firewall settings and open it up with proper settings and everything for Photon to recognize it then? In one tutorial I watched, it didnt seem like there was anything external he had to mess with with and it worked for him.

    The current line of code I have running, is the following. When the user clicks on a button:

    PhotonNetwork.ConnectToMaster("127.0.0.1",144,MyAppID,"v3"); //C#
  • vadim
    Options
    So what is running on 127.0.0.1:144 ?
    Photon client can only connect Photon cloud or Photon Server which can be run locally
  • TechCor
    Options
    To clarify what vadim is saying, you can't connect directly to other PUN clients. You haven't mentioned in your posts whether you are running Photon Server or not, but it sounds like no.

    You'll need to download photon server and run it locally on your machine. Here's the docs on how to do this.

    http://doc.exitgames.com/en/onpremise/current/getting-started/photon-server-in-5min

    You'll probably want to use the lite application.

    Additional tip:
    If you are trying to get the server to start up from the Unity client, as you would expect from LAN play. You can use the following code to start it.
    System.Diagnostics.Process app = new System.Diagnostics.Process();
    app.StartInfo.FileName = ServerPath;
    app.Start();
    

    To close it, you could perhaps adjust the server code a bit so you could send a close event, making sure that the command is coming from the local client.
  • Dibbie
    Dibbie ✭✭
    Options
    Well, im using PUN itself, and hosting as a "cloud", though theres options for stuff like offline.

    It sounds, based on what you both said though, that some type of internet is still required, because I dont see how Photon can communicate with a server/cloud without internet, and run that locally on a machine to talk with other clients.

    Ill check the link out though, its possible Exit Games has 2 different types of networks, that im overlooking.
  • Tobias
    Options
    There is a Offline Mode in PUN. Then you can't play with anyone else, as the client skips anything that usually goes through the network.

    In all other cases, Photon needs a server. This has to run on a Windows machine somewhere. If the client and server are on the same machine, you don't need some internet but usually, you do need a LAN to play together (it's difficult to play in multiple clients on one machine).
  • Dibbie
    Dibbie ✭✭
    Options
    Tobias wrote:
    There is a Offline Mode in PUN. Then you can't play with anyone else, as the client skips anything that usually goes through the network.

    In all other cases, Photon needs a server. This has to run on a Windows machine somewhere. If the client and server are on the same machine, you don't need some internet but usually, you do need a LAN to play together (it's difficult to play in multiple clients on one machine).

    So, if I was to get the Photon Server on my machine, and export my project to another person, would they need the Photon Server running and set up on their machine if they wanted to be the host, assuming they where not in my lan? Or would it import my settings with the export?

    In addition to that, would the new Unity Network system help to set up a LAN environment any easier?

    Sorry, I am still trying to learn networking in general.
  • Tobias
    Options
    LAN server addresses won't work across the internet, so if someone else uses your game, there has to be a server available in LAN, too. IP addresses won't match in almost all the cases, so you can't export and move this around.

    The new UNet also needs to discover your host (which is a client acting as server). If it's much easier .. I don't know.

    Bolt (http://www.boltengine.com/) now belongs to the family of our products. It does a good job for LAN games without a separate server. This might be what you're looking for.
  • dontonka
    Options
    Hello Tobias, I'm also interested in LAN for my game.

    I just had a look at your Bolt asset, and note that it require Unity 5.x, Any plan to make the asset compatible for Unity 4.x ? I believe for mobile platform there is still a bunch of developers (like myself :D) that are still using Unity 4.x.

    Is Bolt based somehow on Baduma framework which crash couple 2-3 years ago?

    Cheers,
    Don T.
  • Elharter
    Options
    Hi you,
    i am also interested in this question.
    greez mike