Search Unity

Porting SteamVR/OpenVR game to Oculus Store.

Discussion in 'AR/VR (XR) Discussion' started by MalboM, Sep 8, 2020.

  1. MalboM

    MalboM

    Joined:
    Apr 29, 2013
    Posts:
    66
    Hello,
    I have a question regarding porting a game to Oculus VR:

    We've built a VR game in Unity using the SteamVR plugin that's built upon OpenVR.
    The problem is that we now want to submit the game to the Oculus store but we need to remove the Steamworks libraries, SteamVR and OpenVR API.

    The Steamworks libraries are not an issue but with all of the interactions being built upon SteamVR and with a lot of the components from SteamVR Interaction System being heavily modified, is there any quick way to port/modify this project to just use the OculusVR SDK so that it's acceptable for the Oculus Store?

    Or is our only option to basically start from scratch with the OculusVR SDK and modify that framework?

    Thank you in advance
    Fabio
     
  2. Extrys

    Extrys

    Joined:
    Oct 25, 2017
    Posts:
    345
    That's a common problem, yes you will have to create like a switchable input filtering, generalize and abstract the interaction system to support any input system
    currently, oculus supports the new unity Input package, but not SteamVR

    I don't recommend the use of specific platform interaction systems because of this.
    You will need to create a framework that supports both SteamVR and Oculus

    From my experience what you should do first, is to create a custom action map for your game like a little API for accessing/registering events for both systems using a common interface

    let's say something like this but more elaborated
    Code (CSharp):
    1. #if UsingSteam
    2.       class MyCommonInterface
    3.       {
    4.           public Source source;
    5.           public SteamVR_Action_Boolean jump;
    6.  
    7.           public bool IsPressingJumping => jump.OnPress(source);
    8.       }
    9. #else
    10.       class MyCommonInterface
    11.       {
    12.           public InputAction jump;
    13.  
    14.           public bool IsPressingJumping => jump.ReadValue<bool>();
    15.       }
    16. #endif
    17.  
    18.       class UsageExample
    19.       {
    20.           public MyCommonInterface commonInterface;
    21.  
    22.           void Update()
    23.           {
    24.               Debug.Log(commonInterface.IsPressingJumping);
    25.           }
    26.       }
    In that way, you can switch between Steam and Oculus
    all you have to do is to add common access to every feature they share
    so if for example, you add a new action or some event you would need to add it in both classes in the same way so the Usage example code doesn't care about which one use

    PD: sorry for my English if you find something difficult to understand just make me know!
     
  3. MalboM

    MalboM

    Joined:
    Apr 29, 2013
    Posts:
    66

    Thanks a lot for the answer!

    Our main problem though is that the game needs SteamVR(Software) to be running to track the hands and headset.

    We've used the Steam VR plugin from the asset store and I've modified a lot of the scripts from the Intereaction System. The problem is that these scripts are based on SteamVR code and so in order for the game to run, it needs to run Steam VR. Basically the whole structure of how a lot of the interactions work is based on the Steam VR Interaction System.

    Do you think the only solution is to rework the foundations with a neutral third party asset that is allowed across other VR platforms?

    thanks!
    Fabio
     
    Extrys likes this.
  4. Extrys

    Extrys

    Joined:
    Oct 25, 2017
    Posts:
    345

    There are many more solutions that only one, I can not say its the only solution, but is the solution I recommend under my experience.

    I don't recommend relying too much on third-party assets for VR Interactions.
    You know, VR plugins change a lot and also in unity,
    so I recommend doing an adapter pattern which is really easy to do and keep you away from using the third party already made interaction libraries

    If I were you with the same situation, I would create the interaction from scratch, this is something I had to do 2 times in my game, and each time I have been hired in any VR Game studio, in order to get a nice interaction architecture, the workflow is always better when using something custom, this is my recommendation, also in that way you have full control over the interactions systems, so if some breaking update comes on Oculus or SteamVR it won't break your main interaction system, just probably the way to access some characteristics of the controllers/headset, which can be easily patched.

    But if you don't want to do that, you may take the current interaction system and try to generalize it for being able to use it with more headsets, for example, creating a way for accessing the input from the oculus in the same way you do in SteamVR and using that interface in there using an intermediate class for adapting the oculus classes to be used with the SteamVR libraries, But this will be mostly useless and a waste of rime and effort, because in order to publish on Oculus you will need to remove the OpenVR.dll
    then most of the SteamVR Scripts won't work


    Edit:
    Also for Spatial tracking I recommend to use the Pose Tracker Driver component, it will work with every headset
     
    Last edited: Sep 22, 2020
    Gruguir likes this.