Just wanted to add onto this topic because it hits near and dear. I''m not a programmer, nor a professional game developer. I was considering as a hobby working on my own MMORPG. I''m still debating; However, While I do believe making an MMORPG is a very daunting task - I would hardly call it impossible. Making a "good" mmorpg that can compete and be successful is another story altogether.
Now to actually contribute something useful to this thread:
Regarding UDP and NAT, technically speaking UDP can work with NAT with no issue whatsoever. NAT or network address translation is typically used to describe what we in the industry call "Static NAT", "One-to-One NAT" or simply NAT. If your IP address is 126.96.36.199 and you are "static NAT''d" to 188.8.131.52, you will have no issues using Unreliable Datagram Protocol.
However and this may be where Thona got confused, if the users edge router is using PAT (Port Address Translation) or "many-to-one address translation" or "hide NAT", your users may have
PAT = you are 184.108.40.206 your neighbor is 220.127.116.11 you both are PAT''d as 18.104.22.168 behind the router/firewall. The router/firewall/whatever rewrites the source port address so when it gets a response back it can differentiate traffic destined for different internal clients i.e. "oh, this source port is 10001. Source Port 10001 = 22.214.171.124 I will send this to 126.96.36.199.". This allows you to both show as IP address 188.8.131.52 yet still receive reply traffic.
Again, in PAT the router or firewall rewrites the source port strictly to distinguish traffic between the internal clients and an outside server/resource.
What defines whether a game will have problem with PAT''d users?
Very simple. If the client (user) must use
a specific source port address, typically the edge router will use the one the client requested but if another client has already been assigned that source port the router/firewall will assign the new client a different source port. If your program requires a specific source port address you will have problems when multiple clients try to connect:
A. because one client has that source port already
B. because even if the server did you the same source port for both internal clients, how would it know which traffic was destined for which client?
Situations in which UDP fails is most prevalent (identifiable) in IPSEC communications with older VPN software in which the client must always use source port 500
. As soon as that port is used by someone else (or another session) no other user will be able to use it.
The solution is to use public IP''s on the inside network (which is not always feasible/affordable) or to assign static NAT to the machines which will be going to that server OR TO SIMPLY BUILD A GAME WHICH DOES NOT REQUIRE A PARTICULAR SOURCE PORT ADDRESS FROM THE CLIENT.
Summary: If youre programming a network game don''t be an idiot and define the client source port, just define the port the client needs to connect to (destination port) and NAT or PAT clients will work fine.
UDP is a fast protocol and works great where speed/lag is an issue... and UDP can be load balanced and reliable (at higher layers) as well. If I ever make a MMORPG
I guarantee it will use UDP.
It''s late but I hope that made sense and helps clear up some confusion.
MCP +I , MCSE, CCNA, CCSA, CCSE, CCSI