Skip to content
Neico edited this page May 18, 2016 · 5 revisions

FAQ

Q: I can't set the server's game port on the command-line using -Port= using steam, what am I doing wrong?

A: It seems to be an oversight from Epic Games in their Steam implementation, here's the Diff for a fix, assuming you compile the Engine by yourself:

d3616d3db0858d9d28b1b6fee6d265625a5fb170
 .../OnlineSubsystemSteam/Private/OnlineSubsystemSteam.cpp      | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/Engine/Source/Runtime/Online/OnlineSubsystemSteam/Private/OnlineSubsystemSteam.cpp b/Engine/Source/Runtime/Online/OnlineSubsystemSteam/Private/OnlineSubsystemSteam.cpp
index 6b0e34e..6a197f7 100644
--- a/Engine/Source/Runtime/Online/OnlineSubsystemSteam/Private/OnlineSubsystemSteam.cpp
+++ b/Engine/Source/Runtime/Online/OnlineSubsystemSteam/Private/OnlineSubsystemSteam.cpp
@@ -543,7 +543,15 @@ bool FOnlineSubsystemSteam::InitSteamworksServer()
 		}
 	}
 
-	GConfig->GetInt(TEXT("URL"), TEXT("Port"), GameServerGamePort, GEngineIni);
+	// Allow the command line to override the default port
+	if (FParse::Value(FCommandLine::Get(),TEXT("Port="),GameServerGamePort) == false)
+	{
+		if (!GConfig->GetInt( TEXT("URL"), TEXT("Port"), GameServerGamePort, GEngineIni))
+		{
+			GameServerGamePort = 7777;
+		}
+	}
+
 	GameServerSteamPort = GameServerGamePort + 1;
 
 	// Allow the command line to override the default query port
Clone this wiki locally