Asset - Extension GMCardboard - Google Cardboard VR for GameMaker Studio 2

mMcFab

Member
Price: TBD (hopefully free - check below)

This is Google Cardboard for GameMaker Studio 2, a native C++ extension for Android
This extension brings mobile VR to GameMaker, allowing you to create VR experiences with relative ease

I have wanted to make this extension for a long time, but I was kinda intimidated by the concept of native C++ extensions for Android.
In September, I took the plunge and gave it a try anyway. Since this post exists, you can probably tell I figured it out!

Demo Project APK at https://maddestudios.itch.io/mmk-gmcardboard featuring Gesture Detection, 3D audio and various input methods
Here's a video of it in action in case you don't feel like installing random APKs:
(My phone captures stereo audio as mono when using screen capture so it doesn't properly demo that bit. The framerate is also capped at 120 fps, but it looks low here since I recorded at 24 fps. Also I know the graphics aren't spectacular in this, but I'm not trying to demo my modelling/shadering skills here lol)

Documentation available at https://docs.maddestudiosgames.com/?page=gm_extensions/gm_cardboard/about
(feedback on the documentation website is also appreciated! It isn’t great on mobile at the moment, but it does work sort of. I may fix it up later)

Key Features
  • Easily enable mobile VR in your game with as few as 3 functions! It's Virtually Plug-and-Play! (I was able to add it to YoYoDungeon in under 5 minutes)
  • Supports QR code scanning for custom Cardboard Viewers
  • All important Cardboard SDK features accessible through the Extension
  • Complicated/expensive code is compiled from C++ to native libraries where possible, giving consistent performance between YYC and VM builds
  • Helpful functions provided to make checking and using viewer/head orientation pretty straightforward

Requirements
  • GMS2 IDE/Runtime: 2.3.4 or higher (though I may be able to back-port -- just gotta convert AARs to JARs without breaking anything)
  • Supports Android Export ONLY
    • minimum SDK 16
    • Requires locking the orientation to Landscape (this could change!)
    • Should be compatible with all Architectures (though x86 is untested), both VM and YYC

Basic Setup

One of the goals of this extension is to make enabling VR to a GameMaker game as simple and straightforward as possible.
In fact, it is possible to enable VR in your game with this extension with as few as 3 functions

GML:
//Initialises Google Cardboard - call this once
cardboard_init();

//Binds Cardboard rendering and updates to views - call this once per room
cardboard_set_views(view_left, view_right);

//Draws the distorted views to the display (run this in a GUI event)
cardboard_draw();

Why Cardboard?
I am greatly interested in VR and VR experiences, but there's no way I can afford something like a Vive. Luckily, Cardboard starts at like 2€ plus a phone, so I can at least try stuff out with that.
Maybe I should probably have just used unity or something? but also no lol. I'm unfamiliar with Unity, plus I'm a big fan of doing weird or unusual stuff in GameMaker, and this is what I wanted to do! So I did it.
And now hopefully other people can do VR in GameMaker too!


Pricing
So, if I were to sell this as an extension, it would probably be between 50-80 euros per license.

HOWEVER....

I want this to be free and open source (including the C++ and demo project source), but I have a conflict - I have no money and I'm in peril because of it!
So as an alternate goal, I'm doing a little fundraising - if we reach my Ko-Fi goal (preferably before the end of October), I will release the documented extension and the commented source code for FREE, for EVERYONE. I like this option very much because I like technology and knowledge to be free and accessible, but I also like being alive.
So it's a bit like a mini kickstarter, I guess? It's about equivalent to 15 people buying it at a regular 80€ price, but it would be available to everyone.
I think if you donate 50€ or more, I'll give you early access to the extension (minus source code)

I'll also make a quick video tutorial on using Android Studio to build and use AAR packages with GameMaker. It's not super complicated, but it did take a little figuring out.

I'll also be making past and future extensions free and open source if we can keep the KoFi flowing (including, but not limited to, my Blender->GMS2 animated model system)

I hope this is allowed? I know it's a little unusual, and I couldn't find any rules against it nor another case like this in the Marketplace forum from a quick search, but this will be released on the Marketplace for free if we reach the support goal.

Buy Me a Coffee at ko-fi.com

Future?
I want to add iOS support (since the SDK supports it), though that does require an iPhone. I'd also be open to expanding this to a general VR extension (Desktop VR would be really cool), but that might require some additional hardware.
 
Last edited:
If this works for google cardboard, I’m curious if it’d work for one of the more modern standalone headsets like the quest headsets, if so, that’d be really interesting to mess with
 
Top