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=, 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:

6d57a249e6f2137ccbb1d4de72c4b51328509ff7
 .../Online/OnlineSubsystemSteam/Private/OnlineSubsystemSteam.cpp  | 8 +++++++-
 1 file changed, 7 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..427c32c 100644
--- a/Engine/Source/Runtime/Online/OnlineSubsystemSteam/Private/OnlineSubsystemSteam.cpp
+++ b/Engine/Source/Runtime/Online/OnlineSubsystemSteam/Private/OnlineSubsystemSteam.cpp
@@ -543,7 +543,13 @@ bool FOnlineSubsystemSteam::InitSteamworksServer()
 		}
 	}
 
-	GConfig->GetInt(TEXT("URL"), TEXT("Port"), GameServerGamePort, GEngineIni);
+	FString Port;
+	// Allow the command line to override the default port
+	if (FParse::Value(FCommandLine::Get(),TEXT("Port="),Port) == false)
+	{
+		Port = GConfig->GetStr( TEXT("URL"), TEXT("Port"), GEngineIni );
+	}
+	GameServerGamePort = FCString::Atoi( *Port );
 	GameServerSteamPort = GameServerGamePort + 1;
 
 	// Allow the command line to override the default query port
Clone this wiki locally