Outpost Universe Forums
Outpost Series Games => Outpost 2 Multiplayer => Topic started by: Arklon on September 05, 2016, 07:03:24 PM
NetHelper is now included in Outpost 2 1.3.6 or later.
I made a mod for OP2 that adds automatic port forwarding via UPnP or NAT-PMP/PCP for direct TCP/IP play. It also makes the game's net code bind to all adapters, which makes the "Hamachi fix" (steps 4-6 of the Hamachi setup guide (http://outpost2.net/hamachi.php)) no longer necessary for use with Hamachi or other VPNs, and resolves issues with multiplayer in WINE. Your router must have UPnP or NAT-PMP/PCP enabled for the port forwarding to work; one is by default for most routers. NetHelper is compatible with NetFix, but may be used as a substitute for it. You may even see NetFix's reliability improve with the port forwarding.
Download link: NetHelper.zip (http://arklon.outpost2.net/other/NetHelper.zip) (current version: 1.5.2, last updated 11/10/2016)
To install, extract NetHelper.dll to [Outpost 2 folder]\NetHelper\NetHelper.dll. Then, open [Outpost 2 folder]\outpost2.ini, and change the line under [Game] that says:
LoadAddons = "NetFix" to
LoadAddons = "NetFix, NetHelper" Then add to the bottom of the .ini:
[NetHelper](Note: if port forwarding isn't working, try setting LeaseSec to 0 if your router uses UPnP, or add "AllowPMPReset = 1" if your router uses NAT-PMP/PCP)
Dll = "NetHelper\NetHelper.dll"
BindAll = 1
ForwardMode = 1
LeaseSec = 86400
For more information, see the included readme.txt.
Source code is included as well, and is licensed under the LGPL.
Confirmed it works, one less hassle to deal with.
Good job Arklon
Good job Arklon. He was just talk about it, but then he actually did it. Let this be an example for all of us who want to help. Let's just do it.
Awesome work Arklon! Very exciting! I've gone ahead and integrated NetHelper into the macOS version. I'll let you know how well it works as soon as I get a chance to test it. :)
Good job. I'm quite impressed that you just went ahead and did this.
Great work, really impressed and this will really help, great and needed improvement that the game needs for sure.
Thanks for shearing the source, will you upload it to the SVN?
Hopefully get some time to test this out property soon.
I made an update to it. I replaced the local IP address auto detection code, and patched OP2's "your local IP address is" message to display your external IP address instead (requires UPnP).
I made another small update to it yesterday, but it's pretty much just making code simpler, it's not likely to affect anything.
Also, some bad news: I found out that WINE doesn't implement Microsoft's UPnPNAT API. I'm gonna look into using a different UPnP library, probably MiniUPnP (http://miniupnp.free.fr/) (and add NAT-PMP support as well).
Updated to 1.3. It now uses MiniUPnP instead of Microsoft's API, so it should hopefully work in WINE now.
I wrote a code path for NAT-PMP, but realized that I cannot really control the external ports my requests get mapped to with it, making it pretty much useless unless I can figure out how to deal with that, so I disabled it (for now at least).
You also said something about Microsoft not offering dynamic port forwarding yet, and had already deprecated static port forwarding. Does the library change affect this?
Happy to hear this will work under Wine.
You also said something about Microsoft not offering dynamic port forwarding yet, and had already deprecated static port forwarding. Does the library change affect this?Yes, dynamic port forwarding is supported by MiniUPnP.
Uploaded version 1.4 which adds support for NAT-PMP/PCP. Note that the ini setting UPnPMode was renamed to ForwardMode, but it doesn't hurt if you forget to change it because the default value is 1 anyway. ForwardMode = 1 means use either NAT-PMP/PCP or UPnP (in that order), 2 = use only UPnP, 3 = use only NAT-PMP/PCP.
Oops, I forgot to remove some test code. I've uploaded a version with it removed.
Updated to 1.4.1. If ForwardMode is set to 1 (use either NAT-PMP/PCP or UPnP), and it detects NAT-PMP/PCP is supported by the router but is unable to map the ports correctly, it will now attempt to fall back to UPnP. Most routers only support one or the other (usually UPnP), but I have seen third-party router firmwares that support both.
I like the automatic nature of what you're doing here.
Having a bit of difficulty getting it to work but this is amidst the hectic nature of work while I have customers asking me questions and I'm balls deep in their very expensive devices. I can see the games but join requests are failing. I know some of our newer members who have been attempting to play have had some issues too but I have a sneaking suspicion about how to get it working.
Will test out options and update our multiplayer guides with some basic troubleshooting steps for net helper.
- Try switching around which player is the host of the game.
- UPnP or NAT-PMP/PCP needs to be enabled on your router.
- For UPnP to work, make sure UDP port 1900 and TCP ports 2869 and 5000 are not being blocked by your computer's firewall. For NAT-PMP/PCP, UDP ports 5350 and 5351 need to not be blocked by your computer's firewall. (Note that I am not talking about forwarding ports here, just your computer's firewall software.)
- DMZ or manual port forwards of UDP ports 47776-47807 must not be enabled on your router, as UPnP and NAT-PMP/PCP cannot override them.
- If your network is a multiple router/repeater/etc. setup, ensure that only the root router (i.e. the one that directly connects to the internet) has UPnP or NAT-PMP/PCP enabled; if it's enabled on an intermediate router, it may try to request the forwarding rules to be set on the wrong device, which will cause it to not work.
- Only one device on the network can have ports forwarded to it at one time. If you start another OP2 client on another device, if using UPnP it will overwrite the rules set by the previous client, or if using NAT-PMP/PCP it will fail to override the rules set by the first client.
The first one is probably going to be the most relevant here. I'm not entirely sure how to explain why certain people hosting doesn't work even though the ports are forwarded, but then if you swap which player is hosting all of a sudden things work fine; that's always been an issue that would sometimes show up even with manual port forwarding back in the day.
I should update the readme file with these troubleshooting tips.