cancel
Showing results for 
Search instead for 
Did you mean: 

Cannot join an Oculus session: "Cannot map local player to unique net ID"

m_milazzo
Protege
I'm trying to create and join an Oculus session. I already succeeded in creating a session by using the Null and the Steam subsystems, but the Oculus' one seems to be more complex.

Rather than using the Unreal's CreateSession and FindSessions blueprint functions I used the Oculus' CreateSession and FindMatchmakingSessions. These one are my Blueprint blocks for creating and searching/joining sessions.
vmact1248j3h.jpg
ir12bk846ske.jpg
The session is created and found correctly (the Oculus matchmaking pool named "ciao" is the one configured on my Oculus dashboard). My problem is the JoinSession function, which actually is the one provided by Unreal, because the Oculus sdk does not provide an equivalent method, so when I call it I receive a warning message "Cannot map local player to unique net ID".

How can I join a session by using blueprints? I'm also trying to create a Blueprint function library and writing the JoinSession with C++, but I don't know how to call the OnlineInterface::JoinSession method correctly. Does someone has an example of code on how to join an Oculus session?
21 REPLIES 21

brian_jew
Expert Protege

xN31 said:

@brian_jew : Is Oculus voice chat meant to use the UE4 default Opus codec or a specific one? I thought Oculus voice chat was based on the codec used in Facebook's voice calls, but using the command "online test voice" I see the initialisation of the Opus codec. Is this correct?



I'm not sure about the technical implementation on the voice chat implementation itself.  The unreal implementation takes PCM data and creates a UE4 AudioComponent to play

m_milazzo
Protege




I was able to join the matchmaking session by assigning the oculus id as UniqueNetId to the PlayerController (the title's warning message has disappeared when calling the Unreal's JoinSession function).


How was this done exactly? Would love to see your blueprint for that 🙂

Would be a great help if blueprints also supported voice out of the box! hint for @brian_jew for a commonly required feature 😉


You should write it in C++, assign the net id by code and expose as Blueprint function (a UClass or, better, a BlueprintFunctionLibrary):

void UMyClass::SetPlayerNetId(APlayerController* PlayerController, FString NetId) {
FUniqueNetId* UniqueNetId = new FUniqueNetIdString(NetId);
PlayerController->PlayerState->SetUniqueId(MakeShareable(UniqueNetId));
}

JPonczek
Honored Guest






I was able to join the matchmaking session by assigning the oculus id as UniqueNetId to the PlayerController (the title's warning message has disappeared when calling the Unreal's JoinSession function).


How was this done exactly? Would love to see your blueprint for that 🙂

Would be a great help if blueprints also supported voice out of the box! hint for @brian_jew for a commonly required feature 😉


You should write it in C++, assign the net id by code and expose as Blueprint function (a UClass or, better, a BlueprintFunctionLibrary):

void UMyClass::SetPlayerNetId(APlayerController* PlayerController, FString NetId) {
FUniqueNetId* UniqueNetId = new FUniqueNetIdString(NetId);
PlayerController->PlayerState->SetUniqueId(MakeShareable(UniqueNetId));
}


I can't seem to find FUniqueNetIdString for some reason. The other classes are available, such as UniqueNetIdWrapper and UniqueNetIdRepl, but those don't seem to solve the problem of creating a UniqueNetId from a simple FString. Without it, I am unable to make a UniqueNetId that I can plug into the MakeShareable.

xN31
Protege

brian_jew said:


xN31 said:

@brian_jew : Is Oculus voice chat meant to use the UE4 default Opus codec or a specific one? I thought Oculus voice chat was based on the codec used in Facebook's voice calls, but using the command "online test voice" I see the initialisation of the Opus codec. Is this correct?



I'm not sure about the technical implementation on the voice chat implementation itself.  The unreal implementation takes PCM data and creates a UE4 AudioComponent to play


Thanks Brian, sounds interesting. A couple of questions:
  • How can I retrieve the generated AudioComponents (e.g. to spatialise the sound)
  • The voice quality is very good, but breaks quite often. Is there some setting to improve this? (e.g. is there a bandwidth limit setting causing voice packets to drop?)

xN31
Protege

xN31 said:


brian_jew said:


xN31 said:

@brian_jew : Is Oculus voice chat meant to use the UE4 default Opus codec or a specific one? I thought Oculus voice chat was based on the codec used in Facebook's voice calls, but using the command "online test voice" I see the initialisation of the Opus codec. Is this correct?



I'm not sure about the technical implementation on the voice chat implementation itself.  The unreal implementation takes PCM data and creates a UE4 AudioComponent to play


Thanks Brian, sounds interesting. A couple of questions:
  • How can I retrieve the generated AudioComponents (e.g. to spatialise the sound)
  • The voice quality is very good, but breaks quite often. Is there some setting to improve this? (e.g. is there a bandwidth limit setting causing voice packets to drop?)


Brian, how is voice spatialisation achieved in toybox? the demo is built with UE4, isn't it?

JPonczek
Honored Guest
I cannot successfully get multiplayer working with Oculus. I am using mostly blueprint, except for setting the player's unique net ID, which is done through the C++ mentioned above by ginopeloso. After successfully joining the session with the Join Session node, the connection to the host is immediately lost. Here is the output log:

PacketHandlerLog: Loaded PacketHandler component: Engine.EngineHandlerComponentFactory (StatelessConnectHandlerComponent)
LogNet: Game client on port 7777, rate 10000
LogNet: UPendingNetGame::InitNetDriver: Sending hello. [UNetConnection] RemoteAddr: 0.0.0.0:7777, Name: IpConnection_0, Driver: PendingNetDriver IpNetDriver_0, IsServer: NO, PC: NULL, Owner: NULL
LogNet: Host name resolution failed with 48
LogNet:Warning: Network Failure: PendingNetDriver[PendingConnectionFailure]: Your connection to the host has been lost.
LogNet: NetworkFailure: PendingConnectionFailure, Error: 'Your connection to the host has been lost.'
LogBlueprintUserMessages: [FPGameInstance_C_3] Pending Connection Failure
LogNet: DestroyNamedNetDriver IpNetDriver_0 [PendingNetDriver]
LogExit: PendingNetDriver IpNetDriver_0 shut down

I've been racking my brain trying to figure out why this happens, to no avail. I even created a brand new first person project and tried again, but it still happens. There's barely any information about this error online, except that others have also gotten the error. Please help!

m_milazzo
Protege
Did you try to disable Windows Defender?

pieterdub
Explorer
You could test using the OculusNetDriver rather than IpNetDriver:

If you don't have the OculusNetDriver setup you can test it by adding this to defaultEngine.ini and then un-checking the LAN mode on CreateSession:
[/Script/Engine.GameEngine]
+NetDriverDefinitions=(DefName="GameNetDriver",DriverClassName="/Script/OnlineSubsystemOculus.OculusNetDriver",DriverClassNameFallback="/Script/OnlineSubsystemUtils.IpNetDriver")

[/Script/OnlineSubsystemOculus.OculusNetDriver]
NetConnectionClassName="/Script/OnlineSubsystemOculus.OculusNetConnection"

Then in the log you should see the net connection try to use the OculusNetDriver rather than the IpNetDriver. Would be interested to see if that works.  Also, the server log might have some other info that could help?  Make sure to enable verbose logging for online and net in DefaultEngine.ini as well:
[Core.Log]
LogOnline=verbose
LogNet=verbose

Also, I am not sure that the Create Session node will properly initialize the server as a listen server.  When I load the map that will handle the matchmaking, I call openLevel <mapname>?listen to properly initialize the server as a listen server so when another machine calls join session, it will be ready for the connection.  That might not be an issue here but thought I would suggest as a test.


Jarrod84
Protege
pieterdub said:
You could test using the OculusNetDriver rather than IpNetDriver:

If you don't have the OculusNetDriver setup you can test it by adding this to defaultEngine.ini and then un-checking the LAN mode on CreateSession:
[/Script/Engine.GameEngine]
+NetDriverDefinitions=(DefName="GameNetDriver",DriverClassName="/Script/OnlineSubsystemOculus.OculusNetDriver",DriverClassNameFallback="/Script/OnlineSubsystemUtils.IpNetDriver")

[/Script/OnlineSubsystemOculus.OculusNetDriver]
NetConnectionClassName="/Script/OnlineSubsystemOculus.OculusNetConnection"

Then in the log you should see the net connection try to use the OculusNetDriver rather than the IpNetDriver. Would be interested to see if that works.  Also, the server log might have some other info that could help?  Make sure to enable verbose logging for online and net in DefaultEngine.ini as well:
[Core.Log]
LogOnline=verbose
LogNet=verbose

Also, I am not sure that the Create Session node will properly initialize the server as a listen server.  When I load the map that will handle the matchmaking, I call openLevel <mapname>?listen to properly initialize the server as a listen server so when another machine calls join session, it will be ready for the connection.  That might not be an issue here but thought I would suggest as a test.




I tried doing this but I'm still getting kicked out after a client joins.  Is there any info on how the game mode is supposed to be setup in blueprints for UE4?

archiactmartin
Explorer

Jarrod84 said:

pieterdub said:
You could test using the OculusNetDriver rather than IpNetDriver:

If you don't have the OculusNetDriver setup you can test it by adding this to defaultEngine.ini and then un-checking the LAN mode on CreateSession:
[/Script/Engine.GameEngine]
+NetDriverDefinitions=(DefName="GameNetDriver",DriverClassName="/Script/OnlineSubsystemOculus.OculusNetDriver",DriverClassNameFallback="/Script/OnlineSubsystemUtils.IpNetDriver")

[/Script/OnlineSubsystemOculus.OculusNetDriver]
NetConnectionClassName="/Script/OnlineSubsystemOculus.OculusNetConnection"

Then in the log you should see the net connection try to use the OculusNetDriver rather than the IpNetDriver. Would be interested to see if that works.  Also, the server log might have some other info that could help?  Make sure to enable verbose logging for online and net in DefaultEngine.ini as well:
[Core.Log]
LogOnline=verbose
LogNet=verbose

Also, I am not sure that the Create Session node will properly initialize the server as a listen server.  When I load the map that will handle the matchmaking, I call openLevel <mapname>?listen to properly initialize the server as a listen server so when another machine calls join session, it will be ready for the connection.  That might not be an issue here but thought I would suggest as a test.




I tried doing this but I'm still getting kicked out after a client joins.  Is there any info on how the game mode is supposed to be setup in blueprints for UE4?


I'd like to second this. I am getting the exact same problem now. I do want to ask, are you running on 4.17, and are you using the Oculus Source build found here https://github.com/Oculus-VR/UnrealEngine?