So as the title suggests, I have setup a multiplayer game using the OnlineSubsystemSteam, when I create a LAN session and Steam is running (I switch over to use the OnlineSubsystemNull for LAN matches since Steam does not handle that AFAIK) my log on the NumOpenPublicConnections remais the same as max players and does not update after new players join the session (yes they can join over LAN), but if Steam is closed NumOpenPublicConnections does update normally.
The problem is that if I want to check how many players are connected to the session it always returns zero. How can I fix that?
Hi nullbot, sorry, do you mean you only get this problem for LAN sessions with Steam and it doesn’t occur for internet sessions? Or perhaps you just only tested it for LAN?
I had what was probably the same issue, but I don’t think I ever tested it for LAN, only internet sessions.
Anyway, if it happens for internet sessions too, so far as you’re aware, then I was able to get around it with a small engine modification which I can share with you.
Hi Jonwood regarding to your post could you share the modification with me? I am also running into the problem where the player number inside the room doesn’t update. Thanks!
Hi swfly, sure, I’ll post it as an answer and if it’s a different problem or it doesn’t work, nullbot can just not accept it. I hope it helps you anyway.
Ok, well I had what I assume to be the same issue (although I never tested it for LAN, so far as I can remember). I was able to get the player count showing correctly, for my purposes at least, by making a small addition to the engine code. I’m still on UE4.10, so I can’t guarantee this will work for later engine versions, but I imagine it will.
In OnlineSessionAsyncLobbySteam.cpp
I added the lines below to the implementation of the function FillSessionFromLobbyData
I inserted these lines at line 350, although this might be different for different engine versions for all I know, so just make sure you’re in FillSessionFromLobbyData right after the for loop.
That doesn’t take into account private connections, but my game doesn’t use private connections, and the GetNumLobbyMembers function does always seem to accurately reflect the total number of players in the session.
Anyway, I added this to my game about a year ago now, and it seems to have worked since. I hope it does for you too, but I don’t know how watertight the solution is.
Hi Jonwood, thanks for the reply, I’m not building the game from source so I don’t have access to the engine code for this project, but that seems like a reasonable way to fix it. Still I’ll come back after I find a way to fix this issue. I have to make sure I’m suing the OnlineSubsystemNull even when Steam is connected to avoid this issue. I’ll mark this as the answer for now
Thanks for the reply! I’m not new to c++ or unreal but I’m very new to steam integration and I’m not too sure what you mean still. Is there any reason Jonwood’s solution wouldn’t work? It seems simpler. Anyways, if you’d like to add be in discord that would be tremendously helpful. Discord: Blindopoly#1003
My problem is that SteamMatchmakingPtr->GetNumLobbyMembers always just returns 1 after the game is started, even if there is more than 1 person in the game.