Hello! I am learning C++ and was curious if I could write iOS and Android games with the language. I heard that in Visual Studio 2015 it would allow for mobile game development with C++. If this is true what else would I need? Would I just need the Android NDK for Android or something else? What is my cheapest option if this is even possible? Would I need something other than Visual Studio? Thank you for your time! ![]()
Can you write mobile games in C++?
Yes. Here is a game framework called [Cocos2d-x](http://cocos2d-x.org/). You can write your game in c++ with it, then complies your game into iOS or Android app;
Yes. Here is a game framework called [Cocos2d-x](http://cocos2d-x.org/). You can write your game in c++ with it, then complies your game into iOS or Android app;
Thanks for the response! I will definitely check that out. Can you write the game entirely in C++ or does it require some Java/Objective-C?
There are just so many different phones to support it gets a pain really fast just for a single developer and expensive for studios and teams.
Just have a look at the game "Eye Guy" in Google Play Store, the maker wrote an article here on GameDev.net (right now on the front page).
Apple doesn't has this problem.
To summarize: Yes you can use C++ (Of course!)
Thank you all for your responses! I will definitely check out Cocos2d. If anyone else knows of a different better tool please let me know!
Yes but I wouldn't advice people to program with C++ on Android if you plan to publish this.
There are just so many different phones to support it gets a pain really fast just for a single developer and expensive for studios and teams.
Just have a look at the game "Eye Guy" in Google Play Store, the maker wrote an article here on GameDev.net (right now on the front page).
Apple doesn't has this problem.
To summarize: Yes you can use C++ (Of course!)
What difference does it make what language he writes it in? You STILL have to use different tools for each platform. And what "problem" is it that android has that iPhone doesn't?
If a developer is comfortable using C++ and can get familiar using the NDK then C++ is totally fine, infact its preferable in certain OpenGL situations. I've also noticed a number of C++ cropping up for Android including a version of Qt for it. I my self use Android and have written one app for it using the "native" google java sdk. Love Android, but I really hate that google sdk/eclipse packge, that is the single more wonky lump of software I've ever had the displeasure of working with. Would much prefer a tighter one, and noticed several possibilities since I wrote that one app.
What difference does it make what language he writes it in? You STILL have to use different tools for each platform. And what "problem" is it that android has that iPhone doesn't?
At least to get to the point of running at all, it makes all the difference. You have 1 basic model of iPhone (different storage capacities though) through most of the life of iOS devices -- and a couple different models/product lines in recent years. But all of a given vintage have roughly the same hardware. On android, you have hundreds of different OEMs each with several models of handhelds, tablets, and some set-top-boxes thrown in for good measure. Specs are all over the place, and there's at least three major instruction sets in active use (arm, x86, mips), each with several different generational/vendor implementations.
If you're going to optimize, then you have to start treating all the iOS devices as the distinct targets that they are, but just to get up and running they're (almost) effectively one platform -- even with the dozen or so relevent iDevices, that's still worlds better than the ~hundred relevant android ones.
With Android you get the choice of having full debugger support, but you have to use Java, or you can use C++, but with virtually no debugging support.
It’s basically like a guy giving you 2 choices: A: he knees you in the groin or B: you groin him in the knee.
L. Spiro
Using the Android NDK seems a bit "off". Not sure how to really explain it. It might just be all the hoops you have to jump through to get a C++ app up and running on Android. Not to say you can't or shouldn't use C++ if you so choose to do so but using Java for Android is much easier in my opinion (you don't have to use the absolutely insane factory/abstraction stuff you see in commercial Java development) . For iOS it isn't such a big deal since you can just do Obj-C++ and let Xcode do everything for you.
If you are planning on doing anything like ads, game center tracking, etc you will have to write Obj-C/Java. System stuff will still need to be done with the target language.
I'm the same way and prefer using C++ for mobile. This is my perspective on it: In iOS, you can use C++ with Obj-C. You can either create .cpp files or .mm files (Obj-C++). A basic understanding of Obj-C will get your program up and running (the groundwork), and then you can almost program the rest in C++. You can mix .cpp files with .mm. Likewise, in C, you can mix it with .m files. To get the full power of developing in iOS, it is recommended to learn their archetecture, native language, and APIs. Otherwise, you may be limiting yourself depending on what you use, and the third-party tools may take longer to update to Apple's current version. At the end, it depends on what your design documentation requires.
Edit: If it's worth anything, I hated the idea of learning Obj-C, and then I realized how easy it was to learn with my prior C and C++ experience. It took me about a weekend with a book for syntax. So you're literally just quickly scanning pages after the first few 40+ pages.
Just in case the OP is still interested: http://www.learnopengles.com/developing-a-simple-game-of-air-hockey-using-c-and-opengl-es-2-for-android-ios-and-the-web/
This is where I first got started learning to dev for Android. It shows you how to setup the NDK and how to get Java to communicate with C/C++. As a bonus, it shows you how to write a cross platform game (iOS, Android, and WebGL) from scratch. I really recommend this if you are a newbie.
Also, the only mobile devices I can think of that allow you to write your app in pure C/C++ are Windows Phone and Blackberry.
Shogun.
Not to mention that Android’s NDK’s (which you must use if you use C++) debugging tools are severely lacking.With Android you get the choice of having full debugger support, but you have to use Java, or you can use C++, but with virtually no debugging support.It’s basically like a guy giving you 2 choices: A: he knees you in the groin or B: you groin him in the knee.L. Spiro
This is not true, you can use ADT and to 'visually' debug in Eclipse. It works fine.
http://developer.android.com/tools/debugging/debugging-projects.htmlThis is not true, you can use ADT and to 'visually' debug in Eclipse. It works fine.
I see no mention of C++ there.
L. Spiro
There is a version of gdb distributed with the NDK. You can launch it with "ndk-gdb" in your project dir.
It actually does work sometimes... (Unless your device happens to run a version of Android where they broke the support... Or it just refuses to work for some other arcane reason...)
I try to stay away from Eclipse and ADT as much as I can, that piece of software makes me nervous. (Love how they have added a "run garbage collector"-button in later versions... )
You can do pretty much everything you need with the command line though, which is nice.
I've set up a few scripts so I can do most of my C++ dev for Android in XCode.
Btw, love the knee-groin analogy, couldn't agree more :)
http://developer.android.com/tools/debugging/debugging-projects.htmlI see no mention of C++ there.L. SpiroThis is not true, you can use ADT and to 'visually' debug in Eclipse. It works fine.
Not sure what to tell you here, other than that it works. It uses the gdb version shipped with the NDK toolchain, and integrates with the Eclipse C++ view.
See http://tools.android.com/recent/usingthendkplugin and http://stackoverflow.com/questions/17705109/how-to-debug-c-c-code-ndk-in-eclipse
I guess you are unable to find more recent docs as ADT is being deprecated in favour of Android Studio.
From my experience at tri-Ace, there are no Android NDK (C++) debuggers that work on all devices, only for a limited set of them.Not sure what to tell you here, other than that it works.
And according to the 2nd link you posted, you have to use quite a retarded hack to get breakpoints to work, assuming the device is supported in the first place.
L. Spiro
From my experience at tri-Ace, there are no Android NDK (C++) debuggers that work on all devices, only for a limited set of them.And according to the 2nd link you posted, you have to use quite a retarded hack to get breakpoints to work, assuming the device is supported in the first place.L. SpiroNot sure what to tell you here, other than that it works.
At work I have personally debugged a large C++ library on ten or so devices, mostly Asus, Samsung, Sony, LG and Motorola, without issue. I an aware that other engineers have debugged on other devices, including from smaller international Android handset manufacturers.
We have a compatibility spreadsheet which indicates successful testing of both our library and development environment on 60 or so devices. All of these devices are Gingerbread or above; possibly prior to this support was less mature.
I am sympathetic to you scepticism but in reality I've found support for debugging effectively ubiquitous.
As for the "retarded hack", it is true that gdb takes a few seconds to attach. If debugging some user controlled event this is not an issue. If debugging application startup it is sometimes necessary to include an artificial delay (i.e., sleep(5) or similar). Not too onerous but yes, somewhat irritating.
Hello! I am learning C++ and was curious if I could write iOS and Android games with the language. I heard that in Visual Studio 2015 it would allow for mobile game development with C++. If this is true what else would I need? Would I just need the Android NDK for Android or something else? What is my cheapest option if this is even possible? Would I need something other than Visual Studio? Thank you for your time!
I think I saw an announcement from Microsoft that they will make (or already made) the full version of Visual Studio 2013 free for mobile development. If thats what you ment by "cheapest option". But I think the 2015 version Express is also good for mobile. I made one or 2 apps for the Windows Phone with that setup.
Cocos2d-x is one of the most popular for cross platform.
Topic Locked
This topic has been locked by a moderator. New replies are not allowed.