Hi,
I am STUCK ,
How to connect to a dedicated server with OnlinesubsystemNULL from a client with OnlinesubsystemSteam
Make sure that you’re passing a valid value for the UniqueId
parameter to the server’s game mode class’ PreLogin
function. This function gets called every time a client connects to the server and it checks if the UniqueId
parameter passed is “valid”, but it also checks if the type of the id’s type is the same as the online subsystem that is being used by the server. In your case, the online subsystem used in the client and server are different. Here’s the source code for the PreLogin
function to give some more clarity,
void AGameModeBase::PreLogin(const FString& Options, const FString& Address, const FUniqueNetIdRepl& UniqueId, FString& ErrorMessage)
{
// Login unique id must match server expected unique id type OR No unique id could mean game doesn't use them
const bool bUniqueIdCheckOk = (!UniqueId.IsValid() || (UniqueId.GetType() == UOnlineEngineInterface::Get()->GetDefaultOnlineSubsystemName()));
if (bUniqueIdCheckOk)
{
ErrorMessage = GameSession->ApproveLogin(Options);
}
else
{
ErrorMessage = TEXT("incompatible_unique_net_id");
}
FGameModeEvents::GameModePreLoginEvent.Broadcast(this, UniqueId, ErrorMessage);
}
The subsystems need to match. If you do NULL on both sides, you need to connect via raw IP, if you do steam on both sides, then you need to connect using the command line open SteamID
[OnlineSubsystemSteam]
bUseSteamNetworking=false
… other stuff
[/Script/Engine.GameEngine]
!NetDriverDefinitions=ClearArray
NetDriverDefinitions=(DefName=“GameNetDriver”,DriverClassName="/Script/OnlineSubsystemUtils.IpNetDriver",DriverClassNameFallback="/Script/OnlineSubsystemUtils.IpNetDriver")
+NetDriverDefinitions=(DefName=“DemoNetDriver”,DriverClassName="/Script/Engine.DemoNetDriver",DriverClassNameFallback="/Script/Engine.DemoNetDriver")
[OnlineSubsystem]
DefaultPlatformService=Steam
… other stuff
DO NOT HAVE
[PacketHandlerComponents]
[/Script/OnlineSubsystemSteam.SteamNetDriver
I then had to hack the engine in PendingNetGame.cpp by commenting out the following line
//Connection->PlayerId = LocalPlayer->GetPreferredUniqueNetId();
In order to fix the incompatible_unique_net_id disconnect.
WARNING: I have zero clue what other ramifications there are having a default PlayerId, but I know that’s whats happening if you run the game via editor or run the game without the steam client running.
same problem
it can fix, i think: GameModeBase