Hi I’m new to the multiplayer world using the Unreal Engine and I have this question that’s been haunting me for a couple of days, as far as I understand you cannot find LAN games while making use of the OnlineSubsystemSteam because Steam doesn’t look at connections, only online sessions. If that is true then how can I (connected to Steam) create and find LAN matches? is there a way to switch the OnlineSubsystem being used for that?
To add a bit more context I’d love for someone to clarify me some other things. At the moment my game can be played over Steam, I’m using the SteamDevAppId=480 (Spacewar) and for some reason I cannot find a match hosted by a steam friend living in Portugal (while me being in Germany), so maybe there is some region lock as well? I can play an online match over Steam with my laptop using another Steam account. As far as LAN goes I can host and find a LAN game on my same computer only if Steam is offline and opening two different stand alone clients, I cannot do the same using the PIE option from the Editor.
I’m using the built-in Steamworks shipped with UE 4.16 (version v139)
Update: to be able to connect to LAN while having Steam opened I just added a check like this: IOnlineSubsystem* UHKGameInstance::GetOnlineSubsystem() { return bEnableLan ? IOnlineSubsystem::Get(NULL_SUBSYSTEM) : IOnlineSubsystem::Get(); }
This fixes the problem since I’m no longer using the Steam subsystem to create and join LAN matches anymore, but unfortunately this works to create a session, when trying to join it it fails, shows me that no players are connected (there should be at least 1, the one that created the session is connected). If Steam is offline then this still works, I’m so confused here :S
You can use the SteamNetDriver for LAN matches. When you open the map make sure you append ?bIsLanMatch=1 to the URL.
Should look like this.
MapName?listen?bIsLanMatch=1
Thank mate! it does work Now I’ll have to read about the possible options and about the SteamNetDriver.
The only problem I still face is that for some reason the “NumPublicConnections” (MaxPlayers) and the “NumOpenPublicConnections” are still the same even though I have 3 clients connected, for a game with max 4 players and 3 clients online I should have “NumOpenPublicConnections” set to 1.
In case anyone happens to come here for the same issue I did this:
FString levelOptions = "listen";
if (bEnableLan)
{
levelOptions.Append("?bIsLanMatch=1");
}
UGameplayStatics::OpenLevel(GetWorld(), "Lobby", true, levelOptions);