Does UE4 have nat punch? how combine steam's networking with UE4?

Hi, multiplayer games usually have problems when both (or more) players have nat (Network address translation - Wikipedia). Does UE4 have any built-in nat punch? If UE4 don’t have such, do you have any idea how combine steam’s networking with UE4?

Steam API says:

Peer-to-peer networking
header: ISteamNetworking.h

The Steam networking API is a simple set of functions to let the game send data directly between two Steam users. To make connections from behind home NAT’s, it uses the libjingle NAT-punching library or, if no direct connection can be made, through the Steam relay servers.
See the documentation page about Steam peer-to-peer networking.

On the page Steam Networking (Steamworks Documentation) some steam functions to handle networking, but as i know UE4 handle network by itself. Is here any way combine steam’s nat punch (libjingle NAT-punching library or through the Steam relay servers) and UE4 network handling?

Steam Integrated as of 4.6

Steam is automatically integrated as of 4.6!

Check out the Shooter Game to see the generic implementation of Steam using Epic’s OnlineSubsystem which auto detects the right online system to used based on platform.

For Windows it is Steam.

See Shooter Game files:

  1. Online/ShooterGameSession.cpp
  2. config file, DefaultEngine.ini

To see how to use steam via UE4’s OnlineSubsystem!

I’ve hosted real multiplayer games for my own c++ projects using Steam with both Epic staff and many developers so can I assure you everything is fully operational.

UE4 uses Steam’s NAT traversal powers perfectly well when you use the OnlineSubsystem as is demonstrated in ShooterGameSession.cpp .

So unreal does support peer to peer networking. And there is no need for a plugin like this? Unity Asset Store - The Best Assets for Game Making

If your using steam.

Any easy way to expose the hook up to custom solution like this Unity plugin does?

You can’t use P2P in Unreal, the architecture for it doesn’t exist. It’s Server/Client only - regardless of the onlinesubsystem you use.

Sorry to bump an old thread.

But I need to know how is it going to work legally when I’m publishing the game.

Can I trust the current shooterGameSystem as my network solution or do I have to buy something from steam to make it official?

ShooterGameSystem? If you just mean the SteamOnlineSubsystem, it’s perfectly fine, you have to pay to put your game ON Steam, however if that’s what you mean.

I just want to be able to make two players be able to play without forcing them to open ports or use any other 3rd party software.
So if I’m not mistaken the steam plugin can do that right?

The online sub system doesn’t handle actual hosting, you still have to host it. Steam is for things such as saving cloud data, friends lists, achievements, etc. You choose a server (digital ocean, whatever) to host on, and then you forward the ports on that server. As long as your game is being ran as a dedicated server and your users aren’t hosting the games you’re fine. Only the person who is getting the connections (the current “server”) has to port forward.

1 Like

It will allow two players to find each other and play a match.
(No need for a dedicated server in your case.)

Yes, Steam Plugin uses STUN and ICE to Nat Punch the players router.

1 Like

Thanks! I will give it a try :slight_smile:

UPNP Plugin might be a solution. It is reviewing. It isn’t packet relay. Adding port-mapping to NAT.

UPNP Plugin is only partial solution for routers who have that feature turned on. NAT punch is much more universal solution that would work even UPNP will not.
You can check your router by downloading this tool:

sorry for the bump but, there is no solution to this so far?

I sounds to me like the Unreal Steam Subsystem will handle NAT traversal. You don’t need to use a “dedicated server” like the one user said.

Rather, you can use a “listen server” (where the server is playing), and it should work fine.