Using Xbox Live in UWP apps

Favourite 7 favourites
Tutorial written by AshleyOriginally published on 27th, June 2017 - 5 revisions

This tutorial applies to both Construct 2 and Construct 3. Any differences between the two will be noted.

Universal Windows Platform (UWP) apps are Microsoft's new technology to run apps across Microsoft platforms like Windows 10 and Xbox One. Now you can also use Xbox Live in Construct games! This is a requirement for Xbox One publishing as well.

Ideally you will already be familiar with exporting UWP apps.

Initial registration

Before you get started, you'll need to sign up for the appropriate Xbox Live program. There are two options:

1. Xbox Live Creators Program
2. [email protected]

The Xbox Live Creators Program is open to everyone and has fewer requirements. However if you are serious about getting a game published to Xbox One, you can apply for the full [email protected] service, which has access to more features and services but also requires full certification.

Both will require a Microsoft account and access to the Microsoft Dev Center dashboard where you can create and configure UWP apps.

Setting up an app

Before you get started, you'll need to create a new app on the Dashboard. If you've created a UWP app before, you should already be familiar with this. All you need to do is click the "Create a new app" button and follow the steps.

Once you have created an app, you'll need to enable the Xbox Live service. Once you have selected your app, choose the Services drop-down menu and select Xbox Live. The first time you do this you may be prompted to enable the service; follow the steps it provides to enable it.

Once enabled, you should see details about configuring and testing your app with Xbox Live. Take a note of the Title ID, SCID and Sandbox ID details that are listed.

Setting up sandbox and test accounts

Before you can test your app, you will need to set up two more things:

1) The testing sandbox. This is an isolated environment for testing before you publish an app.
2) A test account to use in the sandbox.

Microsoft provide their own documentation about this in the Xbox Live documentation. Follow the guide there to get this set up. In short you'll need to switch your Windows 10 PC - or Xbox One in developer mode - to the sandbox previously listed in the app's details. You'll need to use some tools that Microsoft provide to do this. Then use the Dashboard to create a test account which has access to that sandbox. When you later come to test your app, log in with the test account instead of a real account. (Your real account may also work in the Creators Program, but it's probably sensible to isolate everything to a test account anyway so it doesn't affect your real account.)

After you make any changes on the Dashboard, be sure to click the Test button to publish those changes to the testing sandbox. Remember to do this again if you make any more changes later on!

Setting up Construct's Xbox Live plugin

Add the Xbox Live plugin to your project in Construct 2 or Construct 3 if you haven't already. Note this tutorial is aimed at Construct 2 r245+, and Construct 3 r41+, so make sure you're using the right versions.

When you add the plugin or select it in the Project Bar, you'll see Xbox Live related properties in the Properties Bar. These need to be filled out with:

Title ID from the app's Title ID in the dashboard
SCID from the app's SCID in the dashboard
Xbox Live Creators Title needs to be enabled if you are using the Xbox Live Creators Program; otherwise disable it.

This information allows Construct to configure the exported project correctly.

Using Xbox Live features

To test Xbox Live is working, you'll want to add some events using the Xbox Live plugin. A simple way to start is add a button that does Sign in when clicked, and then use the On sign in success and On sign in error triggers to check the result.

You can also try Sign in silently at the start of the layout. If the user has signed in before and their sign in was remembered, this allows them to be automatically signed in again without being prompted.

Once signed in, the Request profile info action allows you to obtain information about the signed in user, such as their gamertag.

Exporting

When exporting your project, export like a normal UWP app. That means choosing the Windows Store option in Construct 2, and make sure the target version is Windows 10 Universal. In Construct 3 the export option is named Windows & Xbox One (UWP), which exports the same kind of UWP app.

In Construct 2, the exported Visual Studio solution by default uses the Windows 10 SDK version 10.0.10240.0. If you run your project and see an error, you may need to adjust the project settings to change the target SDK version to one you have installed. In Construct 3 you will be prompted for the Windows 10 SDK version you have installed, so it can set this for you.

Currently Visual Studio 2015 and 2017 are supported - older versions of Visual Studio won't work.

Setting up Visual Studio

Once you have exported from Construct, you'll have a Visual Studio solution that you can open. Once you open it in Visual Studio you'll need to make a couple more changes for Xbox Live support to work.

First of all you need to install the Xbox Live package. Do this by right-clicking the project item in the Solution Explorer (which has the name of your project) and choosing Manage NuGet Packages... Switch to the 'Browse' tab and search for Xbox Live. Select the package named:

Microsoft.Xbox.Live.SDK.WinRT.UWP

This is the one that supports JavaScript in UWP apps. Install this package to your project. It may take a while as it downloads and installs the package.

Next, you need to associate the Visual Studio project with your app you created earlier on the Dashboard. To do this, right-click the project again and this time select Store -> Associate App with the Store... Follow the steps to link to the app from the Dashboard. You may need to sign in to your account to make sure it can list the apps you've created.

Finally, the Any CPU mode isn't supported for UWP apps using Xbox Live. So next to the green Run button, click the dropdown that says Any CPU and switch it to x64.

Test Xbox Live works

Now hit the green "Run" button (or press F5). Your game should start up. If Xbox Live is configured correctly, the Xbox Live plugin's Xbox Live is available condition should be true. Then if you click the sign in button in your game, a login prompt should appear. Remember to use the test account you created earlier, not your own account. You may need to choose a 'Switch account' option in the login dialog.

If you can sign in with the test account, everything has been set up correctly!

Unlock your full gamedev potential

Upgrade to the Personal Edition of Construct 2, it has way more features and won't holding back from making money and using your full creativity like the free edition does. It's a one off payment and all Construct 2 editor updates are free for life!

View deals

Plus, it's got a lot of additional features that will help you save time and make more impressive games!

Congratulations on finishing this tutorial!

Did you learn a lot from it? Share it now with your friends!

Share and Copy this Tutorial

You are free to copy, distribute, transmit and adapt this work with correct attribution. Click for more info.

Comments

0
DiVeR 1,547 rep

Awesome, thank you!

Tuesday, June 27, 2017 at 4:52:03 PM
0
andreyin 28.3k rep

Thanks for this!

Wednesday, June 28, 2017 at 10:09:39 PM
0
LaurenceBedford 9,829 rep

Thanks @Ashley

Saturday, July 01, 2017 at 3:53:44 PM
0
Bigibby01 2,727 rep

I tried in so many ways, the only way it worked is creating sprite to sign in, : >on touched object (the sprite i named signin): > xbox live>sign in = works, but on start of layout: xbox live > sign in = not working, on buton Y pressed >xbox live > sign in = not working, i'm using gamepad for my game,my question is: the only way XL works is to touch the sprite or i'm missing something,please somebody with who knows more answer,thanx.

Friday, July 07, 2017 at 8:45:51 AM
0
Bigibby01 2,727 rep
I tried in so many ways, the only way it worked is creating sprite to sign in, : >on touched object (the sprite i named signin): > xbox live>sign in = works, but on start of layout: xbox live > sign in = not working, on buton Y pressed >xbox live > sign in = not working, i'm using gamepad for my game,my question is: the only way XL works is to touch the sprite or i'm missing something,please somebody with who knows more answer,thanx.
quoted from Bigibby01

nevermind, SOLVED!!!

Friday, July 07, 2017 at 9:40:17 AM
0
Studio Mercato 3,500 rep

I can't sign in to my Xbox One in dev mode set to my game's Sandbox, I keep getting the error "Use an account with access to this sandbox". I'm using my test accounts that I added to the Sandbox.

Did everyone get their Sandboxes working? I can't even launch my game unless I'm signed in.

Monday, July 17, 2017 at 4:23:27 PM
0
Cryptwalker 13.1k rep

Works fine for me!

Thursday, September 21, 2017 at 7:46:47 AM
0
Studio Mercato 3,500 rep

Here's further documentation on the Xbox Live Plugin, including a list of expressions and their descriptions.

www.construct.net/make-games/manuals/construct-3/plugin-reference/xbox-live

Tuesday, October 10, 2017 at 1:31:03 AM
0
Studio Mercato 3,500 rep

@Ashley Many people are not understanding what you wrote here:
"In Construct 2, the exported Visual Studio solution by default uses the Windows 10 SDK version 10.0.10240.0. If you run your project and see an error, you may need to adjust the project settings to change the target SDK version to one you have installed."

You should specify in the tutorial how to do so, like I wrote here:
www.scirra.com/forum/xbox-one-uwp-performance_p1147037?#p1147037

Friday, December 08, 2017 at 8:55:32 AM

Leave a comment

Everyone is welcome to leave their thoughts! Register a new account or login.