16
\$\begingroup\$

I have a good grasp in C++ and C and have also experience developing AAA game using C++. Now, I'm shamelessly thinking to dive into mobile game development either in iOS or Android. Unfortunately, I don't know objective-C and java and neither have courage to learn it. So, As above mentioned reason, Is there any possibility to do mobile development in C++ without using any single statement of JAVA and Objective-C ?

\$\endgroup\$
0

6 Answers 6

13
\$\begingroup\$

Some objective C has to be written for iPhone apps. That being said, you can write a pretty thin layer of obj-c and then do all you game code in C or C++.

On android look up the NDK. I don't have any experience with it, but it promises to be a native sdk so you should be able to write most things in C or C++.

That being said, you're artificially limiting yourself with the language barrier. On iOS, if you want to do anything with the OS layer (like GameCenter, their social platform), or use any kind of middleware, you'd probably be faced with an objective C API.

I can kind of understand the sentiment. C++ in particular is a huge language. But obj-c isn't a big. It's a bolt on to C (so the fundamentals should be familiar) with a few extra things added on top. It isn't nearly as complex or deep as C++.

\$\endgroup\$
5
  • 2
    \$\begingroup\$ Please keep in mind that using Android NDK means to leave the advantages of "write once deploy everywhere" since you have to compile your code for multiple platforms perhaps incurring in multiple build problems. NDK is meant to be used to call C function from java code, not to write whole application (while it is still possible). \$\endgroup\$
    – FxIII
    Commented Aug 8, 2011 at 7:44
  • 1
    \$\begingroup\$ I also think Google have explicitly stated that NDK is not to be used for a full game implementation. Besides, the java syntax is nearly identical to C++ and should take a few days to get the hang of. If you want to make money you should probably focus on iOS games though. \$\endgroup\$
    – Nailer
    Commented Aug 8, 2011 at 8:09
  • \$\begingroup\$ What do you say about Unity3D, if i learn C# \$\endgroup\$
    – James Bern
    Commented Aug 8, 2011 at 8:46
  • 1
    \$\begingroup\$ Starting with Android 2.3, Google added native activity which lets you write a full app in 100% c++ (mainly for games). \$\endgroup\$
    – 5ound
    Commented Aug 8, 2011 at 14:08
  • \$\begingroup\$ I would recommend Unity3D, especially if you want to deploy to multiple platforms. C# isn't that difficult to learn if you already know C++, and their forum content is top notch with tons of sample code (although most code is in JavaScript). \$\endgroup\$ Commented Aug 8, 2011 at 23:58
7
\$\begingroup\$

I've been writing a game for quite a while in c++ for Android. I have to touch the java code once every few weeks, but for the most part I modified one of the sample apps that comes with the NDK and have written c++ otherwise. I've had to do a bit of JNI work as well, which is never fun. However, I have many years of java experience, so having to write java or JNI doesn't particularly slow me down.

My game runs just as well on my linux box as it does on my test devices. The linux version is pure C++ and the trouble I went through to make this work pays for itself every time I make an iterative change to my game.

My project has 836 lines of java code, 331 lines of hideous jni C code and about 40k lines of C++ code.

\$\endgroup\$
2
  • \$\begingroup\$ Do you use a build system that can build for each target in an automated fashion? I've been using CMake for allowing cross-platform builds, and was wondering if I could integrate it with ndk-build. \$\endgroup\$ Commented Aug 11, 2011 at 7:05
  • \$\begingroup\$ I've seen other NDK projects use CMake. \$\endgroup\$
    – notlesh
    Commented Sep 29, 2012 at 16:39
4
\$\begingroup\$

There is also Marmalade which allows you to use c++ to create mobile applications for a broad range of devices such as iPhone, Android, Win Mobile, Bada, and some more.

\$\endgroup\$
2
\$\begingroup\$

I'm using cocos2d-x for a while, it's a game engine based on c++. (it actually a c++ port of cocos2d-iphone). using this engine you can easily run and test your codes on windows and then compile the same code for iphone/android export.

\$\endgroup\$
1
  • \$\begingroup\$ also now includes bada and some people have used it on top of Marmalade \$\endgroup\$
    – Andy Dent
    Commented Jan 13, 2012 at 7:09
1
\$\begingroup\$

If you really want just C++, Marmalade might be good for you

But for full capabilities you have to use at least some objective-C (or java, but i'm talking about "full capabilities"). But with a thin layer of objective-C you could do so much, so I reccomend you look in to iOS development with Xcode.


If you have a mac look at Xcode, if not, try corona with lua instead.

There are many ways to max your C++ code to be run on the iPhone. A free program on the mac app store could help increase C++ use in Objective-C based products:

It's called objective-C++ Preprocessor Headers

This allows you to do even more with C++ rather than Objective-C.

iOS programming:

\$\endgroup\$
-3
\$\begingroup\$

Yes, you can use C++ programing language to develop mobile games. C++ gaming application always feel a little snappier than Java on the same hardware. So, if you are expert in C++ and interested to develop Android game then it is now easy and zero-cost as programing in Java.

\$\endgroup\$

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .