views:

236

answers:

6

Is it best to program a game for the iPhone in Objective C or in C++.
What language would a game like Flight Control be written in?
What format should graphics be in to show properly and load quickly on the iPhone?

+2  A: 

You will need to make your top level views and operating system interface in either Objective C or Objective C++. There is no way of calling the top level Apple APIs without it.

Once you get to the game logic, you can do most of your work in C if you wish to use Core Graphics or OpenGL.

Yann Ramin
+5  A: 

Games like Flight Control are usually written in Objective-C with some C calls to OpenGL and other C APIs. The graphics can be stored in PNG or JPEG. I would stay out of C++ unless I had to use some C++ code or had developers with good C++ knowledge. According to my experience the bottleneck is seldom in the language, so that you haven’t much to gain by switching to C++.

zoul
Not to mention that you'll find far more sample code for the iPhone (like all of Apple's) written in Objective-C than any other language.
Brad Larson
+3  A: 
Marcelo Cantos
Interesting point about the memory management. I feel exactly the opposite way :) I found reference counting to be very convenient and safe, I like it very much and it’s quite rare for me to create a leak because everything seems so simple.
zoul
@zoul: maybe it's just my lack of experience with Objective-C, but I find myself continually having to track down leaks, and invariably discovering that I've forgotten to release something, or retained it when I shouldn't have, or finding that an NSString got cleaned up before I expected it to (even after reading up on the ownership/lifecycle rules).
Marcelo Cantos
A: 

You can now speed your development by using a language that doesn't require you as a developer to manage your memory manually and worry about leaks, that language is namely C#. The advent of MonoTouch is the magic that makes this possible but even before MonoTouch I've heard the Unity framework was used for several iPhone games with success.

Ok, to be less of a "commercial" (tough crowd...)

Using C# will allow you to relatively easily port your game to other mobile platforms (like the Droid) without a rewrite of the code. Objective C is hardly a language accepted widely beyond the Apple community. The AppStore is still growing thanks to iPhone4 and the iPad but the Android is nothing to sneeze at and there are other mobile devices to consider beyond the big two...

See this related answer regarding support for the Android.

Bottom line is larger audience = more revenue for you when writing the same code. My apologies if you were looking for a selection of either Objective C or C++ without bringing another option to light...

Tahbaza
This seems like a commercial.
BobbyShaftoe
Arguably Objective-C also provides automatic memory management. This seems a little like a plug for C# without much backing as to why it is a better way to write code for the iPhone.
Jon L
Though MonoTouch is quite nice, I think the person that asked the question would like to stay with the Apple stack to some degree.
icktoofay
There is currently a controversy with the Apple iPhone developer agreement requiring that apps must be originally written in C, C++ or Objective-C. Both Unity and MonoTouch are currently in hot waters as to whether apps developed by these products will be accepted by Apple or would be banned in the future. So far, RunRev, a similar product, has gotten a official response from Jobs banning them outright. Unity and MonoTouch has not received a response from Apple so far, but they believe that they are okay.
5ound
A: 

I appreciate everybody's quick response and expertise.

I am in the process of learning either C++ or Objective C and it looks as though Objective C is more direct to the iPhone.

My background is "gasp" COBOL85 (among other arcane languages). I would rather have someone already fluent in iPhone apps code the game, but I would guess the development costs would make that a little prohibitive. I do have a request for bid prepared, with "pseudocode", if someone out there would like to see it and give a quote. Meanwhile, there doesn't seem to be an advantage to C++ Ken [email protected]

Ken
Well there is one advantage to C++. It's more cross platform. If you are planning to develop your game for things other than iPhone, you need to use Objective-C only for the UI code.
JeremyP
+1  A: 

You may also look at chipmunk (C) or Box2D (C++):

Should I go chipmunk or Box2D?

http://www.cocos2d-iphone.org/forum/topic/6841

turingo