★ TouchArcade needs your help. Click here to support us on Patreon.

c++ vs objective-c

05-27-2009, 06:26 PM
#1
Joined: May 2009
Posts: 41
c++ vs objective-c

hi

so im a games software engineering student, coming to the end of my 2nd year, just invested in an imac, this summer ill be making some games for the iphone/touch.

ive been taught c++ and OO, something which i can use very effectively. after looking into how exactly to develop for the itouch/phone, it seems cocoa API requires objective-c. ive looked into it and apparently objective-c is a superset of c, which means any c language (eg c++) will compile, so in theory i could continue using c++ which would be awesome.

however, my question is would i be missing out on some clever library classes and functions if i carried on with c++, or would it otherwise be foolish? should i just bite the bullet and learn the objective-c bits?
05-27-2009, 06:35 PM
#2
*most* of our code base is in c++ and it works fine on the iPhone, the only code we have in obj c is anything using the iphone api, ie playing sounds, file locations and such, but then we just call those functions from c++. You do gotta learn some obj c, but if you already know c++ and are comfortable with it most of your code can stay there.

05-27-2009, 06:56 PM
#3
Joined: Jan 2009
Posts: 1,099
can someone help me find a way to learn code easily

Current faves:UniWar,Glyder, Assasin's Creed, Wolfenstein,Zenonia(beta testing)
☻/ my review site:cheatcodes4chicos
/▌reviewer at: appmania
/ \ There you go rocketman I've moved on from hobocity
05-27-2009, 07:19 PM
#4
Joined: May 2009
Posts: 41
Quote:
Originally Posted by jonaswills View Post
*most* of our code base is in c++ and it works fine on the iPhone, the only code we have in obj c is anything using the iphone api, ie playing sounds, file locations and such, but then we just call those functions from c++. You do gotta learn some obj c, but if you already know c++ and are comfortable with it most of your code can stay there.
thought that may be the case, id imagine there are classes in the sdk that take care of model/picture/asset loading. ill do a search for a spinning cube program and see how it deals with it all.

Quote:
Originally Posted by inferi22 View Post
can someone help me find a way to learn code easily
not sure there is an easy way, first you have the basic c language programming concepts, then dynamic memory and loading of files, object orientation, code optimisation, debugging, API's, maths, libraries. and thats before you get to 3d with your cameras and frustrums, lighting, vertices, textures, polygon collisions etc.

if there were a c++ tutorial section of this site i would happily contribute.
05-27-2009, 11:36 PM
#5
Joined: Nov 2008
Posts: 128
if you plan to write apps using coreanimation, coregraphics, or any other apple api, youll be mixing lots of c++ and obj-c so unless you are a veteran of c++ and are hard headed (or have a valid reason) you should just take the plunge and learn obj-c.. its not that bad lol.

if you are writing platform independent code like doing opengl or a proprietary engine you should use c++. As much as people say obj-c is platform independent it really isnt. What i mean is all the good stuff that comes to make obj-c great is part of core foundation so unless every platform can implement that its not worth the hassle.
05-28-2009, 01:30 AM
#6
Quote:
Originally Posted by inferi22 View Post
can someone help me find a way to learn code easily
That's not gonna happen, sorry. If you're not prepared to invest serious time and effort, coding isn't for you.

--Eric

Realmaze3D on the App Store
Realmaze3Free: 3 free mazes (a taste of Realmaze3D)
05-28-2009, 01:46 AM
#7
Joined: Feb 2009
Location: Sweden
Posts: 1,634
We mainly use C++ for all game code, C for our internal libraries, and as little ObjC as possible to make it portable. We have our own routines for importing meshes and textures and rely as little as possible on Cocoa. That said, it would probably be faster to use existing libraries, but hey, we are control freaks.

And mixing the three is no problem at all.
05-28-2009, 06:01 AM
#8
Joined: Jan 2009
Posts: 1,099
Quote:
Originally Posted by Eric5h5 View Post
That's not gonna happen, sorry. If you're not prepared to invest serious time and effort, coding isn't for you.

--Eric
after spending a month strait learning c++ for windows do you think I would be ready(not to start real development yet) but to start spending the rest of the summer getting used to sdk an iphone development.(and maybe have my first really simple app out in august. (do you think one forth of a year is enough)

Current faves:UniWar,Glyder, Assasin's Creed, Wolfenstein,Zenonia(beta testing)
☻/ my review site:cheatcodes4chicos
/▌reviewer at: appmania
/ \ There you go rocketman I've moved on from hobocity
05-28-2009, 08:40 AM
#9
Joined: May 2009
Location: Germany
Posts: 88
Quote:
Originally Posted by inferi22 View Post
do you think I would be ready(not to start real development yet) but to start spending the rest of the summer getting used to sdk an iphone development.(and maybe have my first really simple app out in august. (do you think one forth of a year is enough)
inferi22, no one can really answer that for you. It all depends a lot on your personal experience. For example "cool mr croc" is a IT student and is familiar with coding, he should achieve that goal quicker than you.

So I would say, if you love games and would love to make some yourself then simply do it. Don't think of how long it takes or not. You have to start and stick to it.

@cool mr croc, as for c++ vs. objective-c I agree with the other posters here. If you are new and just want to see something fast go with objective-c as apple provides a lot. I for myself would never use it, as I must go as low level as possible to make my day (c/C++ with multiplatform, speed, size in mind).
05-28-2009, 09:54 AM
#10
Joined: Mar 2009
Posts: 22
I am currently making a 3d fps and I don't know any objective-c, I don't even understand how those lines of mess works. I use a 3d engine called sio2(http://www.sio2interactive.com/HOME/HOME.html) which makes it super easy to make a good 3d game, the engine is written 99% in c, only objective-c for those things you must have(setting up a window, receive touch and accelerometer thing)