Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

NAT Traversal - Automatic port forwarding, punch-through, and more!

Discussion in 'Assets and Asset Store' started by thegreatzebadiah, Apr 5, 2016.

  1. Mariochi

    Mariochi

    Joined:
    Nov 17, 2016
    Posts:
    18
    Hello. I bought your asset for our game, but since the Unity announced the deprecation of UNET, I couldn't make the connection between server-client work again.

    I always get this warning;
    Can you help?


    NATTraversal: RakNet guid missing. Punch-through not possible.
    UnityEngine.Debug:LogWarning(Object)
     
  2. thegreatzebadiah

    thegreatzebadiah

    Joined:
    Nov 22, 2012
    Posts:
    836
    @Mariochi I don't think anything has actually changed yet since that announcement so I don't think that's related. Likely you changed something in your project that messed up how the guid is passed to the client. What does your StartClientAll() call look like? Are you passing in the guid from the host? Does it match the actual guid on the host?
     
  3. Mariochi

    Mariochi

    Joined:
    Nov 17, 2016
    Posts:
    18
    Ok, step by step, since I'm using the steamworks as well
    I found the error, but I don't know how to fix it.
    This is how I call the StartClientAll:
    ulong tmp = ulong.Parse(SteamMatchmaking.GetLobbyData((CSteamID)result.m_ulSteamIDLobby, "matchID"));
    StartClientAll(_publicIP, _internalIP, myPort, 0, (NetworkID)tmp, _pubIPV6, _internaIPV6, OnMatchJoined, myPassword);

    The point is: All my matchIds became 0 since this announcement (I did some tests before and the client could connect to a host).
    There is a way to call the StartClientAll without the matchID?
     
  4. thegreatzebadiah

    thegreatzebadiah

    Joined:
    Nov 22, 2012
    Posts:
    836
    You can just pass in NetworkID.Invalid for the match ID if you don't have one. I'm like 99% positive that unity's matchmaking is still up and running though, so I'm not sure why you wouldn't have a match ID if you had one before. Maybe your project came unlinked from Unity's multiplayer services somehow.

    What you're missing though is the guid from the host. You're passing in 0 there so punchthrough is not going to work. You should be adding the host's NATHelper.guid to the steam lobby data along with the match id and internal and external ip so that the client can retrieve it and pass it in to StartClientAll().
     
  5. Mariochi

    Mariochi

    Joined:
    Nov 17, 2016
    Posts:
    18
    Omg. I feel dumb right now :p

    Thank you very much. I spend hours trying to find this error.
    Now, going to git to put the blame in someone that erases a line of code XD
    And again, thank you and great asset.
     
  6. jkarian

    jkarian

    Joined:
    Feb 4, 2014
    Posts:
    3
    @thegreatzebadiah does your tool allow users to hot-join a game in progress? Currently this is not possible with Unity's network manager. Thank you!
     
  7. thegreatzebadiah

    thegreatzebadiah

    Joined:
    Nov 22, 2012
    Posts:
    836
    @jkarian I don't know what gave you that impression but you can definitely join a host at any point with UNet. In fact, UNet doesn't even really have any built-in concept of if the game is in-progress or not. Maybe you're thinking of the lobby system? All the lobby stuff is totally optional and built on top of UNet, you don't have to use any of it.
     
  8. Mariochi

    Mariochi

    Joined:
    Nov 17, 2016
    Posts:
    18
    Another question.
    Since UNET will be deprecated, you pretend make this asset work with mirror?
    Or it already work and I missed a patch note?
     
  9. thegreatzebadiah

    thegreatzebadiah

    Joined:
    Nov 22, 2012
    Posts:
    836
  10. Mariochi

    Mariochi

    Joined:
    Nov 17, 2016
    Posts:
    18
    Ok. I found another problem
    When I start the game, I receive this message when I use the ChangeServerScene()

    NATHelper: Unexpected raknet message received: ID_NAT_ALREADY_IN_PROGRESS
    UnityEngine.Debug:Log(Object)

    After a few seconds, the game diconnect and I get this message

    NATHelper: Punchthrough attempt timed out
    UnityEngine.Debug:LogWarning(Object)

    Any light for this developer that lacks coffee since monday?
     
  11. Mariochi

    Mariochi

    Joined:
    Nov 17, 2016
    Posts:
    18
    I thank you in advance in this case;
     
  12. thegreatzebadiah

    thegreatzebadiah

    Joined:
    Nov 22, 2012
    Posts:
    836
    It sounds like you're somehow starting the punchthrough process twice (NAT_ALREADY_IN_PROGRESS). The problem is possibly being made worse by the fact that when the second punchthrough time's out I consider the connection to have failed, but I think the real issue is just that it's trying to punch through twice for some reason. I'll need to see some of your code, ideally a nice self contained example that reproduces the issue.

    You could also try starting from the example code and either setting an online and offline scene (so that it changes scenes automatically when it connects) or you could modify the example code a bit to change scenes. If the problem persists in the example scene then it's likely an issue with the plugin. If the example scene works correctly then the problem is likely somewhere in your code.

    You can email me at support@email.com if you need to send me lots of code.
     
  13. Mariochi

    Mariochi

    Joined:
    Nov 17, 2016
    Posts:
    18
    Since the e-mail could not send through, I am pastebin here.
    The code only include the matchmaker functions.
    I pretend to clean it to support only match through steamworks.

    https://pastebin.com/Hc8bqS3X
     
  14. thegreatzebadiah

    thegreatzebadiah

    Joined:
    Nov 22, 2012
    Posts:
    836
    @Mariochi I believe the problem may be that you are calling ChangeScene() in both OnStartHost() and OnStartServer(). I'm not actually sure why that would cause the particular issue you are seeing, but it definitely looks suspicious.
     
  15. Mariochi

    Mariochi

    Joined:
    Nov 17, 2016
    Posts:
    18
    Well, I removed the ChangeScene() of the OnStartHost(), the scene load once then unload. I think the problem lays there, now I must find why.

    Sorry for the long absense, was sick and fever prevent my actions
     
  16. bug5532

    bug5532

    Joined:
    Aug 16, 2011
    Posts:
    307
    Any idea why punch through would be successful but then the connection will fail? It seems to happen sometimes, not always. Can not work it out at all...
     
  17. thegreatzebadiah

    thegreatzebadiah

    Joined:
    Nov 22, 2012
    Posts:
    836
    @bug5532 It *should* never happen except in the case where a firewall is blocking the connection. Unfortunately I just recently found out that satellite home internet connections are a thing, and it will fail on those networks for the same reason that it fails on mobile phone networks. I think the best I can do is try and handle the error better so that it will fall back to relays. I'm not sure how soon I can get around to working on that change though so in the mean time you may want to try and catch the error yourself and manually connect via relay when it happens.

    Sorry for the issues. I've got a new punchthrough / relay solution coming soon that I think will address these problems (and many others). I've had some luck with the punchthrough already on satellite networks but it's a little too early to promise anything yet.
     
  18. bug5532

    bug5532

    Joined:
    Aug 16, 2011
    Posts:
    307
    My problem isn't on mobile networks, these are to wired PCs. I get public void onHolePunched(int a,int b, bool success), success is true so I attempt to join the game. But then it fails to connect, just does nothing till it timesout. Should I leave a delay between receiving the onholepunched true and attempting to join the host? Sometimes it works just as expected, other times it doesn't so I'm getting real confused...
     
  19. Mariochi

    Mariochi

    Joined:
    Nov 17, 2016
    Posts:
    18
    I found the problem with the NAT_ALREADY_IN_PROGRESS. The function OnStartServer and OnStartHost both uses the nat, and causes the online scene to change twice. I just saying here because I found it curious and can help more people.
     
  20. Mariochi

    Mariochi

    Joined:
    Nov 17, 2016
    Posts:
    18
    I have another problem.
    Every time I create a match, this error occours to me.
    I already checked my firewall and checked with your facilitator.

    NATHelper: Punchthrough attempt timed out
    UnityEngine.Debug:LogWarning(Object)
    NATTraversal.<messageLoop>d__66:MoveNext() (at E:/_Noble Whale/NAT Traversal/NAT Traversal DLL/NATTraversalForUNET/NATHelper.cs:412)
    UnityEngine.SetupCoroutine:InvokeMoveNext(IEnumerator, IntPtr)
     
  21. Mariochi

    Mariochi

    Joined:
    Nov 17, 2016
    Posts:
    18
    So no, it's not change scene problem.
     
  22. Mariochi

    Mariochi

    Joined:
    Nov 17, 2016
    Posts:
    18
    my solution, I disable the punchthrough
     
  23. bug5532

    bug5532

    Joined:
    Aug 16, 2011
    Posts:
    307
    upload_2018-11-7_15-41-28.png

    I'm getting some big delays sometimes when I try to load a scene. Profiler shows a huge spike from NATHelper.messageLoop()
    Any idea what could be causing this?
     
  24. thegreatzebadiah

    thegreatzebadiah

    Joined:
    Nov 22, 2012
    Posts:
    836
    You should not need a delay between receiving hole punched and connecting to the host, in fact it would be detrimental to have one. I'm honestly not sure what the issue could be though. I've only ever seen the timeout after hole punch when dealing with firewalls or mobile networks. If you can get me the full log from client and host when the timeout occurs it would help. Also any information about the routers and networks involved would help. Are the connections dsl or cable or fibre? I know you said they are hard lines but that doesn't actually tell me much. The recent satellite connection errors were super hard to find because the user was on a wired connection to their pc and didn't even know that their modem was using a satellite connection. So wired doesn't mean much if the wire goes to a box that sends it to space.

    I also had some issues reported with a fibre connection recently but the user disappeared before I could get to the bottom of the issue so I'm not sure if that was real or not. Let me know if a fibre connection is involved though.
     
  25. thegreatzebadiah

    thegreatzebadiah

    Joined:
    Nov 22, 2012
    Posts:
    836
    Creating a match should never cause a "Punchthrough attempt timed out" since punchthrough doesn't actually start until a client attempts to connect. It sounds like you're doing something very weird.

    The punchthrough timeout is configurable though so if it's giving you issues you can set it higher and see if that helps: http://nattraversal.noblewhale.com/...helper.html#a666830314b3c5b0226baee83f141925d
     
  26. thegreatzebadiah

    thegreatzebadiah

    Joined:
    Nov 22, 2012
    Posts:
    836
    Well, that is the main loop that listens for incoming punchthrough messages, but it's not blocking or anything, so it shouldn't hold anything up. I do use WaitForSeconds() in there a couple of places though so if you're messing with your time scale that may be effecting things. I'll have to fix that in the next release, definitely an oversight on my part. Let me know if that's actually your issue though or if I should dive deeper in to this.
     
    Last edited: Nov 11, 2018
  27. LightStriker

    LightStriker

    Joined:
    Aug 3, 2013
    Posts:
    2,716
    I'm trying to use a NetworkClient, but it never ends up returning true on "isConnected".

    I have those callback which are quite similar to the NAT NetworkManager:

    Code (CSharp):
    1.         private static void OnHolePunchedServer(int natPort, ulong pid)
    2.         {
    3.             UDebug.Log("---- Got punched!");
    4.             natHelper.mapPort(natPort, 0, 0, Protocol.Both, "", null);
    5.             ExternalServer newServer = new ExternalServer(pid);
    6.             if (newServer.Listen(natPort, communication.topo))
    7.                 communication.natServers.Add(newServer);
    8.         }
    9.  
    10.         private static void OnHolePunchedClient(int natListenPort, int natConnectPort, bool success)
    11.         {
    12.             if (connecting.isConnected)
    13.                 return;
    14.  
    15.             if (!success)
    16.             {
    17.                 UDebug.Log("---- Punchthrough failed");
    18.                 return;
    19.             }
    20.  
    21.             UDebug.Log("---- Punchthrough success. Mapping port.");
    22.  
    23.             natHelper.mapPort(natListenPort, 0, 0, Protocol.Both, "", null);
    24.  
    25.             int port;
    26.             ulong pid;
    27.             string ext4, int4, ext6, int6;
    28.             if (!communication.ParseConnectionInfoFromMatchName(connectingMatch, out ext4, out int4, out ext6, out int6, out port, out pid))
    29.             {
    30.                 UDebug.Log("--- Failed to parse match string.");
    31.                 return;
    32.             }
    33.  
    34.             string address = communication.pickCorrectAddressToConnectTo(ext4, int4, ext6, int6);
    35.             int natListenSocketID = NetworkTransport.AddHost(communication.topo, natListenPort);
    36.  
    37.             UDebug.Log("---- Connecting to " + address + " on port " + natConnectPort.ToString());
    38.             connecting = new NetworkClient();
    39.             connecting.Connect(address, natConnectPort);
    40.  
    41.             NetworkTransport.RemoveHost((int)clientIDField.GetValue(connecting));
    42.             clientIDField.SetValue(connecting, natListenSocketID);
    43.         }
    Callbacks are raised properly on both end. However, I never manage to have a NetworkClient with a valid connection. I feel I'm missing something very simple.

    I never get the OnServerConnect callback.
     
    Last edited: Dec 7, 2018
  28. thegreatzebadiah

    thegreatzebadiah

    Joined:
    Nov 22, 2012
    Posts:
    836
    It looks like you've got the basic idea right. If you're on Unity 5.6 or later I believe you can simplify some of the client code though. Instead of NetworkTransport.AddHost/RemoveHost and that nasty bit of reflection you can just set the client's hostPort before connecting to get it to connect from the natListenPort.

    But, it should work how you have it here so I don't think that's the issue.

    Maybe you're missing the Update method that makes the external servers work?

    Code (CSharp):
    1. virtual public void Update()
    2. {
    3.     natServers.ForEach(server => server.Update());
    4. }
    Or maybe your host has a firewall that is blocking the connection.

    I would look in to those two things first and let me know. If it's not either of those issues then I'll probably need to see more code.
     
  29. LightStriker

    LightStriker

    Joined:
    Aug 3, 2013
    Posts:
    2,716
    The natServers collection is in the NATTraversal.NetworkManager... So I assume it should do the update?
     
  30. thegreatzebadiah

    thegreatzebadiah

    Joined:
    Nov 22, 2012
    Posts:
    836
    Yeah it should, unless you're overriding Update() and not calling the base method. Really not sure what it could be other than that or a firewall. If you can send me a project that I can use to replicate the issue I can try and dig in to it a bit more. Preferably not your entire project, but an isolated example that demonstrates the issue. You'll probably find the problem while putting the isolated example together, but if not send it my way and I'll take a look. You can contact me directly at support@noblewhale.com
     
  31. worx93

    worx93

    Joined:
    Mar 3, 2015
    Posts:
    7
    Hi,

    I notice there is a lot of info on this thread, but sifting through it, I don't know if anyone has brought up integration into Unity's Network Lobby asset on the asset store. Essentially, for right now, I'm using the exact same setup that they have there, connecting directly with an IP address, or using the Unity matchmaking. The only problem I'm having, and the reason I bought the asset, was connection issues over the internet, that required manual port forwarding.

    I've messed around with it for several hours now, but am unsure how to integrate the scripts into my current setup. Holes are successfully being punched between the client and the server, but I'm not sure what else needs to be done once that happens, in order to connect to the lobby scene.

    Thank you very much!
     
  32. thegreatzebadiah

    thegreatzebadiah

    Joined:
    Nov 22, 2012
    Posts:
    836
    Hi @worx93,

    The plugin definitely will work with the Network Lobby from the asset store but I believe it does take a bit of coding to get it up and running. It's been a while since I've walked someone through it but mostly it comes down to switching the network lobby script to extend from NATLobbyManager instead of Unity's NetworkLobbyManager. I believe you'll also need to use the NATLobbyPlayer instead off the NetworkLobbyPlayer. There are probably other details that I'm not remembering but hopefully they are pretty obvious after you make those two major changes. If you still have issues contact me at the support email and I can help you directly.
     
  33. MihkelT

    MihkelT

    Joined:
    Sep 18, 2014
    Posts:
    21
    Hi Thegreatzebadiah, planning to use this for commercial project. Bit concerned about how much load can the NATT relay server take, especially on launch week. Do you have any stats on load testing or how durable it is? What's the number of players on relay server that is "absolutely safe". Are we talking thousands, 10k, 50k, 200k? Let's assume we allocate enough AWS server capacity to facilitate that.
     
  34. thegreatzebadiah

    thegreatzebadiah

    Joined:
    Nov 22, 2012
    Posts:
    836
    @MihkelT The NAT Facilitator is not a relay, it only handles the initial handshake between clients, so it uses less resources than a relay would (which is already very minimal compared to a dedicated server). Essentially it means that a single small server should be enough for almost any size game. At most you may want to load balance by region to reduce ping, but you will almost certainly never see significant load on the servers.

    All that being said, the plugin includes a copy of the server for you to host yourself so you can run as many servers as you deem necessary, and with something like AWS you can even automatically grow the servers or spawn new ones as needed.

    My personal recommendation would be to set up one Facilitator per region that you plan on launching in and use AWS geographic routing (or something similar) to pick the closest server to the client when they resolve the domain.
     
  35. worx93

    worx93

    Joined:
    Mar 3, 2015
    Posts:
    7
    I originally posted a question on the forums a few weeks ago, and was told to write directly if I had any additional issues. Since I didn't really get a response from the email route, I figured I'd just post my message again here.

    I'll lay things out as best I can, so that there's a clear picture of the situation. I've been coding in Unity for a few years now, so hopefully it isn't one of those obvious mistakes, though I've only been doing networking for the last few months.

    So a few months back, I downloaded the Network Lobby asset, and after manually port forwarding my router, was able to host a game through direct IP connection, and play with a friend over the internet. So I know that the code for that was working properly. I mainly got this asset to avoid forcing players to do manual port forwarding on their end in order to play.

    I am doing everything the same as before, but now I am first waiting for the confirmation that a hole has been punched between the server and the client. I can confirm that a hole is being punched, and soon as it is, I use the indicated port number in a call to StartHost(), wait a few seconds, then call the client to try to connect to the host. Normally after a couple of seconds, the client should connect to the host, but in this case, it just waits on the connecting screen until it times out.

    I replaced the NetworkLobbyManager and NetworkPlayer with the classes you mentioned, but there was no noticeable change. Do I need to perform some simultaneous port forwarding operation in addition to the punchthrough?

    Any help would be greatly appreciated. This networking business is very annoying!
     
  36. worx93

    worx93

    Joined:
    Mar 3, 2015
    Posts:
    7
    After checking the forums for a little while, I notice that I was not starting a socket on the port provided for the client, on the OnHolePunchedClient function. Do I just add in the code from the NatHelper script?

    Will I also run into problems with direct IP connections if I am not using StartHostAll() and StartClientAll(), but just using the NAT Punchthrough?
     
  37. thegreatzebadiah

    thegreatzebadiah

    Joined:
    Nov 22, 2012
    Posts:
    836
    @worx93 You should be fine if you just don't override OnHolePunchedClient at all. The default functionality will handle connecting and some other complicated stuff. If you do need to override it for some reason you shouldn't do anything with connecting and you should call base.OnHolePunchedClient() so that it handles the connection stuff.

    Yes, if you only use punchthrough then direct connections will not work. Your best bet is to stick with StartHostAll() and StartClientAll(). Using those methods handles creating the direct and punchthrough connections simultaneously and picking the best one to use.
     
  38. worx93

    worx93

    Joined:
    Mar 3, 2015
    Posts:
    7
    Okay, so I went in and implemented the StartHostAll() and StartClientAll(), and things seem to be connecting now. However, using the Network Lobby asset from Unity, the actual match roster of players does not seem to populate like it normally did. I believe this is because OnClientEnterLobby() is no longer being called in the LobbyPlayer script.

    Any ideas on how to get that functionality back up and running? I am already inheriting from NATTraversal.NATLobbyPlayer, instead of the normal NetworkLobbyPlayer.
     
  39. thegreatzebadiah

    thegreatzebadiah

    Joined:
    Nov 22, 2012
    Posts:
    836
    Not sure about OnClientEnterLobby(), I don't remember needing to change anything involving that method. Do you have Unity Matchmaking enabled on the Network Manager? The matchmaking is necessary for the match list to work so if that is off that may be the issue. Also do you see messages in the console about the match being created on the host or ListMatches being called on the client?
     
  40. worx93

    worx93

    Joined:
    Mar 3, 2015
    Posts:
    7
    Unity Matchmaking is enabled on the script. I think I may have been unclear when I said "match roster". I meant when a player hosts a private, direct ip game, the lobby where they are waiting as other players join in does not get populated with the other players who join. The connection seems to go through, since I put in debug statements, but the function that normally instantiates the prefabs for the different player slots is not being called. It was normally being called by the overridden OnClientEnterLobby() function in the LobbyPlayer script, but it seems since I made it inherit form NATTraversal.NATLobbyPlayer, instead of NetworkLobbyPlayer, it no longer calls the function when a player connects. At least, that's the only thing I can make of the situation.

    I noticed in your NATLobbyManager script, you seem to need to call OnClientEnterLobby() explicitly. Not sure what significance that has.

    It's getting fricken closer!
     
  41. worx93

    worx93

    Joined:
    Mar 3, 2015
    Posts:
    7
    Maybe it has something to do with OnLobbyClientConnect(), instead of OnClientEnterLobby()? One or both of these aren't being called.
     
  42. thegreatzebadiah

    thegreatzebadiah

    Joined:
    Nov 22, 2012
    Posts:
    836
    @worx93 My guess is that you are overridding OnClientConnect but not calling the base method as that is where OnLobbyClientConnect and OnClientEnterLobby() get called from.
     
  43. TunaWithSalmon

    TunaWithSalmon

    Joined:
    Jul 1, 2018
    Posts:
    1
    Is is possible to add support for Mirror (Unet community edition). And is it even possible?
     
  44. thegreatzebadiah

    thegreatzebadiah

    Joined:
    Nov 22, 2012
    Posts:
    836
    @TunaWithSalmon

    It is not possible unless you switch Mirror to use UDP instead of the default TCP, which would mean you lose all reliability unless you write your own reliability layer. And even then it would take a significant amount of work to actually integrate with Mirror. I looked into it for a bit and it was not looking pretty.

    I do have another plugin coming out soonish though that will add punchthrough and relay support to Mirror and will work with TCP, so I suggest waiting for that.
     
  45. BonneCW

    BonneCW

    Joined:
    Jan 22, 2017
    Posts:
    123
    Hey,

    I already wrote you a mail two weeks ago, but didn't receive an answer yet, so I'm asking here again.

    I tried to build a connection using NATTraversal without Unity matchmaking because I have my own one. On the host I call:

    StartHostAll(serverName, maxPlayers);

    Afterwards I sync externalIP, hostInternalIP and the guid of the NATHelper to my matchmaking and the other players.

    On the other client I then try to connect via

    StartClientAll(extIP, intIP, 0, guid);

    Performing these steps I get on the host the following output:
    NATHelper: Hole is punched on port: 53332

    On the client:
    NATTraversal: Attempting to connect directly: 192.168.2.100
    NATTraversal: Attempting to connect through hole 192.168.2.100:53332
    ClientDisconnected due to error: Timeout

    Both machines are in the same local network. The host is a Windows machine, the joining client an iMac. And I use Unity 2017.4.18 if it matters.

    Hope you have an idea what might be the cause for this problem.
     
  46. thegreatzebadiah

    thegreatzebadiah

    Joined:
    Nov 22, 2012
    Posts:
    836
    Usually if it makes it all the way to "Hole is punched" and "Attempting to connect through hole" but fails to connect it means that a firewall is blocking the host.

    Also, I think it's unrelated to this issue, but your direct connect port that you are passing in to StartClientAll() probably shouldn't be 0. It should be the networkPort from the host's NetworkManager. Otherwise simple direct connections will never work and it will be forced to use punchthrough even when it's not actually necessary.
     
  47. Farage

    Farage

    Joined:
    Apr 25, 2014
    Posts:
    39
    Hey Zebadiah
    I'm planning on buying your asset, but since UNet is being deprecated, i'm being held back for not knowing how far or how i can use this
    I am planning however on building the entire server logic into the client and having it NAT punch creating a player-hosted multiplayer logic (listen server logic)
    Is this possible with your asset without using UNet? (and if i may ask, is this possible at all?)
    Thank you in advance
     
  48. CloudyVR

    CloudyVR

    Joined:
    Mar 26, 2017
    Posts:
    709
    I am in need of upgrading my project to 2019 editor. But this asset shows 118 compile errors. What should I do?
     
  49. thegreatzebadiah

    thegreatzebadiah

    Joined:
    Nov 22, 2012
    Posts:
    836
    @trappist-1 You're going to have to wait for 2019 to go live. Unfortunately I do not support beta or alpha versions of the editor. Hopefully by the time it is released I will find a work around for the dependencies on the Networking namespace that is going away. Most of the examples are going to become worthless though as they were built around UNet so it's going to be less straight-forward to use NAT Traversal in the future. I will try and add an example for the new Unity networking. I will not be adding Mirror support due to technical incompatibilities between RakNet and Mirror.

    If you are looking for Mirror support you will have to wait for my next asset to be released, which is punchthrough combined with relays. It is designed in a more flexible way that will be able to support Mirror.
     
  50. thegreatzebadiah

    thegreatzebadiah

    Joined:
    Nov 22, 2012
    Posts:
    836
    It sounds like you're describing the standard player-hosted peer-to-peer situation, so yes it is definitely possible. It is also possible without UNet by using the NATHelper, but it will require a bit more setup than the standard UNet stuff. There is an example included that demonstrates how you would use the NAT Helper. The general principles should apply to any UDP socket based networking system (which is most of them, but not Mirror).