Поделиться через


Ready Player One: Bringing a 1990s 2D game to the HoloLens - Nibbles remastered

Now I'm not a HoloLens team member - but recently I've been using the device to develop and test an old 1990s classic game "Nibbles" in 2D.

A while ago, I remastered the QBasic sample game "Nibbles", known to many by the name of snake.  This is not a full rewrite, but it utilises some of our latest development technologies including Azure Application Insights and the Universal Windows Platform (UWP) - which has enabled me to deploy this onto a range of Windows 10 devices - including Windows Desktop, Mobile and the Raspberry Pi: https://www.microsoft.com/en-gb/developers/articles/week03dec15/building-an-arcade-cabinet-that-runs-on-windows-10-iot/

Since then, I've run it on Surface Hub and now I've had chance to deploy it to the HoloLens!  This is a 2D game which is no way shows off the full device potential such as the likes of RoboRaid or Fragments does.  However, what it does highlight is the development opportunity for application and games developers alike.  Since the game was UWP there were no coding changes required specifically to get the app working on the HoloLens.  However, after testing the game on the device I soon realised the existing input mechanisms to control Sammy the snake needed to be adapted either around gestures or voice input.

Here, I chose speech input as this can be used across any other Windows 10 device that has a microphone.  To do this I made use of grammar lists, these are the most concise way of detecting specific input controls.  Essentially, I create a list for each word that I want to listen out for within the game which corresponds to the direction of movement of the snake - Up, Down, Left, Right.  There are a few other commands to listen out for such as Pause, Start etc.  I'm using the SpeechRecognitionListConstraint to do this, as this works perfectly for these type of spoken instructions:

speechrecog

There is even a little homage to the excellent book by Ernest Cline, which you'll see in the sample clip below:

[video width="1280" height="720" mp4="https://msdnshared.blob.core.windows.net/media/2017/01/Nibbles-compressed.mp4"][/video]

Get it now!

Nibbles is available for free in the Windows store for Windows Desktop, Mobile and Holographic here: https://www.microsoft.com/en-us/store/p/nibbles-uwp/9nblggh69hd7 Windows Holographic