Forum Discussion

🚨 This forum is archived and read-only. To submit a forum post, please visit our new Developer Forum. 🚨
gavmacca's avatar
gavmacca
Protege
8 years ago

Create/Find Oculus Sessions using C++ Oculus subsytem

Hey Oculus Dev's,

I'm looking at setting up Oculus sessions using C++. I'm basically trying to get the same functionality as the blueprint nodes but in C++, I want to do this because I want to add custom properties to the session settings, which you cannot do via blueprints.

The oculus documentation is very vague on how to create/find oculus sessions. I have managed to create a session but it is not listed when I try to find sessions. With the OVR blueprint nodes you can use find matchmaking sessions and you have to provide the pool names, I'm assuming this is where the problem lies when creating the C++ sessions?

So my questions are:

1. Is there a special way that you need to create/find sessions when using the Oculus Sub System? Is there a particular create session function that needs to be used via C++?
In comparison to the steps taken here: https://wiki.unrealengine.com/How_To_Use_Sessions_In_C%2B%2B

2. How do you provide the pool name when Creating/Finding sessions via C++?

Do I need to add it to the session settings, here is an example:
SessionSettings = MakeShareable(new FOnlineSessionSettings());

SessionSettings->bIsLANMatch = bIsLAN;
SessionSettings->bUsesPresence = bIsPresence;
SessionSettings->NumPublicConnections = MaxNumPlayers;
SessionSettings->NumPrivateConnections = 0;
SessionSettings->bAllowInvites = true;
SessionSettings->bAllowJoinInProgress = true;
SessionSettings->bShouldAdvertise = true;
SessionSettings->bAllowJoinViaPresence = true;
SessionSettings->bAllowJoinViaPresenceFriendsOnly = false;

SessionSettings->Set(SETTING_MAPNAME, FString("NewMap"), EOnlineDataAdvertisementType::ViaOnlineService);

// Set the delegate to the Handle of the SessionInterface
OnCreateSessionCompleteDelegateHandle = Sessions->AddOnCreateSessionCompleteDelegate_Handle(OnCreateSessionCompleteDelegate);

// Our delegate should get called when this is complete (doesn't need to be successful!)
return Sessions->CreateSession(*UserId, SessionName, *SessionSettings);

Any pointers would be greatly appreciated!

9 Replies

Replies have been turned off for this discussion
  • Neontop's avatar
    Neontop
    Heroic Explorer
    Hi @gavmacca did you tried the sample for unreal inside the Platform SDK 1.24.
    Because it is a good example about session with oculus online subsystem.
  • Hi @Neontop,

    Thanks for the reply. I have checked this out and it is a very good example.

    However, I noticed that the matchmaking shows how to search for sessions with a pool name, however it doesn't seem to show how to create the session with a pool name.

    Unless I'm misunderstanding how the matchmaking works...
    A session has to be hosted first for it to appear in the matchmaking, correct? and the match making needs a pool name.
    So when a user host's their own match, somewhere during the creation you would have to define the pool name, that is used to find the match during the matchmaking.

    An example taken directly from the sdk sample, (OSSSessionWidget, start matchmaking function):

    // Search with this poolname
      SearchSettings->QuerySettings.Set(FName(TEXT("OCULUSPOOL")), PoolName, EOnlineComparisonOp::Equals);

    Here you can see that the matchmaking is searching for sessions that are listed with "OCULUSPOOL", but how do we define the pool name for the match that is created during create session? I don't see anything for that in the create session function.

    Thanks!



  • Hi Neontop,

    brian_jew in that post says:

    2) Some players will start their own sessions with CreateSession() and pass in the oculus matchmaking pool.

    Again, this is exactly what I'm wanting to do and it's exactly where I'm stuck.

    How do we pass in the oculus matchmaking pool during the create session process? It is not mentioned anywhere about how to do it via C++ and it is skipped over in the SDK example, and brian_jew doesn't mention how to do it there.

    Thanks again!

  • Thanks for the response, the link you provided just returns me to my oculus dashboard.

     Is there any chance of reaching a oculus dev to confirm how to pass the matchmaking pool while creating the session in C++?

    I'm trying to list the active sessions found during the matchmaking (kind of like a server browser) and to do that I believe that I need to pass the matchmaking pool while creating the session, then I can use the matchmaking, passing in the pool name and it should pick them up when using that same pool name.

    Unless there is a default poolname that is used when creating a session? If there is, I could use that too but I don't any pool name is provided.

    It's the last piece of the puzzle :)
     
  • Neontop's avatar
    Neontop
    Heroic Explorer

    gavmacca said:

    Thanks for the response, the link you provided just returns me to my oculus dashboard.

     Is there any chance of reaching a oculus dev to confirm how to pass the matchmaking pool while creating the session in C++?

    I'm trying to list the active sessions found during the matchmaking (kind of like a server browser) and to do that I believe that I need to pass the matchmaking pool while creating the session, then I can use the matchmaking, passing in the pool name and it should pick them up when using that same pool name.

    Unless there is a default poolname that is used when creating a session? If there is, I could use that too but I don't any pool name is provided.

    It's the last piece of the puzzle :)
     



    It will be a good idea to send this message to @imperativity and he will pass this to the dev.
  • @imperativity

    Thank you so much, this is exactly the information I was looking for!
    • Reloader_'s avatar
      Reloader_
      Explorer

      Hey, how did you solved this? Do I need to pass POOL_RANGE, OCULUSPOOL  or PoolTest?