Getting started with Cocos2d-x game development on Windows 10

Getting started with Cocos2d-x game development on Windows 10

Cocos2d-x is an open source game engine, licensed under MIT license, that allows developers to develop cross-platform games using C++ (or even JavaScript). iOS, Android, Desktop... no problem! However, for Windows Phone and Windows 8, and now Windows 10, Microsoft Open Technologies jumped in and contributed to the project to help making Cocos2d-x available on those new Windows platforms. Really big names use Cocos2d-x (like Zynga, Konami, Glu, Gamevil...) but also a bunch of indie game developers who are doing a great job at filling iOS and Android Stores with interesting games. So, this move by Microsoft Open Technologies (MS Open Tech) that happened back in 2013 was really great and was a win-win-win step that helps Cocos2d-x get a bigger reach, developers to more easily port their games to Microsoft platforms, and Microsoft to get those popular games available in its Store(s).

MS Open Tech loves Cocos2d-x (and vice versa!)

Note that that everything here is written using Windows 10 Technical Preview build 10122 and Technical Preview Tools, so things can change.

So, what does it take to get started developing a Windows 10 game using Cocos2d-x game these days? Again, thanks to MS Open Tech, this is really simple, just follow the steps in this post.

Get the code from GitHub

MS Open Tech has a Cocos2d-x fork on GitHub, at github.com/MSOpenTech/cocos2d-x. More importantly, there is a branch called v3.6-uap, and that's the one you need to use on Windows 10. (should it be called v3.6-uwp now? :) )

Now, the way you're going to fetch it is completely up to you, but the preferred way is of course to use git. Clone the repo and do:

git checkout v3.6-uap  
git submodule update –init  

Repo uses a submodule with plugins, with plugins to provide an easy way for developers to integrate various third party SDKs across different platforms (think Ads, Analytics, IAP & Social).

Use Python to set your environment

Cocos2d-x uses a Python script to download dependencies and another one to install environment variables needed so you'll need Python to execute those.

Do this only if you understand and accept the risks of executing a script downloaded from GitHub that you didn't write yourself.

Installing and using Python 2.7.9

Recommended version seems to be 2.7.9 and you can get it from python.org. Then you can do:

python download-deps.py  
python setup.py  

You will be asked about Android SDK during this. You can press Enter whenever prompted about Android related questions to skip those (no need to configure Android SDK).

Create you first Cocos2d-x game

Restart console and type something like this to create a new project.

cocos new myProject –p com.mycompany.myProject –l cpp –d myDirectory  

You'll get a folder called myProject inside myDirectory, with structure like this. You're of course interested in Windows 10 project.

Cocos2d-x projects

Open proj.win10 and you'll find the Visual Studio solution there!

Verify that everything runs OK

Build and run your first Cocos2d-x game on Windows 10!

Cocos2d-x game on Windows 10

Create a great game

Ha! You'll have to work hard to build a great, successful game, but with Cocos2d-x and C++ you can reach so many customers that it almost sounds crazy when you think about the device numbers. Android, iOS, Windows 10...!

Want to start now? Have you heard of Game Jam events?

Game Jam - worldwide hackathon

Microsoft is organizing worldwide Windows 10 Game Jam events! Find an event nearby and join other Windows 10 and #gamedev enthusiasts! More info on gamejam10.com

Join students from your area in an all-day game jam that kicks off with insight and instructions from Microsoft gaming experts. Learn from professional devs about how the Windows 10 Universal App Platform unifies gaming across PCs, phones, and Xbox One. Find out how your next game project can support multiplayer gaming across devices, tap into an amazing gaming community, and take advantage of the latest game engines and frameworks from Unity, Monogame, and Cocos.

Conclusion

Using Cocos2d-x is a great way to build a multiplatform game and reach a large number of customers with one, C++ codebase. Universal Windows Platform is also supported, so you can be ready with your game as soon as the Store starts accepting submissions and Windows 10 is released.

If you know of any good open source games using Cocos2d-x, leave a comment. And don't forget to share this blog post if you found it useful. Thanks!

Igor Ralic

igor ralic

View Comments
Microsoft Certified Solutions Developer: Windows Store Apps in C#