Building apps & games for Xbox One using UWP – Build once and target many FutureDecoded 2016

Nov. 14, 2016
protect

image

image

 

For my sins, I was asked back to FutureDecoded again this year to give a talk on the Microsoft UWP platform, specifically about bringing games to the XboxOne using UWP.  By all accounts the session went well (especially as there was standing room only by the time the talk started). With it being just two days in the London ExCeL exhibition center, not everyone who wanted to make it could, in fact even some people were contacting me on the day saying they were in other sessions at that time but wanted more info.

So for everyone who couldn’t make it on the day or missed the session (or for those wanting a recap), I’ve recorded the session at home and published it on my “Darkside of MonoGame” Youtube channel. (I just have to hope my MonoGame friends will forgive me for featuring Unity on there for a bit Open-mouthed smile

<iframe title="Building apps &amp; games for Xbox One using UWP - Build once and target many - FutureDecoded2016" src="//www.youtube.com/embed/AAMToCwPy8s?enablejsapi=1&amp;origin=https%3A%2F%2Fwww.gamedeveloper.com" height="100%" width="100%" data-testid="iframe" loading="lazy" scrolling="auto" class="optanon-category-C0004 ot-vscat-C0004 " data-gtm-yt-inspected-91172384_163="true" id="749906951" data-gtm-yt-inspected-91172384_165="true" data-gtm-yt-inspected-113="true"></iframe>

You might also ask “Why all the Fuss?”. Well the answer is simple, Microsoft just opened up the XboxOne to UWP developers, allowing any retail XboxOne to become a development machine and test / deploy and publish UWP projects to the XboxOne Store.  It’s like Christmas has come again for those of us who remember the Xbox Live Indie Game platform and the thrill of writing your own games and running them on your home Xbox.

Just what is UWP? (The Universal Windows Platform)

image

image

I’ve posted a few times about the UWP platform, but to recap, UWP is Microsoft’s latest endeavor to make it even easier for developers to be able to publish on Windows platforms. So much so, that now you only need one project to be able to deploy on to all of their Windows 10 platforms, this includes:

  • Windows 10 desktop

  • Windows 10 Mobile

  • Xbox

  • (supported) IoT devices

  • Surface Hub

  • HoloLens

Plus, any other devices that Microsoft decides to roll out on to from now on.

It pretty much sounds like a multi-platform dream, and it certainly is.  But how does UWP handle all the different variations on its platform? Each device is different and has its own unique characteristics. The answer in this case is “Extensions”:

image

image

As you might expect, Windows 10 has a single “core” which runs on all devices, in exactly the same way.  Then for those little extra’s, the UWP platform provides an “Extension” component that is specific to each platform.  However, these extensions are also expressed on all the other platforms, so your code doesn’t break and you write the same code as if you were writing for them all.  Where a device doesn’t support a certain feature (say the Holographic API on an Xbox), then the code simply does nothing, it doesn’t error, it doesn’t crash, your code still works but nothing actually happens. For those platforms with that feature, lights start shining, the bells ring and the choir sings out with joyful praise.

Also as part of this “Extension” framework, Microsoft gives you the ability to test if a feature is available or not, allowing you to write different code depending on whether the feature is active, like if you want to use a devices accelerometer if it has one, or use a virtual joystick on a desktop with a touch screen, or fall back to keyboard if hat isn’t available.  Sure, there is a bit of thought to go in to building for “Any” device but that is the trade-off for building one solution.

But what about the Games?

image

image

When we start looking at building games under UWP, there is a lot of support (that is constantly growing) from third parties. As you can see most of the major engines and frameworks already support the Universal platform out of the box, making it even easier to publish your game as a UWP app.

Still not see any engine or feature you like, then there is always the ultimate fallback:

image

image

Under the hood, UWP Games are just a DirectX surface and you can write games using native DirectX in either C# or C++, there are even Visual Studio Templates “out of the box” for UWP as well.

Getting started with UWP on Xbox

image

image

Now that UWP apps can be deployed / tested and run by anyone with a Retail Xbox, we can go wild and try out our own games to see how they run on the big screen.  Once you lick all the bugs and get it just right, you can publish that game “as is” to the Xbox Store. Well, once you have your project accepted by the ID@Xbox team (which is even easier for UWP developers now)

So long as you have a Windows 10 PC and a retail Xbox, your good to go as everything else is free, the tools, the software, even the ability to switch your retail XboxOne over to a UWP dev kit. All from the comfort of your own home (or hotel room with free wifi)

There is one other caveat, that you need to also have a Windows Store developer account.  This normally costs about £19 for an individual, a little more for a company account.  You can either get this yourself, or when you are accepted by ID, you will get this account plus a load of other software completely FREE. Up to you.

P.S. If you have an MSDN account, you also get a code for FREE, check your benefits.

Setting up your development environment

image

image

Once you have everything ready, getting started couldn’t be simpler and there are only a few short steps. As the slide above shows, you can get up and running with your first project deployed in just 5 Minutes. (if your using Unity, it might take a little longer Smile with tongue out)

In short, what you need to do is:

1:  Install the “Dev Mode Activation” app on to your Xbox from the Xbox Store

2: Launch the “Dev Mode Activation” app. You will be presented with a code and a URL. Navigate to the URL on your PC, sign in with your Windows Account (same one used with your Xbox Live Gamertag) and enter the code to register the Xbox to your Microsoft Account

3: Once complete, your Xbox will automatically refresh and then ask you to restart.

This will now boot your Xbox in to UWP developer mode with a completely separate sandbox inside your Xbox.

Your Retail settings / apps are still safe on your Xbox, you just can’t access them from developer mode.  You can return to Retail mode at any time.

4: Once you have signed in to your Xbox using your Microsoft account, you can launch the Developer Portal app on the Xbox.This shows you all the apps / games installed plus a ton of other developer details.

Take note of the Tools IP in case Visual Studio doesn’t automatically detect it.

5: The first time you connect to your Xbox from Visual Studio (selecting the deployment as remote and selecting the Xbox, as shown here) you will be asked for a code to pair the Xbox.

You get this code from the Developer Portal on the Xbox in the “Pair with Visual Studio” section.

Visual Studio and the Xbox must be signed in using the same Microsoft account you activated with.

6: Done.  You should now be able to deploy and run games from Visual Studio on your Xbox.

You can also see debugging information from your Xbox (providing your local network supports it) while the game is running.

Just make sure you Run in “Release” or “Master” mode when looking at performance issues as the debugger has an impact.

And that’s it. You are up and running.  The security of the setup ensures that you (and only you) can connect to your Xbox in dev mode and deploy apps, so long as you use the same Microsoft account for everything.  You can still sign in other gamers, using their GamerTags for local multi-player (although you can’t grant gamerscore Open-mouthed smile).   If you also are a member of ID and have access to to the Live SDK and services, you can also test networked multi-player and all the other Live services.

Checking out the demos

For the demo’s, you are going to need to watch the video but here are some handy links to the start of each demo:

*Click on images to view t

JikGuard.com, a high-tech security service provider focusing on game protection and anti-cheat, is committed to helping game companies solve the problem of cheats and hacks, and providing deeply integrated encryption protection solutions for games.

Read More>>