cancel
Showing results for 
Search instead for 
Did you mean: 

Fixes for common UE4 + Oculus Platform issues before submitting to Store

Mohammed_hashim
Expert Protege
In this post, you will find potential fixes for UE4 issues with VRC.PC.Input.3, VRC.PC.Input.2VRC.PC.Input.10, VRC.PC.Functional.3, Leaderboards, Achievements, and Online Sessions. Feel free to jump to the point you need instead of reading everything, but I'm sure you will read these tips more than once.
🙂 

----------
Background:
It's been almost 2 months since I started to implement the Oculus platform in my game to be compatible with the Oculus Store guidelines, and it's been a bumpy journey for many reasons. Thanks to the UE4 community and the Oculus Developer Support team with their fast and active responses, all has been solved in a short time. Below, I will describe in detail every single issue I faced, which should help you if you're facing the same problems:
  • Main reason for me was bad timing, Oculus had a bug on their "online session" (but the fix is available now and probably merged with 4.21.1 ) , as for Official Epic launcher version of UE4 still have bugs regarding "online session" and "Re centering VRC.PC.Input.3"  which makes it total useless as both "online session" plugin and "OculusVR plugin" is old and have bugs that will prevent you to make successful session or pass " VRC.PC.Input.3" so the only path you have to take is to download latest Oculus branch of UE4 from github.
  • Another reason was lack of clear and updated information on the Oculus + UE4 integration. I couldn't find any YouTube videos on how to implement any of the platform services. The only information you get is from the Oculus documentation, which is not always clear if it's referring to the official Epic UE4 branch or the Oculus branch of UE4. nodes that will be shown available from sample project called since in the document it mention how to obtain top 10 from leader-board with BP using array but there was no such node with array input or unlocking achievements which never worked (only tested on epic launcher version regarding achievements). https://forums.oculusvr.com/start/discussion/71115/how-to-get-top-10-from-leaderboards-with-bp-in-ue4#latest
  • UE4 has many Blueprint nodes like "Unlock achievements" and "Leaderboards", which you expect to work out of the box but doesn't. If you are new to submitting to the Oculus store like I am, you will first blame yourself and spend days fixing your code, finding out later the node is broken in the engine itself.  
Hopefully when you read this, most of the issues I faced here will already be fixed. I will also mention some tips on how to fix some major issues in your project before you submit to the Oculus store. When I first submitted my project, I got a list of issues below of test results I needed to fix:
  • VRC.PC.Input.3 - Selecting Reset View in the Universal Menu must reset the user’s position and orientation.
  • VRC.PC.Input.2 - Single-player apps must pause while the Universal Menu is open.
  • VRC.PC.Input.10 - In-application hands and controllers should line up with the user’s real-world counterparts in position and orientation.
  • VRC.PC.Functional.3 - Single player apps must pause when the user removes the HMD.
I will describe these in order.

----------
VRC.PC.Input.3 - Reset View should work properly: 
  1. Make a new actor 
  2. To fix this issue, use the Oculus 1.32 plugin which has the fix already and is (for now) only available on Oculus branch of UE4.21.1.
  3. Or fix the code from the source of UE4 which i'm not sure if its possible using epic launcher, if its possible then its not easy as the plugin is Engine run-time plugin. 
  4. You need to call "Set tracking origin" on your "Event begin play" to "Floor level" and not "Eye level" (unless your game uses "Eye level"). Otherwise, the engine will use "Eye level" as default. 
  5. You need to make a new actor and call it something like "OculusHMDNotifications" and drop it on every level you have. *(images i use in this post is from my own project and its named "mainmenu_bp" instead of "OculusHMDNotifications" )
  6. Add a VRNotifications component to it from left side then drop it on your graph as a reference so you could bind below 3 event from it just like the image  "hmdputonheaddelegate", "hmdremovedfromheaddelegate" and "hmdrecentereddelegate"
  7. Once you done your result would be like below image.
  8. Now add pause and reset position nodes to it just like below image, since we added HMD Remove/Put node here then we already fixed "VRC.PC.Functional.3" issue here too 🙂 
  9. Done! It will work now as it should
t4334lq3rw7a.png

----------
VRC.PC.Input.2 - Game should pause while the Universal Menu is up
  1. Remember the actor we created named "OculusHMDNotifications"? Open it and go to "Class Default " on the top side when you click on it 
  2. You will see a detail panel of your current actor, make sure to checkbox on "Tick even when pause" so when you pause your game you will able to unpause it again later. 
  3. Now add Set game paused and connect it to "has system overlay present" just like below imagine on event tick. 
  4. Once you done it will work as it should.
4cau49j8u5ta.png

----------
VRC.PC.Input.10 - Hands and controllers should line up with the user’s real-world 
In Oculus branch of UE4.21.1 from github you need to open sample project located in UnrealEngine/Samples/Oculus/HandSample
after that migrate the hand to your project and add the hand/controller to your character hand and recenter/rotate your game hand to match with the sample provided then you can delete it: https://developer.oculus.com/blog/implementing-quality-hands-with-oculus-touch/

----------
Achievements:
Achievements are broken on UE4 and you can't unlock Oculus Achievements using built-in BP nodes (not sure about Oculus github version of UE4  since i only tested Achievements on Epic launcher version) so what you have to do is to move the source of working code from SDK project "Samples\UnrealSample" and add it to your project then compile your project and use the new nodes just like in the sample project. (Its not as easy as it sound but its the only way) 
- Make sure to add your achievements on your portal/dashboard.oculus with ID that match your game Achievements ID just like steam.
-And config your app for Oculus on DefaultEngine.ini like below (not sure if the last line "Achievement_0_Id=" is required like  steam or not but i kept it for now) and make sure to change YOUR_APP_ID for OculusAppId to your actual App ID:

[OnlineSubsystem]
DefaultPlatformService=Oculus
bHasVoiceEnabled=true

[Voice]
bEnabled=true

[OnlineSubsystemOculus]
bEnabled=true
OculusAppId=YOUR_APP_ID

Achievement_0_Id="NEW_ACHIEVEMENT_1_0"

pyi0g5yhx3ql.png

----------
Leaderboards :
Same story as Achievements but it gets even worse even when you move the codes regarding Leaderboard from the sample project you won't able to control on how many entry you want to get or even get your own rank or friend list rank, luckily one of UE4 dev helped me to local player rank and it needed to adjust the source code of sample project so i will post it here later. as for now i believe when you read the leaderboard it will get top 100 (no confirmation). 
- Make sure your app is DefaultEngine.ini like above i mentioned for  Achievements.
- Don't forget  to Setup Leaderboard on Portal/OculusDash before anything else.

avx3zudxl71i.png

----------
Online Sessions:
This one was the biggest headaches of all time -

- First you need 2 separate machine or VM for testing just like Steam session. and make sure you add the 2nd account as developer or invite him to RC channel (this is very important part) i believe alpha channel doesn't work but i can't remember so make sure you do your online test with uploading your game on RC channel.
- Online session using Epic launcher UE4 is total useless and broken and on top of that Oculus version of UE4 on github had its own bug but fix issued and probably its merged by now "https://github.com/Oculus-VR/UnrealEngine/pull/25" 
- If you need session like steam when 1 player make session and the 2nd one find it from the list and join then make sure to make a pool on your portal with "Browse" mode like below image and give it the session name "Pool Key" before you even start with coding your session on the engine side.

xd2s2gyg6cso.png

- For creating session use node "Create session " using Oculus session plugin not the default engine one. and put the Pool name same as the one you created on above image "Pool Key" then open level with "listen" parameter so the client travel to the server map once he join. 
n26smk6ofblp.png

- As for finding and joining session use "find matchmaking session" same from Oculus plugin as for join use default engine join session node, no need to open map from join session on BP since client will travel to the server map just like steam version if the server opened the map with "listen" parameter.
xblmccznw28d.png

- Make sure your DefaultEngine.ini is using the Oculus OSS Net Driver - see below. I've left in the changes I've made from the Achievements and Leaderboard sections above so you can look at the entire picture. I've also added extra lines to increase network bandwidth (optional). Make sure to change YOUR_APP_ID for OculusAppId to your actual App ID:

[/Script/Engine.GameEngine]
+NetDriverDefinitions=(DefName="GameNetDriver",DriverClassName="/Script/OnlineSubsystemOculus.OculusNetDriver",DriverClassNameFallback="/Script/OnlineSubsystemUtils.IpNetDriver")

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

[/Script/Engine.Player]
ConfiguredInternetSpeed=20000
ConfiguredLanSpeed=25000

[/Script/Engine.GameNetworkManager]
TotalNetBandwidth=32000
MaxDynamicBandwidth=7000
MinDynamicBandwidth=4000

[OnlineSubsystem]
DefaultPlatformService=Oculus
bHasVoiceEnabled=true

[Voice]
bEnabled=true

[OnlineSubsystemOculus]
bEnabled=true
OculusAppId=YOUR_APP_ID

Achievement_0_Id="NEW_ACHIEVEMENT_1_0"

----------
Other Tips:
  • Make sure you enable HRTF sound since it really makes a difference in VR. Enabling and using Oculus 3D spatialized audio is easier than you think - setting it up in your project should only take a few minutes: https://forums.oculusvr.com/start/discussion/70889/how-to-enable-hrtf-on-ue4-4-20-solved#latest
  • If you face performance issues, try to disable/enable Oculus Dash to see if your project might have a problem with it. I encountered a performance issue before, but I couldn't confirm if it was due to Oculus Dash. Make sure to test this yourself.
As you can see, a lot of info is out there in the documentation and Oculus samples, but it's scattered about and it's not always obvious which info is correct and up-to-date.

----------
My Wishlist:  
  • Oculus needs to expose their platform services (VOIP, Achievements, and Leaderboards) to Blueprints without the need to use source code from the SDK sample project. We need to be able to pass variables when we create online sessions with Blueprints, so hopefully this will be implemented soon since the "Advanced Session" plugin doesn't work with the Oculus online subsystem.
  • Oculus needs to push Epic to update their Oculus plugin to the latest one for 4.22. 
  • Since I was able to use the Leaderboard Blueprint from the SDK sample project and had one of the UE4 devs adjust the code for me to get local ranks, the only thing left is to expose Friend Leaderboards to Blueprints. Hopefully, this last piece of the puzzle can be figured out with the Oculus and UE4 community's help. Once it's figured out, I'll come back here and update the Leaderboard section.

----------
Hopefully this info will help speed up your work! As I think of myself as a beginner with UE4 and Oculus development, if you see any wrong info here - please correct me. I also may have missed some important info you need, so please ask me and I will try my best to help you. Have a nice dev day! 


----------
Tagging the Oculus Developer Support team in case I have misleading information that need to be corrected. @NinjaGaijin
29 REPLIES 29

Mohammed_hashim
Expert Protege
@ItsNotMeTrustMe

Ah, I see, hope it's ok I shared it earler than what you were panning for it : )

Btw I'm using 4.21 source for my current game which has a couple of oculus fixes and I shipped a full game with it with working matchmaking, if you made an earlier version, let me know since I couldn't compile the plugin for 4.21 : ) 

ItsNotMeTrustMe
Protege
@Mohammed_hashim Nah, you're good. I don't mind it being shared, it's just... somewhat broken still, haha. I'll take a stab at getting it running in 4.21, but that version includes Oculus Platform SDK 1.36, and the minimum required at the moment is 1.40. Might take a bit to get around to it.

You can update that yourself by grabbing it from here: https://developer.oculus.com/downloads/package/oculus-platform-sdk/1.40.0/

1.40 is 12 versions old at this point. v19 (or 1.52, since the naming convention changed) is the latest available. It's still early days for this plugin though, I've really only worked with 1.40.

Mohammed_hashim
Expert Protege
@ItsNotMeTrustMe

I don't think it's possible to update Oculus SDK to the latest with 4.21, there were a lot of changes from the engine side and rendering pipeline. right now everything works fine with me in 4.12 including all Oculus services without bugs, probably 1.40 is going to bring its own bugs to the table which I don't want to find out right now : ) 

ItsNotMeTrustMe
Protege


@ItsNotMeTrustMe

I don't think it's possible to update Oculus SDK to the latest with 4.21, there were a lot of changes from the engine side and rendering pipeline. right now everything works fine with me in 4.12 including all Oculus services without bugs, probably 1.40 is going to bring its own bugs to the table which I don't want to find out right now : ) 


So, there's nothing in this plugin or the SDK that interferes with the changes to the engine/rendering pipeline/etc. This thing is just a wrapper to expose the existing C++ library to Blueprint. The only difference is Blueprint support for int64 was added in 4.22, so you might run into some issues with 4.21 as a result (Oculus Platform SDK uses int64 a lot). I doubt there will be issues, as it doesn't look like there's a need for int64 at the moment. This was a stupid oversight on my part. The obvious (in retrospect) problem is the length of an Oculus ID.

I added branches of the plugin for each of 4.24, 4.23, 4.22, and 4.21. Eventually, I'll try to support back to Oculus Platform SDK 1.32, but for now (on UE 4.21 and 4.22) you'll still have to update the Oculus Platform SDK to 1.40 or later.

I've tested it out and it is certainly possible to update the PlatformSDK with 4.21. To do this, you'll need to download the Oculus Platform SDK from the link in my last comment, then replace a few files in your engine.
  1. Go to the 'Windows' folder that zip file contains, and copy 'LibOVRPlatform32_1.lib' and 'LibOVRPlatform64_1.lib' into the following folder within your engine directory: 'Engine\Source\ThirdParty\Oculus\LibOVRPlatform\LibOVRPlatform\lib' replacing the existing files.
  2. If you're building for Quest, you'll also want to copy the two folders from the 'Android/libs' directory of the zip file into that same engine directory.
  3. Finally, you'll need to copy the entire 'Include' folder from that download and overwrite the files within 'Engine\Source\ThirdParty\Oculus\LibOVRPlatform\LibOVRPlatform\include'
  4. That's it. Regenerate project files to be safe, then compile and you're good to go.
I understand not wanting to update for other reasons, but I figured I'd leave this info here just in case someone else needs it.

Mohammed_hashim
Expert Protege

I understand not wanting to update for other reasons, but I figured I'd leave this info here just in case someone else needs it.


Thanks a lot, this is going to help me a lot in the next few weeks/months, you made a nice guide to on how to upgrade the SDK from our side. < 3 

Anonymous
Not applicable

So many thanks! I was able to pass the majority of the vrc test. However, I failed at vrc.pc.input.4 (TestAppShouldQuit). Do you know if there is something specific to do for Unreal? My game exits correctly. I don't understand why I failed this test. Thank you !

Mohammed_hashim
Expert Protege

Batlordz said:


So many thanks! I was able to pass the majority of the vrc test. However, I failed at vrc.pc.input.4 (TestAppShouldQuit). Do you know if there is something specific to do for Unreal? My game exits correctly. I don't understand why I failed this test. Thank you !


ٍSorry no idea, probably a bug on the engine or SDK side, Try to open a ticket with Oculus team. if you found a solution let us know.  

Anonymous
Not applicable

Batlordz said:


So many thanks! I was able to pass the majority of the vrc test. However, I failed at vrc.pc.input.4 (TestAppShouldQuit). Do you know if there is something specific to do for Unreal? My game exits correctly. I don't understand why I failed this test. Thank you !



Quit is working fine for me and passed that test easily. Perhaps finding how to quit is too difficult in your menu / input scheme?

VintageGreen
Adventurer

[2021.05.14-12.16.46:220][ 88]LogBlueprintUserMessages: [VRGameInstance_C_2147482596] Created Session Successful!
[2021.05.14-12.16.46:221][ 88]LogGameMode: Display: Match State Changed from InProgress to LeavingMap
[2021.05.14-12.16.46:221][ 88]LogGameState: Match State Changed from InProgress to LeavingMap
[2021.05.14-12.16.46:221][ 88]LogNet: Browse: /Game/VirtualRealityBP/Maps/BattleArena_01a?listen
[2021.05.14-12.16.46:231][ 88]LogHMD: FSplash::DoShow
[2021.05.14-12.16.46:231][ 88]LogLoad: LoadMap: /Game/VirtualRealityBP/Maps/BattleArena_01a?listen
[2021.05.14-11.24.11:314][815]LogWorld: Bringing World /Game/VirtualRealityBP/Maps/BattleArena_01a.BattleArena_01a up for play (max tick rate 0) at 2021.05.14-07.24.11
[2021.05.14-11.24.11:315][815]LogWorld: Bringing up level for play took: 0.007358
[2021.05.14-11.24.11:355][815]LogOnlineIdentity: Display: OSS: FOnlineIdentityGooglePlay::GetPlayerNickname
[2021.05.14-11.24.11:356][815]LogOnlineVoice: Oculus: Stopping networked voice for user: 0
[2021.05.14-11.24.11:356][815]LogGameMode: Display: Match State Changed from EnteringMap to WaitingToStart
[2021.05.14-11.24.11:356][815]LogGameState: Match State Changed from EnteringMap to WaitingToStart
[2021.05.14-11.24.11:356][815]LogGameMode: Display: Match State Changed from WaitingToStart to InProgress
[2021.05.14-11.24.11:362][815]LogGameState: Match State Changed from WaitingToStart to InProgress
[2021.05.14-11.24.11:362][815]LogHMD: FSplash::OnPostLoadMap Hide Auto Splash
[2021.05.14-11.24.11:363][815]LogLoad: Took 0.487080 seconds to LoadMap(/Game/VirtualRealityBP/Maps/BattleArena_01a)
-
Map clearly loads into listen and the match apparently is started
I can always see it and the player count set on the other headset both headsets will see the other
both will see player count set/ player name of other headset
but they try to load the wrong level on join session and do nothing

VintageGreen
Adventurer

I'm using 4.26.2 oculus source fresh as of yesterday no compile issues

But Join Session even with Turtle Rock Studios fix does not work it keeps trying to load the default wrong level.

two headsets on dev one test user all setup tried RC channel and Alpha. I've been at this for 3 weeks straight I've tried everything.

Please help.