🎉 Celebrating 25 Years of GameDev.net! 🎉

Not many can claim 25 years on the Internet! Join us in celebrating this milestone. Learn more about our history, and thank you for being a part of our community!

Modern Network Protocols

Started by
2 comments, last by hplus0603 5 years, 3 months ago

My brother told me that modern games no longer use network protocols where you have to worry about opening ports to host games. I'm trying to figure out what he's talking about. Is there a more modern protocol I can use with C# where I don't have to worry about hosting players opening ports? I don't know a ton about this stuff but I would think games still have to open ports to host games.

Advertisement

It's not really a protocol thing. If you're hosting a service behind a router, you either need some kind of port forwarding, or you need to perform "NAT punchthrough" between the client/server to create a connection.

For port forwarding, there's UPNP these days that lets your game ask the router to temporarily gotta port without the user having to manually configure it.

For NAT punchthrough, many platforms (e.g. Steamworks) will have a library to do that for you, and also a service to handle the failure situation where a connection can't be created. These services use a machine in the cloud as a kind of fake server, which just forwards data. When a client player can't connect to the server player for whatever reason (port forwarding / NAT punchthrough have failed), then instead, both of them connect to one of these cloud servers that then forwards their communications to each other.

That statement is not factually correct. The games still use the same protocols. However, most modern games add additional work to make the port-opening not necessary. There are two main ways you can do this:

1) Run the game servers in the cloud. This is the model of your typical Battle Royale (Apex, PubG, etc) as well as a variety of MMO-style games. Some player may be in charge of "setting up parameters" for game instances, but the actual network server process is still a publicly addressable host:port operated by the game publisher or someone like that.

2) Let players host the servers, but have the publisher (or some intermediary, such as Steam, or Xbox Live, or whatever) do the match-making and NAT punch-through introduction. Player hosts a game on their machine, lists it on the intermdiary, and other players who want to match up go through NAT punch-through introduction to set up the session without manual port opening. Once the game is going, the matchmaker doesn't need to involve itself with actual gameplay, so those servers are cheaper to operate than full game servers.

It used to be that NAT punch-through was a "may or may not work" thing, but because there's been so many bug reports and support calls and bad reviews, most ISPs and firewall/router vendors for consumers now don't block this. There are still cases in enterprise systems where NAT punch-through may be blocked, but that's a decided explicit policy of the IT/operations/management of the enterprise, i e, they decide to not support gaming at that point.

enum Bool { True, False, FileNotFound };

This topic is closed to new replies.

Advertisement