Fixes for common UE4 + Oculus Platform issues before submitting to Store — Oculus
Welcome to the Oculus Developer Forums!

Your participation on the forum is subject to the Oculus Code of Conduct.

In general, please be respectful and kind. If you violate the Oculus Code of Conduct, your access to the developer forums may be revoked at the discretion of Oculus staff.

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

Mohammed_hashimMohammed_hashim Posts: 90 Oculus Start Member
edited January 15 in Unreal Development
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


----------
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.


----------
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"



----------
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.



----------
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.



- 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. 


- 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.


- 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

Comments

  • NeontopNeontop Posts: 212 Oculus Start Member
    @Mohammed_hashim, thank you for all those tips.  :)

  • marcelofdezmarcelofdez Posts: 14 Oculus Start Member
    Thanks  ;)
  • MrComfortMrComfort Posts: 28
    Brain Burst
    Fantastic!! I've been struggling to get OSS sessions to work for months now. Will try the github Engine version now (Epic Launcher Version 2.21.1 still does not work for joining sessions).
    And I totally agree, Oculus/Epic needs to expose their Platform SDKs incl. Oculus Avatars as BPs!
    Thanks again for this wonderful writeup!
  • NinjaGGNinjaGG Posts: 216 Oculus Staff
    @Mohammed_hashim Thanks for this! I'm currently going through this line by line to verify. I've gone ahead and changed some formatting and text for your post to read better. 
    If you need immediate help or want additional support/context on an issue you are having with our platform or integrations:

    1. Gather any and all logs, screenshots, and version numbers of relevant software (Oculus SDK, engine, etc.)
    2. Please submit a ticket here (include what you've gathered in step 1).
    3. Tag me @NinjaGaijin once you have done so!
  • Mohammed_hashimMohammed_hashim Posts: 90 Oculus Start Member
    You guys welcome Neontop marcelofdez MrComfort it was my pleasure to share it with you.
    NinjaGaijin Thanks a lot, people now can actually read it : ) 
  • MrComfortMrComfort Posts: 28
    Brain Burst
    @Mohammed_hashim @NinjaGaijin Do you need to upload your build to a release channel (like Alpha) in order to test sessions, or can you simply start the .exe of the packaged project on each of the computers?
  • Mohammed_hashimMohammed_hashim Posts: 90 Oculus Start Member
    MrComfort said:
    @Mohammed_hashim @NinjaGaijin Do you need to upload your build to a release channel (like Alpha) in order to test sessions, or can you simply start the .exe of the packaged project on each of the computers?
    I can't remember well but i believe if you don't upload it to RC channel it won't work. 
  • MrComfortMrComfort Posts: 28
    Brain Burst
    edited January 10
    MrComfort said:
    @Mohammed_hashim @NinjaGaijin Do you need to upload your build to a release channel (like Alpha) in order to test sessions, or can you simply start the .exe of the packaged project on each of the computers?
    I can't remember well but i believe if you don't upload it to RC channel it won't work. 
    My god, it finally worked when uploading the build to the RC channel!
    it might also be good to mention that you need to disable the SteamVR plugin (if not already disabled) and that you can test matchmaking with launching the app in 2D mode via Oculus Home (that way you do not need 2 Rifts for testing).
    Thank you again so much!!
    Now let's hope that Oculus will soon expose more of the SDK features as Blueprints and gets Epic to update their launcher version with the latest Oculus integration:)
  • jamesoloughlinjamesoloughlin Posts: 9
    NerveGear
    I am experimenting with Oculus 1.34 Audio SDK on a rebuilt UE4.21 and running into some issues. Just curious I can't access the link you provided to enable HRTF figure I should read that maybe there are some solutions.
  • Mohammed_hashimMohammed_hashim Posts: 90 Oculus Start Member
    edited February 27
    I am experimenting with Oculus 1.34 Audio SDK on a rebuilt UE4.21 and running into some issues. Just curious I can't access the link you provided to enable HRTF figure I should read that maybe there are some solutions.
    Yeah sorry looks like I made that post on Start section (you need to be start member to see it). but it doesn't matter now as the answer isn't available there anymore as the member who responded isn't available so his post is gone. if you explain your issue here I might able to help you.

  • Bro3epBro3ep Posts: 3
    NerveGear
    edited May 7
    @Mohammed_hashim
    Hi thanks for tips its amazing.
  • KuckiVRKuckiVR Posts: 11 Oculus Start Member
    edited June 23
    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.

      Do I also have to do that for Oculus Sessions? Or can I just use the nodes from the Oculus Plugin

    @Mohammed_hashim
    @NinjaGaijin

    Edit: Ok I tried the Plugin nodes and got it working.
Sign In or Register to comment.