Can you write mobile games in C++?

Started by
17 comments, last by Crichton333 9 years, 1 month ago

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.

Advertisement

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.

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.html
I see no mention of C++ there.


L. Spiro

I restore Nintendo 64 video-game OST’s into HD! https://www.youtube.com/channel/UCCtX_wedtZ5BoyQBXEhnVZw/playlists?view=1&sort=lad&flow=grid

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 :)

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.htmlI see no mention of C++ there.L. Spiro

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.

Not sure what to tell you here, other than that it works.

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. Spiro

I restore Nintendo 64 video-game OST’s into HD! https://www.youtube.com/channel/UCCtX_wedtZ5BoyQBXEhnVZw/playlists?view=1&sort=lad&flow=grid

Not sure what to tell you here, other than that it works.

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. Spiro

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! smile.png


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.
"Smoke me a kipper i'll be back for breakfast." -- iOS: Science Fiction Quiz

This topic is closed to new replies.

Advertisement