As we’ve been building Ethereal Legends, one thing we’ve been actively researching are which platforms we should target. Just like any other game developer, we’ve had to weigh the cost of resources spent developing for different platforms; what is our experience with said platform, how quick or easy is it to integrate, and how many players can we get from those devices. Should we target PC or console? Think about Linux or Mac? What about mobile devices?
Virtual reality development is naturally shaping up to be more of the same. What headset do you target? Rift or Vive? What about PlayStation VR? Have you considered Gear VR and mobile?
Razer has taken a shot at attempting to solve this problem with OSVR, their open source virtual reality initiative. The idea being that all software and hardware is completely open source, available for download from their website. That’s a pretty big deal for virtual reality enthusiasts, but maybe a bigger deal for VR as a whole. There’s a lot of potential there, and it’s what first drew our attention to OSVR.
We were contacted a few weeks ago by some friends over at Razer, and they were able to send us one of their Hacker Development Kits to work with. Jacob and I were excited to be greeted by a FedEx guy this afternoon with the headset in tow, and we got right to work implementing support for the device into Ethereal Legends.
I’m sure you can find an unboxing video of the headset somewhere (here), so I’ll just make a few quick comments about the hardware. First, it’s packaged extremely well, everything fitting cleanly and snugly into the box. All the parts seem to be of a pretty high quality, and the headset definitely has some weight to it (more than the DK2). Cables seem to be of excellent quality. Needless to say, despite how nice the headset is, by far the coolest part is the silly little stand they used for the IR camera. It’s flexible and fun… just look at it!
Well, since we’re an Unreal shop… first things first, we wanted to see how OSVR would work with Unreal Engine. We skipped a bunch of the intro stuff in the docs and went straight to getting the plugin into the engine. Razer has an OSVR plugin available for UE4 engine versions 4.6 through 4.9, and I assume they’ll keep updating for the foreseeable future.
First thing we noticed is how sparse the documentation is. There really isn’t much info out there yet on working with OSVR, and Razer’s own documentation leaves much to be desired. Luckily what is there is enough to get a savvy user up and running, but it’s definitely not consumer friendly by any means. So the rest of this post is aimed at helping you get your OSVR HDK up and running with Unreal Engine, and hopefully you’ll use it to create cool stuff! We were able to get the headset working with Ethereal Legends within a couple hours of unboxing the thing, so it’s relatively simple.
First, right after you get your HDK, read this Getting Started post. It’ll help familiarize yourself with some of the specifics of the headset, like adjusting the optics and whatnot. Before you can do anything, you need what they call the “OSVR Core“, which is the SDK that controls the headset (grab it here). Download the latest version (choose x86 or x64, whatever your OS is) and unzip the archive to a directory of your choosing. Next step is to open the root directory of the SDK and run a file called “add_sdk_to_registry.cmd“. (You can optionally run the .ps1 file of the same name to perform these actions through PowerShell, but it’s not required). The idea is that this file will run a series of commands letting your computer know where the SDK was installed.
Next up, you’ll need the OSVR-Unreal Plugin. Download it through their Github page. Instead of just the plugin, what you get when you download is actually an entire UE4 project with the OSVR plugin installed. However, you may notice that the project can’t be run and attempts at building always fail. This is, of course, due to the OSVR-Unreal plugin, and you’ll have to fix it by running the “ImportFromSDK.cmd” file found in the root of the OSVR-Unreal download. This command will actually import a bunch of files into the plugin’s directory from the SDK, which will then allow you to successfully build the UE4 project. This seems necessary due to the file size of the transfer (the plugin goes from like 210k to a whopping 663 MB after transfer). Unfortunately for us here at Soverance, this command file did not work on the first try. And of course, the documentation on this process just assumes you’ve already completed this step.
While I could find no reference to this in Razer’s documentation, I did find it in this forum thread, where apparently the “ImportFromSDK.cmd” file cannot be successfully run while the installed OSVR SDK resides in a path that contains spaces. For whatever reason, the “ImportFromSDK.cmd” fail just stops executing when it hits a path with a space. So if you installed your SDK at “C:OSVR“, then you’re good! If you picked “C:Program FilesOSVR“, well… you’re out of luck. Go edit the SDK’s path until it has no spaces whatsoever, and then you’ll have to re-run the “add_sdk_to_registry.cmd” file so you computer knows where to find it’s new location.
Once your SDK has no spaces in it’s path, return to the OSVR-Unreal project and run the “ImportFromSDK.cmd” file. It’ll hopefully find the SDK this time, and import the necessary files into the plugin’s directory. You can then successfully build and run the UE4 editor.
Before you open the UE4 editor, you will need to start the OSVR server. You’ll find it in the SDK’s bin directory, as an executable named “osvr_server.exe“. Run this file to open a command line interface which will give you some debug info. You’ll need to have this server running any time you wish to use the OSVR HDK, and before you start the UE4 editor.
For us, the downloaded project wasn’t going to cut it to start with OSVR development. We’ve already got a project file with a game in it, and we needed the plugin installed into our project. Luckily, it was as easy as copying the entire OSVR plugin directory, and pasting it into our project for Ethereal Legends. A quick rebuild later, and we were up and running.
Some quick caveats to working with OSVR in Unreal Engine:
- Not UE4-specific: the OSVR headset works as an extended monitor, and seems to set it’s display to portrait mode when physically looking at it, even though the Nvidia control panel claimed it was in landscape mode. We had better results by swapping the rotation of the OSVR display to portrait mode, which would make the display render in landscape mode. It’s swapped, and makes for a strange user experience.
- Also not UE4-specific, but the device doesn’t seem to have a “Saver” mode like the Rift does, and therefore it’s screen is on full power 100% of the time. We only had it active for a couple hours, and it definitely started getting warm. A 12-hour development session might melt this thing.
- Definitely UE4 specific: You will need to disable ALL other virtual reality plugins in the editor, including Oculus and Steam VR. This will likely cause an editor restart, if you had them enabled previously.
- We tried this using UE 4.9.2 and the OSVR SDK 0.6.193. There doesn’t seem to be a way to use a Direct Mode like the Rift has, and every time we tried to play in Standalone mode, the game would crash with OSVR as the culprit (I fired off a few crash reports to Epic, but I don’t recall the exact error. I’ll look again later.) We were only able to get the OSVR headset to work with the Unreal Editor by using the “Play VR-Preview” mode, and the PIE window had to be set to 1920×1080 beforehand to ensure maximum resolution.
- Because Unreal’s PIE window pops up on whatever screen has the main editor window, the only solutions we had were to either set the OSVR HDK as the main monitor (an awful solution), or drag the editor’s main window over to the headset’s screen, and then hit the PIE button. For development purposes, this process is a time-wasting nightmare. Every time you want to test something you now have to drag the window over, peek through the lenses to find your cursor and hit the button, playtest it, then drag the window back over to continue editing. Oh and good luck finding the cursor again to do that, now that you can’t really see the editor window. I’m having DK1 nightmares all over again.
- Even though OSVR has a cool little belt clip (which will be really nice with motion controllers), there are still freaking cables EVERYWHERE.
Overall, implementing OSVR support into Ethereal Legends made for a pretty fun evening, as Jacob and I got everything unpacked, installed, and running. We’re pretty impressed with the quality of the OSVR hardware, though there are certainly some points to be scored in the software and documentation departments. We haven’t had the opportunity to play with the OSVR positional tracking yet, but we’ll get to that soon. We’re sure Razer will continue to put support behind OSVR and turn it into something great, and we’re happy to be on-board at an early stage to help show what we can do with the tech. Should make for an interesting ride!