Ran Shorowitz
Ran Shorowitz

Reputation: 305

Allow people to host their own multiplayer without port forwarding?

There's lots of games on Steam nowadays (Table Top Simulator, SpeedRunners) that allows people to host their own online multiplayer matches/games without the need for port forwarding.

One thing I thought of of how they do it is they simply have one server that processes all the matches as separate threads.

But then I'm starting to wonder about getting bottle necked.

I then heard these games simply somehow allow TCP to be holepunched through their NAT, getting past the need for port forwarding.

But how in say, C++ using winsock, would one do this? Or GameMaker: Studio? Or just any game in general? How do you allow people to play without port forwarding? What's the process?

I see so many games on Steam do it nowadays it must not be too complicated.

Upvotes: 3

Views: 6910

Answers (2)

Sebastian
Sebastian

Reputation: 6057

As this question is explicitely related to steam, I think it's worth mentioning the steamworks API, especially SteamNetworking. It allows peer-to-peer connection relaying through steam servers:

https://partner.steamgames.com/doc/api/ISteamNetworking

bool AllowP2PPacketRelay( bool bAllow );

Allow or disallow P2P connections to fall back to being relayed through the Steam servers if a direct connection or NAT-traversal cannot be established.

Upvotes: 3

Vitor
Vitor

Reputation: 2792

One may use UPnP to automatically configure the router to do the port forwarding. There's a library for that in http://pupnp.sourceforge.net/

The alternative way is to have a external server managing all traffic, so that everyone connects there, thus avoiding nat issues.

Upvotes: 0

Related Questions