We are working on porting a game that was originally developed for the Objective-C version of Cocos2d to Cocos2d-x and we plan to release it for Xbox One as a Windows Universal Platform (UWP) app. Our game concept has been approved by Microsoft under the ID@Xbox Program, which permits the use of a few additional Xbox Live features than are available under the Xbox One Creators Program.
I have spent the better part of the last two weeks investigating environment, build, configuration, and feature support that is available when using Cocos2d-x for UWP apps which I'll share below, since I believe this is helpful for other developers with the same objective of using Cocos2d-x to power their UWP apps/games.
UWP apps are sometimes referred to in Microsoft's documentation and elsewhere as Windows Store apps or Windows RT apps.
Looking for Advice/Help
First of all, I am looking for advice/help from existing developers who have commercially released a Windows 10 or Xbox One UWP app to understand if these apps have passed Microsoft's certification testing and if there are any additional issues or considerations they encountered that I haven't covered below.
Cocos2d-x Project and Build Environment
First of all, you should theoreticaly be able to use Visual Studio 2015 for all your development work, but this did not work for me. I discovered that deploying a Cocos2d-x UWP app to Windows 10 locally worked fine, but this version of Visual Studio would stop responding when deploying to the Xbox One.
The only configuration which worked (for me) was to first install Visual Studio 2015, then install Visual Studio 2017, open the proj.win10 cocos command-line generated sample app with VS 2017, retarget the solution for Windows SDK 10.0.14393, and keep the Platform Toolset as v140. Upgrading the Platform Toolset to v141 resulted in build errors.
It's important to note that you must set the Solution Platform to x64 (64-bit architecture) as 32-bit builds (designated as win32 or x86, depending on the project configuration) are no longer accepted for UWP app submissions. Source: https://docs.microsoft.com/en-us/windows/uwp/xbox-apps/frequently-asked-questions
Xbox One Controller Support
I spent a fair amount of time investigating how to add controller support for UWP games using Cocos2d-x. There are a number of options, but for 64-bit UWP builds, the following solutions I came across have their own particular issues. This may not be a complete list, it simply represents those I attempted to use:
GLFW - No plans to support UWP apps. https://github.com/glfw/glfw/issues/942. Also no gamepad rumble support, although it's on the feature roadmap.
Gainput - Currently no support for UWP apps. https://github.com/jkuhlmann/gainput/issues/34
SDL2 - There is some UWP/WinRT support, I believe worked on by David Ludwig. https://discourse.libsdl.org/t/sdl2-build-windows-store-app-for-windows-8-x-10/21902
I opted instead for implementing custom controller code that uses the UWP APIs directly. A great place to start for those who want to get up and running quickly is: https://docs.microsoft.com/en-us/windows/uwp/gaming/gamepad-and-vibration.
For a working example, check out the GamepadUWP solution within the https://github.com/Microsoft/Xbox-ATG-Samples repository.
Xbox Live Integration
The best place to start for working examples on integrating Xbox Live support into your Cocos2d-x UWP game are the Xbox Live Samples: https://github.com/Microsoft/xbox-live-samples. The samples have all been recently updated to work with Visual Studio 2017, credit to Jason Sandlin for that.
Be careful with some of the other samples out there, even those referenced in Microsoft's official UWP documentation, as I've found some that don't deploy and work with the Xbox One properly. For example: https://github.com/Microsoft/Windows-appsample-marble-maze/issues/3
Durango (Xbox One XDK) SDK Support
Please note that the Xbox One XDK SDK, which is available to licensed AAA and Independent Xbox One developers, is not compatible with Cocos2d-x as it does not support OpenGL or OpenGL ES.
On the contrary, UWP (Windows Store) apps support OpenGL ES through the ANGLE project (https://github.com/Microsoft/angle) which Cocos2d-x already uses for API translations to DirectX.
UWP apps and games for Xbox One are not provided the full system resources that are available to games built directly for DirectX 12 using the Durango (XDK) SDK. This is an important consideration when evaluating the minimum performance requirements for your game.
UWP apps for Xbox One share resources with the system and other apps. The relevant details can be found here: https://docs.microsoft.com/en-us/windows/uwp/xbox-apps/system-resource-allocation
Most of samples located at https://github.com/Microsoft/Windows-universal-samples should also work with Cocos2d-x x64 UWP games/apps, with a full disclaimer that I haven't tried them all.
As discussed earlier, another great resource for Xbox One samples is: https://github.com/Microsoft/Xbox-ATG-Samples
I'd love to hear comments from other developers who found this useful (or not) and also please let me know if I've made any errors, omissions, or misstated any facts.