The new Gamespy Network Address Translation System:
One of the ways that the developers made CIV MP so much better and user friendly is by using a "smoke and mirriors" IP translation system that Gamespy develeoped for other PC games to take advantage of the positive aspects of only using one single port instead of multiple ports as C3C did. This system as described below well address 95% of the router/firewall issues that people used to have with C3C and it is transparent to the players on top of it.
One caveat: This only works when you use GS hosted rooms. It is not used if you are using DirectIP, if you want to use directIP then you will have to open the single port that the host is using(default is 2056 UDP) to get around any firewall/router issues.
The NAT Negotiation technology at GameSpy is fairly new. Up until recently, they required that you use port forwarding on a number of ports that MIGHT be used in their Arcade application. The reason they need so many while the XBox only needs 1 is because the XBox hardware and operating system are designed for one thing - gaming. No other applications will ever be running on your XBox, so each game written for the XBox is required to use that one port.
On your PC, you may have any number of network applications already using a port that GameSpy may want to use. Although unlikely, you may have multiple applications all already using multiple ports that GameSpy may want to try. They use a range of 100 ports to minimize the likelihood that EVERY ONE of these ports is already being used by their system. Not all are tried are going to be used, though.
Now that NAT Negotiation is supported, this is unnecessary in MOST configurations. I'll try to describe briefly what happens in this solution:
Civ4 uses UDP packets. Most firewalls will not allow unsolicited incoming UDP packets through unless that port is opened explicitly. That was the old solution. The new solution is based around the idea that most firewalls WILL allow UDP packet RESPONSES. This means that UDP data will be allowed in from an address to which we've recently SENT UDP data. This is how webpages respond to requests.
What GameSpy does is essentially trick your firewall. You send a packet of data to a separate NAT NEGOTIATION SERVER that they provide, telling them that you want to join a game. Since the host has already established a connection with GameSpy (telling them they are hosting a game), GameSpy can talk to them. They send the host your information, telling him that you want to join their game. They also respond to you, telling you what ip/port to try the host on. Then the magic happens...
You send a few packets to the address GameSpy tells you about, and the host sends you a few packets based on info from GameSpy. When the host packets reach your computer, your firewall allows them in since you were just sending packets to that address. After communication is established, you can talk directly to the host.
Essentially, their solution is a hack. But, it's quite a clever and fairly reliable hack. But, like all hacks, there are some situations that screw this up. NATs-behind-NATs won't work (which most likely means SOCKS won't work), some brands of NATs will not support some assumptions that GameSpy makes, and connections behind large, active LANs may fail. Also, the GameSpy server responsible for sharing information may not always be up. But it's the best and most universally supported solution we have available to us.
What we do in CIV is first try to contact the host directly on their public IP. If the host is protected by a LAN/Firewall, this will fail. Next, we try the NAT Negotiation solution. If this fails, we make an assumption we are on the same LAN, and try the private address.
Ofcourse we all hope this will take the pain out of CIV MP that prevented so many players from playing Civ3 from PTW to the C3C XP's. This part of the puzzle should help CIV become the "golden age of MP" for this community.
CS
One of the ways that the developers made CIV MP so much better and user friendly is by using a "smoke and mirriors" IP translation system that Gamespy develeoped for other PC games to take advantage of the positive aspects of only using one single port instead of multiple ports as C3C did. This system as described below well address 95% of the router/firewall issues that people used to have with C3C and it is transparent to the players on top of it.
One caveat: This only works when you use GS hosted rooms. It is not used if you are using DirectIP, if you want to use directIP then you will have to open the single port that the host is using(default is 2056 UDP) to get around any firewall/router issues.
The NAT Negotiation technology at GameSpy is fairly new. Up until recently, they required that you use port forwarding on a number of ports that MIGHT be used in their Arcade application. The reason they need so many while the XBox only needs 1 is because the XBox hardware and operating system are designed for one thing - gaming. No other applications will ever be running on your XBox, so each game written for the XBox is required to use that one port.
On your PC, you may have any number of network applications already using a port that GameSpy may want to use. Although unlikely, you may have multiple applications all already using multiple ports that GameSpy may want to try. They use a range of 100 ports to minimize the likelihood that EVERY ONE of these ports is already being used by their system. Not all are tried are going to be used, though.
Now that NAT Negotiation is supported, this is unnecessary in MOST configurations. I'll try to describe briefly what happens in this solution:
Civ4 uses UDP packets. Most firewalls will not allow unsolicited incoming UDP packets through unless that port is opened explicitly. That was the old solution. The new solution is based around the idea that most firewalls WILL allow UDP packet RESPONSES. This means that UDP data will be allowed in from an address to which we've recently SENT UDP data. This is how webpages respond to requests.
What GameSpy does is essentially trick your firewall. You send a packet of data to a separate NAT NEGOTIATION SERVER that they provide, telling them that you want to join a game. Since the host has already established a connection with GameSpy (telling them they are hosting a game), GameSpy can talk to them. They send the host your information, telling him that you want to join their game. They also respond to you, telling you what ip/port to try the host on. Then the magic happens...
You send a few packets to the address GameSpy tells you about, and the host sends you a few packets based on info from GameSpy. When the host packets reach your computer, your firewall allows them in since you were just sending packets to that address. After communication is established, you can talk directly to the host.
Essentially, their solution is a hack. But, it's quite a clever and fairly reliable hack. But, like all hacks, there are some situations that screw this up. NATs-behind-NATs won't work (which most likely means SOCKS won't work), some brands of NATs will not support some assumptions that GameSpy makes, and connections behind large, active LANs may fail. Also, the GameSpy server responsible for sharing information may not always be up. But it's the best and most universally supported solution we have available to us.
What we do in CIV is first try to contact the host directly on their public IP. If the host is protected by a LAN/Firewall, this will fail. Next, we try the NAT Negotiation solution. If this fails, we make an assumption we are on the same LAN, and try the private address.
Ofcourse we all hope this will take the pain out of CIV MP that prevented so many players from playing Civ3 from PTW to the C3C XP's. This part of the puzzle should help CIV become the "golden age of MP" for this community.
CS