Cocos2d-x and XBOX One

I do believe @stevetranby and @Rusty are doing this have have written extensively about it in other threads.

Major Update: The Xbox Creators Program is now live!

Through the Creators Program, you can now develop and release a cocos2d-x game for Xbox One. Previously you had to go through ID@Xbox, but this new program allows pretty much anyone to develop and release using retail hardware. From Microsoftā€™s site:

ā€œThe Xbox Live Creators Program allows developers to quickly and directly publish their games to Xbox One and Windows 10, with a simplified certification process and no concept approval required.ā€

Iā€™ve purchased and played a handful of games released with this program on my Xbox. Theyā€™re listed on the Xbox store under a new Creators Collection section. There seems to be about two dozen games so far.

Technical Update

All UWP games must now be 64-bit. Currently Iā€™m running Cocos2d-x 3.13.1 without issue. So make sure your projects are set to x64 when building and deploying.

More Info

Creators Program main page

Developer program overview

UPW on Xbox One

Personal

Iā€™m working on a release for this right now. My new project is performing great on the hardware. Currently Iā€™m trying to get the Xbox Live leaderboards working.

4 Likes

This is awesome @Rusty.

Is there anything special about getting started? Meaning can you talk about getting a cocos2d-x app running on the console for first timers?

There are a few requirements, nothing major though.

  1. Sign up as a Windows developer. One-time fee.
    Individuals - $19 USD
    Companies - $99 USD

  2. Get a retail Xbox One. Any kind will work.
    $250 for an Xbox One S on Amazon.

  3. Windows 10 PC

  4. Install Microsoft Visual Studio 2015 w/ Update 3
    Community version should work

After that, follow this setup guide: Getting Started with Xbox One.

Itā€™ll walk you through installing the required SDKs, setting up the Xbox in developer mode, pairing visual studio with the xbox, etc.

Once you have a project deployed on the Xbox, getting a cocos2d-x project running should be pretty simple. Youā€™re basically repeating the steps in the setup guide, but in a Cocos2d-x project.

  1. Create a Cocos2d-x project.
  2. Open the created Windows 10 solution.
  3. Change the build to x64.
  4. In project properties go to the Debugging tab, select Remote Machine in the Debugger to open the drop-down list.
  5. Type the IP address or hostname of the console into the Machine Name field.
  6. Select Universal (Unencrypted Protocol) in the Authentication Type field.
  7. Build and run
2 Likes

Update: Iā€™ve now submitted my first game for UWP certification on Xbox. Expected turn around time is 3 days. :crossed_fingers:

Like with my other games, I used SDL2 for the game controller logic. Everything else is Cocos2d-x including the audio engine. I used the SimpleAudioEngine, which worked pretty well. Although I was disappointed to find SimpleAudioEngine for UWP didnā€™t support panning.

NOTE: Even if this game passes cert on the first try, Iā€™m not sure Iā€™ll release it this month. Working on a simultaneous release with other platforms.

Interesting about your use of SDL. Makes sense. Their controller support is good. Do you do some kind of minimal SDL compile to just include controller support? That way you donā€™t have the weight of the entire engine in your builds?

SDL2 is a very modular system. You can initialize just the sub-systems you want. For this project I just initialize JOYSTICK, GAMECONTROLLER, and HAPTIC. This way itā€™s quite light-weight.

SDL_SetMainReady();
if (SDL_Init(SDL_INIT_JOYSTICK | SDL_INIT_GAMECONTROLLER | SDL_INIT_HAPTIC) != 0) {
    log("SDL_Init error");
    log("Could not initialize SDL: %s.", SDL_GetError());
    return;
} else {
    log("SDL_Init success");
}

Iā€™m very comfortable with using SDL2 in conjunction with cocos2d-x, so it was any easy way to go for me. If Cocos2d-x support controllers for UWP apps, Iā€™m sure that would be easier for others.

Wow. Thanks. The way they do it seems straightforward.

Rusty,

Could you paste sample code how to connect SDL controller code with cocos2d-x?

Regards,
CHP

My SDL2 controller code isnā€™t wired into cocos2d-x, just my game code.

If youā€™re interested in learning about SDL2, this is the tutorial I used.

However, it might be easier to just patch Cocos2d-x to add controller support. EventController already supports mobile and desktop I think? /cc @slackmoehrle

I think 3.16 brings more controller support.

Edit: maybe I am wrong I donā€™t see mention of it in release notes. I thought that I read that controller support had added platforms besides iOS and Android.

I see this commit the 3.16 branch adding code for a game controller test for win32.

EDIT: Also I see that Win32 and Linux support was merged in here.

glfw use of controller was pretty straight forward as well

Update: Failed my first pass at certification. There arenā€™t many requirements I think for UWP cert, but Microsoft requires any game on Xbox to sign in and use Xbox Live. You donā€™t have to use the services like leaderboards, but you have to sign in.

My particular issue was that I didnā€™t block gameplay until the user had sign in. Pretty easy to fix and resubmit.

Hereā€™s the report on the failure I got. Helpful for anyone else looking to ship on Xbox:

===========================

App Policies: 10.13.5 Xbox Live Active User and Gamertag

Because your game uses Xbox Live, it must:
Ā· Create at least one active user and sign the user into Xbox.
Ā· Display the userā€™s Xbox gamertag as the primary display and profile name.
Please add this behavior and resubmit your game.

Steps to Reproduce:

  1. Launch the app.
  2. Notice that the gameplay should be blocked until signing the user into Xbox Live services. However, your app is still playable by cancelling/skipping Xbox Live login.

You can view the Xbox Live documentation for more information. Your game may not appear in the Creators Collection until this has been resolved.
Tested Devices: Windows 10 Xbox

passsed cert

Update: Passed certification!

Still planning on launching this game sometime next month when the other platforms are ready.

Something surprising and quite nice: the Xbox Live SDK is now open source. I found their leaderboards example in the samples useful too.

2 Likes

@rusty congrats!! Maybe it is time for me to buy an Xbox one!

Hi,

Thank you.
Do you have any experience with Kinect?
What is preferred way to connect cocos2d-x, Xbox and Kinect?

Regards,
CHP

Microsoft announced yesterday that theyā€™re significantly increasing the resources available on Xbox for UWP games in the fall update.

  • 6 CPU cores - up from 4
  • 5GB of RAM - up from 1GB
  • Full GPU Access - up from 45%

The announcement also states the full GPU access is for DirectX 12 games. Iā€™m not sure if there will be an increase for DirectX 11. Cocos2d-x uses ANGLE to convert itā€™s OpenGL ES calls into DirectX 11, so Iā€™m not sure if the GPU improvement will affect Cocos2d-x games.

For me, the most significant change will be the increase to RAM.

@slackmoehrle Thank you! Looking forward to sharing the game soon.

@CrazyHappyGame According to this list of not supported features on Xbox, only some of the Kinect works.

Xbox Universal Windows Apps donā€™t support skeletal tracking. Xbox provides support for using the infrared, depth, and color feeds from Kinect.

2 Likes

This is good news any way you slice it!

Ok, first Xbox One game released! Train Bandit is now live on Xbox One. I made a new thread for it here.

2 Likes