Hello fellow AOEO players!
In the last couple of weeks we have been looking into how we could improve the connectivity between players. Given that all multiplayer games with the BANG Engine (AOM/AOE3/AOEO) are based on peer-to-peer the only way to currently play with each other is with the help of UPnP, port-forwarding or via a private VPN-System like Hamachi. Unfortunately UPnP doesn't always work and port-forwarding is a hassle to set up, especially for those who are not really tech-savvy.
We decided to look into how other platforms like Voobly, GameRanger or AOE3 work and deal with this issue. To give an understanding why those platform offer better connectivity than we do, we have to look what techniques/technologies are possible:
- Manual port-forwarding (Can be used with Celeste)
- UPnP (Can be used with Celeste)
- NAT-Punchthrough (Coming up!)
Port-forwarding is the most complicated to setup but also the most reliable way to get people connected. If you port-forward you are basically saying the router: "Hey, map my external ip with the port 1000 to my internal-ip (my computer) with the port 1000". So if someone tries to connect on Port 1000 it will reach your computer.
There are some problems though: First of all it is a hassle to set it up and secondly not everyone has admin access to the router. Especially if your outside of your Home-LAN (like Mobile Networks, Public WiFis, ect...). Those people then have to rely on UPnP or if that fails they have to use Hamachi which locks them inside a VPN-System.
UPnP is a technology that allows applications to request temporary port-forwarding-mappings for application, basically as if your application would configure the router. Also this technology is not the best solution as the ports may already be reserved for other applications or other computers and that UPnP might be disabled completely or not available on the router you are logged in to.
A relay server is basically a server that stands out as a middleman between the game connections. It is basically how Hamachi or VPN in general are working internally, but a Relay-Server is more application/service-specific. It would allow players to connect to each others regardless on what network/router they are behind as the relay server is a public server that just redirects the messages. So why haven't we implemented such a service?
Well, first of all running such a service would mean extra cost for us. It would require running another public server that would probably eat lots of networking resources. The second reason is also in the interest of the players: latency. Having a server in between would mean extra latency between the players. To have a relay service with low latency guarantee it would require us to not only to setup one relay server but having to setup multiple ones around the world.
Coming up: NAT-Punchthrough
NAT-Punchthrough is a bit complicated to explain as it exploits a mechanism in the router that is widely used in P2P-Networking. Basically we send a networking request from UDP 1000 to our Celeste server. When the request is sent, your router will add a NAT-Entry. See it like a "callback-number", because obviously there must be a way that the Celeste service can send a response. Now we can tell other clients about this "callback-number" as they can also use this to send information to the other client. These NAT-Entries are temporary and only open between 30 seconds and 10 minutes from the last networking request sent (depending on the router), so these requests to the Celeste service has to be done just right before a multiplayer session is opened. If you're interested in this technique you can read about it here: http://bford.info/pub/net/p2pnat/
The advantages with this technique is clear:
- Multiplayer games can be played even if the player doesn't have admin access to the router or if UPnP is disabled.
- Multiplayer games can be played even if the port 1000-1005 is blocked by the router.
- Multiplayer games can be played with the other ones having UPnP enabled or if they have manual port-forwarding active. So it doesn't matter if your co-op partner doesn't use NAT-Punchthrough.
- It is harder to find out why a connection has failed. (Did the NAT-Punchthrough-Request was too early? Was it too late? Did the router block it?)
- It is not guaranteed to work, but the success rate is very very high across router manufactures.
Coming with this update, NAT-Punchthrough will be enabled by default as the advantages outweighs the disadvantages. In the launcher you will still be able to switch back to UPnP/Manual-Mode in case NAT-Punchthrough doesn't work.
How reliable is this technique?
According to the paper about NAT-Punchthrough the success rate is roughly at 80%. It might be even higher, given that the paper was written back in 2005. In any case you can always switch back to other modes (WAN/LAN/Hamachi).
What about players behind the same Network. Do I need to play in LAN-Mode?
We haven't tested it yet, but in theory it should work. If, for example, the external port 1000 is already used by a player behind the same LAN-Network, then the router will assign you a different one and map it to your local port on your local ip address. If anyone can confirm that it works or doesn't work, then let us know.
HELP! It doesn't work
Beware! When you first try out this new network mode, the windows firewall will alert you if you want to allow a new connection. Because of this request your first connection attempt might fail. Even if your first connection attempt doesn't work you should attempt a second one as your fellow players you're playing with might have to accept this firewall request as well.
What cases have been tested?
* 1v1 Arena
* 1v2 Arena (required a 2nd connection attempt)
* 2v2 Arena
* 1v1 Sparta
* 2v2 Sparta (required a 2nd connection attempt)
I hope that with this new technique we sort out most of the connection issues. We will hope that we can optimize it in the future and sort out any issue that might come along the way.
Thank you for reading and happy battling!
- Celeste Development Team