MonoGame for VR? some general questions about where to start.

I’ve been wanting to start a project building a VR game in MonoGame for a while now. I’m mostly interested because I want to learn more about how VR games work, rather than out of a desire to actually create a fully-functioning game. However, considering I’ve only ever worked with MonoGame on 2D projects up until now I expect this to be a long process requiring me to step back and do a lot of learning (in fact that’s kind of the point). In any case, I have a few questions that I think it would be helpful to know the answers to before I begin.

  1. How can I get Inputs from SteamVR into MonoGame? I don’t imagine there are built-in systems for it like there are for keyboards and most standard controllers.

  2. How can I render 2 different views? So far, I’ve only seen MonoGame be able to produce one view drawn on one window. but for the stereoscopic vision of VR headsets, I would need to draw two different views and send them to the two different screens inside the headset.

  3. How can I send the views to my headset? Along the same lines as the last question, but a bit more specific. MonoGame usually just displays its window on the desktop, but my headset only displays what SteamVR tells it to. How can I get MonoGame to display in a SteamVR environment?

I have a lot of experimentation and reading to do in order to even know where to start with this, but if these questions are answered it will go a long way towards speeding up the process. Alternatively, if you folks let me know that this isn’t actually possible with MonoGame it will probably save me a lot of time and frustration.

Hi @Auden_Clifford, Welcome to the Community!

This post may have some answers…

Happy Coding!

Hi @MrValentine thanks for the info. It took me a while to get back to this post because I’m balancing college classes, but in the meantime, I did some research into what I can do to start this project. I’m certain the questions the thread you linked answers will be useful to me once I get further into the project, however, the questions I have right now are much more entry-level. From my research, I’ve found that in order to have my program communicate with my headset I’ll need to implement an API. I’ve decided to use the OpenVR API since it will work best with my setup. The problem is I’m pretty much still a newbie and have no idea how to use an API in a project. Everything I’ve found online has only shown me how to add the API to a C++ project. The C# project format is wildly different and the process isn’t transferrable. Info on API and libraries in general is actually super hard to find as it turns out. I can’t even seem to get a general tutorial on how to add library files to a C# project. Searching this stuff up online is completely unhelpful. It’s just tutorial after tutorial on how to create a web API or how to create a library class, there appears to be a complete lack of information for people who just want to use one. And that’s just adding the API into my project, I still haven’t even gotten to the part where I need to take an API written in C++ and attempt to use it in C#. A good start for now would be if you know of any resources that can just get me acquainted with adding APIs to C# projects. Even better would be if there was one specifically for OpenVR. The documentation on their GitHub is completely unhelpful to a beginner like me since it doesn’t explain how I get the files I need into the project in the first place. In any case, thank you for the info you’ve provided so far, I’m sure it’ll prove helpful once I really get rolling. I’m just much too new at this for any of it to be applicable at the moment. (totally not regretting starting a project far above my experience level :smiling_face_with_tear:)

At a cursory glance, a project called OVRSharp and another project called OpenVR.NET exists, both of which borrow code from Valve’s own Unity implementation.

Even if you don’t want to use those specifically, you can at least look at their code and understand how it works, looking up some of the key points (such as the “DllImport” attribute).

Also, if you search for “OpenVR C#” or similar, you’ll probably find a few more projects. Might have to visit more pages than the first, so beware.