Online subsystem find sessions of other game but not mine.

Hello, I’m trying to join a session I just created, the simplified function where it blocks, simplified for lisibility :

void UW_Menu::OnFindSessions(const TArray<FOnlineSessionSearchResult>& SessionResults, bool bWasSuccessful)
{
       if(bWasSuccessful && SessionResults.Num() > 0)
    {
        FString SessionFound_MatchType;       
        AddOnScreenDebugMessage(MatchType);
        
        for(auto Result : SessionResults)
        {
            Result.Session.SessionSettings.Get(FName("MatchType"), SessionFound_MatchType);
            AddOnScreenDebugMessage(SessionFound_MatchType); 
            if (SessionFound_MatchType == MatchType)
            {
                MultiplayerSessionsSubsystem->JoinSession(Result);
               return;
            }
        }
         AddOnScreenDebugMessage("No match type corresponding");
    }
}

I always reach “No match type corresponding” and indeed, sessions I found have no match type.

I tried in local and remote networks.
All importants settings have been done.

    LastSessionSettings = MakeShareable(new FOnlineSessionSettings());
        LastSessionSettings->bIsLANMatch = null;
        LastSessionSettings->NumPublicConnections = _NumPublicConnections;
        LastSessionSettings->bAllowJoinInProgress = true;
        LastSessionSettings->bAllowJoinViaPresence = true;
        LastSessionSettings->bShouldAdvertise = true;
        LastSessionSettings->bUsesPresence = true;
        LastSessionSettings->bUseLobbiesIfAvailable = true;
        LastSessionSettings->Set(FName("MatchType"), _MatchType, EOnlineDataAdvertisementType::ViaOnlineServiceAndPing);
        LastSessionSettings->BuildUniqueId = 1;
    [OnlineSubsystemSteam]
    bEnabled=true
    SteamDevAppId=480
    bInitServerOnClient=true

Any idea ?
Also I don’t know why it finds so many sessions. These sessions seems to belong to the game Chained Together, I can even see their passwords ?!!

JoinSession


Hi, I don’t see any special issues with your code, we also had so many problems when using temp SteamAppID - 480. Similar to your that we have seen other sessions, sometimes could sometimes couldn’t find our session. Or people could connect only if they are close to each other (like cities that are nearby), but it didn’t work across the country.

I think this 480 app id is used too widely and is not working properly in many cases. For us creating our own project on Steam (and paying $100) solved all those weird sessions issues.

I would suggest you testing following workflow:

  1. change [OnlineSubsystemSteam] bEnabled=true to bEnabled=false
  2. then you can test your logic by launching local instances of your game, just right-click .uproject file and press Launch Game. Create session like this and launch another instance to see if you can join

If everything works correctly I would suggest just spending $100 to get your unique SteamID and this should solve such weird session issues.

2 Likes

Thank you for your very quick and clear answer!
Just a point before to answer you:

Some connection tests worked when I packaged in development mode, instead of shipping. But only once in 10 I would say, it’s very random. When it works there are many problems (camera, timer…).
I replaced LastSessionSettings->BuildUniqueId = 1 with LastSessionSettings->BuildUniqueId = GetBuildUniqueId();
but that doesn’t change anything :roll_eyes:

On the other hand, I changed bEnabled=true to bEnabled=false as recommended and I was able to obtain the same result as the rare times I managed to join a session via Steam. So at least I can try to fix these issues without going through the session issue. But I’m still going to pay for a SteamAppID, it’s expensive but that’s the cost of learning I guess :slight_smile:

Thank you for your answer!

Hello, no problem. I hope you can find the solution quickly. Good benefit of testing without Steam enabled is, that you can have all your print strings during launched game, so you can debug easier.

I’m leaving here some things that were causing a lot of errors for me, when I didn’t understand multiplier behaviour correctly - maybe any of these is also an issue in your case:
-Classes are created in certain order, so for example if you have logic on BeginPlay of your player controller, that uses Controlled Pawn or PlayerState, these 2 might be not valid yet. It’s worth to do validation loop before accessing those classes.
-Clients don’t have all data replicated on the first tick (during BeginPlay). If you need to have something set from server on BeginPlay, you need to wait for one replication tick.
-If you use delays in your logic, you need to be very careful and precise where to use them, as so many things can go wrong and they are hard to debug. For example you wait for a variable to be synchronized with delay 0.2. It will almost always work fine on your end because your local lag is always smaller. And it will fail so many times for actual players.

Good luck with debugging!

Edit: P.S. as for Steam AppID you can use it for many projects until you actually release your game. Just store projects on separate Steam branches. I was doing it this way for learning purposes.

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.