05-08-2017 02:37 AM
05-08-2017 08:09 AM
05-08-2017 11:18 AM
05-09-2017 08:58 AM
05-09-2017 01:31 PM
ginopeloso said:
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).
Unlike what happens with the Null and the Steam subsystems, however, the voice is not replicated from side to side, so the abstraction still has something not working properly (the DefaultEngine.ini is configured like described here, and it actually works with the other aforementioned subsystems)...
05-10-2017 01:45 AM
05-10-2017 03:45 AM
brian_jew said:
That's correct. Right now unlike the other subsystems, Oculus' Voice Interface isn't hooked into the Session subsystem automatically yet (or in other words, joining a session doesn't automatically connect the voices to the other players). It was kept that way for now to keep it simple, though I can see how this makes it more difficult to rely on blueprints to set this up.
Online::GetVoiceInterface()->RegisterRemoteTalker
to connect to someone else, by passing a FUniqueNetIdOculus object. FUniqueNetIdOculus is declared inside OnlineSubsystemOculusTypes.h, which is private, so I cannot include it. How can I instantiate it?05-10-2017 07:32 AM
bool UMyClass::RegisterRemoteTalker(FString PlayerId) {
FUniqueNetIdString* uniqueNetId = new FUniqueNetIdString(PlayerId);
return Online::GetVoiceInterface()->RegisterRemoteTalker(*uniqueNetId);
}
LogVoice:Warning: RANDOM_NUMBER timed out
where RANDOM_NUMBER is a number unrelated to the player id (I suspect it was the FUniqueNetIdString object address, it was different also whether the PlayerId was the same).class FUniqueNetIdOculus : public FUniqueNetId {
private:
ovrID ID;
protected:
virtual bool Compare(const FUniqueNetId& Other) const
{
if (Other.GetSize() != sizeof(ovrID))
{
return false;
}
return ID == static_cast<const FUniqueNetIdOculus&>(Other).ID;
}
public:
/** Default constructor */
FUniqueNetIdOculus()
{
ID = 0;
}
FUniqueNetIdOculus(const ovrID& id)
{
ID = id;
}
FUniqueNetIdOculus(const FString& id)
{
ovrID_FromString(&ID, TCHAR_TO_ANSI(*id));
}
/**
* Copy Constructor
*
* @param Src the id to copy
*/
explicit FUniqueNetIdOculus(const FUniqueNetId& Src)
{
if (Src.GetSize() == sizeof(ovrID))
{
ID = static_cast<const FUniqueNetIdOculus&>(Src).ID;
}
}
// IOnlinePlatformData
virtual const uint8* GetBytes() const override
{
uint8* byteArray = static_cast<uint8*>(malloc(sizeof(uint8) * 4));
check(byteArray);
// convert from an unsigned long int to a 4-byte array
byteArray[0] = static_cast<uint8>((ID >> 24) & 0xFF);
byteArray[1] = static_cast<uint8>((ID >> 16) & 0xFF);
byteArray[2] = static_cast<uint8>((ID >> 😎 & 0XFF);
byteArray[3] = static_cast<uint8>((ID & 0XFF));
return byteArray;
}
virtual int32 GetSize() const override
{
return sizeof(ID);
}
virtual bool IsValid() const override
{
return ID != 0;
}
ovrID GetID() const
{
return ID;
}
virtual FString ToString() const override
{
return FString::Printf(TEXT("%llu"), ID);
}
virtual FString ToDebugString() const override
{
return FString::Printf(TEXT("ovrID: %llu"), ID);
}
/** Needed for TMap::GetTypeHash() */
friend uint32 GetTypeHash(const FUniqueNetIdOculus& A)
{
return GetTypeHash((uint64)A.ID);
}
};
This class uses the function ovrID_FromString, which is defined in OVR_Types.h and implemented in LibOVRPlatform64_1.lib. So we included the OVR_* header files in our project and added the file LibOVRPlatform64_1.lib to our Binaries.bool UMyClass::RegisterRemoteTalker(FString PlayerId) {
FUniqueNetIdOculus* uniqueNetId = new FUniqueNetIdOculus(PlayerId);
return Online::GetVoiceInterface()->RegisterRemoteTalker(*uniqueNetId);
}
we call it the same way from Blueprint, by passing the same Oculus remote net id and now it is taking the right net id.05-10-2017 10:53 AM
ginopeloso said:
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).
05-10-2017 01:53 PM
bool UMyClass::RegisterRemoteTalker(FString PlayerId) {
auto uniqueNetId = Online::GetIdentityInterface()->CreateUniquePlayerId(PlayerId);
return Online::GetVoiceInterface()->RegisterRemoteTalker(*uniqueNetId);
}
That would create the FUniqueNetIdOculus but return it as a FUniqueNetId then plug that into the VoiceInterface.