In this post, you will find potential fixes for UE4 issues with VRC.PC.Input.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.
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:
- Make a new actor
- 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.
- 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.
- 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.
- 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" )
- 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"
- Once you done your result would be like below image.
- 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
- Done! It will work now as it should
----------VRC.PC.Input.2 - Game should pause while the Universal Menu is up
- Remember the actor we created named "OculusHMDNotifications"? Open it and go to "Class Default " on the top side when you click on it
- 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.
- Now add Set game paused and connect it to "has system overlay present" just like below imagine on event tick.
- 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 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
to your actual App ID:
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.
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
to your actual App ID:
- 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.
- 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