Player hosted servers

Hello Devs,
That’s my first post on the forum so I’m sorry if that’s not the proper category for it.
I have a simple question and it’s kinda straightforward. I have an idea for a multiplayer game and I want the players to be able to host a server and then via steam connect to their friends. I think it’s kinda similar to Unturned(not sure tho). I know about listen servers but that’s not exactly what I’m looking for. I want the player to host a server .bat file and then others can join even if the guy hosting isn’t in the game. Thanks in advance all and I hope you understood me :slight_smile:

The alternative to a listen server is a dedicated server.

They are considerably more difficult to setup however, and last I checked you can’t have a machine simultaneously hosting a dedicated server and a player playing on that server with Steam. Maybe that’s changed since.

You will need to build the engine from GitHub source to package a dedicated server. There’s a rough guide here:…dows_%26_Linux

I’m quite aware of the dedicated server method and I’ve already built the engine but what I wanna know is how to export the game with a lets say bat file so the playerd could run it and host the server so they can play with friends. I DON’T want to host a huge server so anyone can join but instead give the players the ability to host. Thank you !

Yes, you can include a batch file to run a server.
You just need to ensure it is included with the game on Steam.
That isn’t a UE4 thing - that is a Steam install script thing.

Anyone hosting will still need to worry about ports, unless your game includes some sort of NAT bypassing.

Yes I’m planing on using steam’s nat punch if thats possible at all. You have any ideas ?

Depends on your skill level, funds etc :slight_smile:

If you’re happy implementing stuff yourself in C++, UE4.24 introduced the SteamShared module which makes it easy to access the Steam API directly.

If not, you’re options are to use the native OnlineSubsystemSteam, trying the Advanced Session plugin or purchasing a solution off the marketplace.
I have personally never had any luck with the native OSS, so would suggest avoiding it.

I recently implemented the SteamShared module and found that as long as you run the Steam client, the dedicated server supports NAT punch through, but is only visible to the local LAN.

Okay, Thanks ! :slight_smile:

I’m quite confused … Can I use online subsystem for a dedicated server ? I saw a lot of tutorials showing how to use OSS but only for listen servers…