Monogame, Xbox One, and the Creator's Program

There is a comparison list here:

https://developer.microsoft.com/en-us/games/xbox/xboxlive/creator

Scroll down a little…

Alternatively, you could create your own system using a custom ASP.NET app… but how that works on XBOX, I do not know… don’t EA and the lot use their own user services? or do they integrate XBLive members and cross reference everything or something?

Worth investigating…

EDIT

Found the below
https://developer.microsoft.com/en-us/games/xbox/docs/xboxlive

https://developer.microsoft.com/en-us/games/xbox/docs/xboxlive/using-xbox-live/auth/authentication-for-uwp-projects

I am assuming WinRT means C#… No idea…

Now, when it says…

Multiplayer Not supported for the Creator’s Program…

Does it disable certain network access? hmm…

I think I need an Xbox at some point… perhaps Project Scorpio…

It would be really great if this could be integrated with the built-in XNA namespaces (if I recall correctly there was this Guide class that could be used and worked at some point with the iOS Game Center - not sure if it is still there).

I found a solution. Microsoft has a C# version of the Xbox Live API. It works like the C++ version: https://github.com/Microsoft/xbox-live-api-csharp/

2 Likes

We should promote that repo.

2 Likes

How?

Ta ta daa da da dee dum… [Well had to add more text…]

Nice. Thanks for the link to the C# Xbox Live SDK. I’ll give that a shot.

In other news, my Xbox One arrived last night. I didn’t have a whole lot of time, but I was able to put it into Developer Mode and get my game deployed. As far as I can tell, it ran perfectly! So that feels like pretty good news. It’s not bad news, at least.

I still need to get myself familiar with the Xbox dev stuff. There’s a lot of settings for Portals and Sandboxes and test accounts and stuff that I don’t wholly understand. But I’m splashing around. :slight_smile:

1 Like

this github project is no longer available. Is there a replacement?

EDIT: ok, it seems to be nuget-based now.

Can you link the NuGet here?

In the nuget manager in VS, just type “xbox live” and the packages appear. EDIT: Creating an XboxLiveUser crashes though, so I don’t know how good my “solution” is :sweat_smile:

1 Like

The NuGet is Microsoft.Xbox.Live.SDK.WinRT.UWP

Open your MonoGame project in VS17 and do the following:
1/ Right click references
2/ Click Manage NuGet packages
3/ Click Browse
4/ Type Xbox in the search and choose Microsoft.Xbox.Live.SDK.WinRT.UWP, then click install
5/ Close the solution and open it again
6/ Click to expand References and click the Visual C++ reference with a yellow exclamation mark to clear it

To confirm this has worked type Using Microsoft.Xbox.Services; at the top of your project (better to type instead of paste so you can see if the autopredict can see the reference)

You will also need Microsoft.Xbox.Services.System

To pass certification at a minimum you will need to have a signed in user and display the gamer tag

Now that you have the Xbox library working you can declare the variable XboxLiveUser user;

Unfortunately this is as far as I managed to get

When I do user = new XBoxLiveUser(); in the initialize section I get a stack overflow error
When I put it in the game loop (using a Boolean to ensure it is called once) the game crashes out with no error

This website describes the process but in another language

Another tip is Unity comes with VS17 and it has the Xbox cs files (in C#) accessible. Follow this link

And then do the “Import plugin” step

Go to the Assets\Xbox Live\Scripts path of your project and you’ll see files written in C# for users, profiles, leaderboards etc…

Some of it is hard to read as it is unity language. Others require jumping from one file to another as you attempt to follow what is going on. It will take some time for somebody to reverse engineer this and adapt it to monogame. Particularly as simply calling a new XboxLiveUser() doesn’t seem to be working in three different spots I have tried

I hope I have given somebody a boost in the right direction but I really hope somebody can work this out and document it for the MonoGame community

I should be a simple step by step process that shows the minimum code required and where it needs to be implemented (just like the link I posted with the javascript version)

Thanks in advance

1 Like

actually I’m at the same point as you: crash creating the XBoxLiveUser. Will report if I find a solution.

There are some extra steps I’ve done. I’ve created a new app in the Windows Store devcenter and created a sandbox to test, activated it, and added xbox live accounts .
( it is very well explained in the first steps of this tutorial: here https://www.construct.net/es/tutorials/using-xbox-live-in-uwp-apps-3 . )

However I’m unable to log in with the test account in the XBox once I change the sandbox, so I can’t test the game in the new sandbox at all.

(my “theory” was that once the sandbox is created, the user creation would no longer crash, but I’m not sure of that because a function call should never fail like that, even if it hasn’t permisions to use XBox Live SDK)

1 Like

I think I found the solution for the user creation crash:

https://social.msdn.microsoft.com/Forums/en-US/1c89e4c2-d0d9-4b51-90f9-e45e98a9b325/new-xboxliveuser-weird-exception?forum=xboxlivedev

follow step 4 :

1 Like

Hi Adman1974. Congratulations on your accomplishment
I have added a config file to my game and it no longer crashes. Thank you both

Can you please provide a sample of code that you used to see if the user is signed in, and if not, display the panel so they can choose a user to sign in with

Thanks Adman1974

The status I am getting is UserInteractionRequired

I have noticed I cannot sign into my xboxone sandbox despite adding it as a test account and updating the settings by clicking the Test button

I have emailed Microsoft for ideas, then I will try again

I will keep you posted

Thanks again

1 Like

Why is Adman1974’s post flagged?

OK so I have tried a few different bits of code based on what has been kindly provided on this forum but I still cannot get the sign in to work. I have kept the following code very very simple to demonstrate the point it is breaking down

private async void GetUser()
{
SignInResult signInSilentlyTask;
SignInResult signInLoudlyTask;
user = new XboxLiveUser();
debug = “”;

        var dispatcher = Windows.ApplicationModel.Core.CoreApplication.MainView.CoreWindow.Dispatcher;
        signInSilentlyTask = await user.SignInSilentlyAsync(null);
        if (signInSilentlyTask.Status == SignInStatus.Success)
        {
            debug += "Worked ";
        }
        else
        {
            debug += signInSilentlyTask.Status.ToString();
        }
        if (signInSilentlyTask.Status == SignInStatus.UserInteractionRequired)
        {
            signInLoudlyTask = await user.SignInAsync(null); // **Error here**
            debug += signInLoudlyTask.Status.ToString();
        }
        debug += " exit";

}

When I try user.SignInAsync(null); or user.SignInAsync(dispatcher); I get an error
System.InvalidOperationException ‘Operation is not valid due to the current state of the object’

System.InvalidOperationException occurred
HResult=0x80131509
Message=Operation is not valid due to the current state of the object.
Source=
StackTrace:
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at System.Runtime.CompilerServices.TaskAwaiter`1.GetResult()
at CatStack.Game1.d__163.MoveNext() in C:\Users\xx\source\repos\CatStack\CatStack\Game1.cs:line 561

I have tried different combinations, null, dispatcher, two dispatcher objects, .CoreApplication.GetCurrentView() instead of .CoreApplication.MainView, try / catch statements. Nothing seems to work. I get the same error message

I am signed into my sandbox with a valid user. I can see my profile when I launch the game and press the XBox home button

But I cannot seem to be able to get the signed in user or force a sign in

Your help will be much appreciated

I think it could be a problem with the code running in a non-UI thread. Could you try this?

signInLoudlyTask = await user.SignInAsync(dispatcher);

1 Like

Hi KakCAT. Thanks for your reply

I had initially tried what you had posted before with no luck but I thought I would try again just to make sure

I discovered there was a subtle difference in the error message I was getting (I’m not sure why it didn’t appear yesterday):
The application requesting authentication tokens is either disabled or incorrectly configured

The solution was to right click the game --> Store --> Associate App with Store

I think the reason why I got this error is because I generated my config file from Unity so it has about 8 lines in it (instead of the 3 you sent to me) - including links to the ids I created. The reason I generated it from unity is because I wanted to look at the backend files while trying to work out how to get the sign in working

I am going to try working with a leaderboard now and then trying to get a game published (it is a simple game). If successful I will document a start to end process (along with mistakes I made along the way) and post it in a blog for use with this forum

Thanks to everyone for your help

Thanks for the followup! This is super confusing stuff, and the Internet Gods smile on those who fix their own problems and post their solutions for others to see!

I don’t want to be all “I told you so!”, but just for future coders… there are some hoops you need to jump through before your stuff starts working. And you’ll get weird esoteric errors if your app is not recognized by Microsoft.

Good luck with leaderboards! Please do document and share your problems and solutions!

1 year later I’ve found a proper way to discover the reasons why Xbox live DLL hard crashes without apparent reason.

If you set up your project properties -> Debug to debugger type Mixed (Managed and Native) you get a very descriptive error in the Debug Output when the crash happens. For some reason that message does not appear without native debugging.

So finally I found a bug (only happenning when debugging) of my game randomly crashing: It was a Xbox Live throttling message.

I know it’s an old thread, but it will surely help somebody if he’s running into the hard crashes ( C# coders sure are not used to get those :slight_smile: )