c++ vs objective-c

Discussion in 'Public Game Developers Forum' started by cool mr croc, May 28, 2009.

  1. cool mr croc

    cool mr croc Active Member

    May 27, 2009
    41
    0
    0
    hi :D

    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?
     
  2. jonaswills

    jonaswills Well-Known Member
    Patreon Gold

    Nov 11, 2008
    403
    3
    18
    Game Developer
    Washington
    *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.
     
  3. inferi22

    inferi22 Well-Known Member

    Jan 11, 2009
    1,099
    1
    0
    can someone help me find a way to learn code easily
     
  4. cool mr croc

    cool mr croc Active Member

    May 27, 2009
    41
    0
    0
    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.

    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.
     
  5. drunknbass

    drunknbass Well-Known Member

    Nov 8, 2008
    128
    0
    0
    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.
     
  6. Eric5h5

    Eric5h5 Well-Known Member

    That's not gonna happen, sorry. If you're not prepared to invest serious time and effort, coding isn't for you.

    --Eric
     
  7. Anders

    Anders Well-Known Member

    Feb 3, 2009
    1,634
    0
    0
    Co-owner and CTO at Color Monkey
    Sweden
    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.
     
  8. inferi22

    inferi22 Well-Known Member

    Jan 11, 2009
    1,099
    1
    0
    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)
     
  9. Xood

    Xood Well-Known Member

    May 11, 2009
    88
    0
    0
    Casual Game Developer (Coder,CTO,CEO)
    Germany
    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).
     
  10. oioioi

    oioioi Member

    Mar 5, 2009
    22
    0
    0
    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)
     

Share This Page