C++ or C or Objective-C

Discussion in 'Public Game Developers Forum' started by jDun1212, Jun 14, 2012.

  1. jDun1212

    jDun1212 Well-Known Member

    Feb 2, 2012
    65
    0
    0
  2. vbovio

    vbovio Well-Known Member

    Aug 28, 2009
    73
    0
    0
    ObjC is a great modern language and easier to do things, but for games, I use C/C++ because: 1) performance wise and 2) cross platform.
     
  3. AlienSpace

    AlienSpace Well-Known Member

    May 28, 2010
    416
    0
    16
    Independent developer
    Use C++ for everything you can, and ObjectiveC for the rest. Avoiding ObjC will allow you to make your game cross-platform.
     
  4. makaGeorge

    makaGeorge Well-Known Member

    Apr 27, 2012
    57
    0
    0
    Thanks for the article. The comment saying that what is slowing down the game are calls to NSMutableArray is very interesting... I code in Obj. C because I just love the language and knowing C it was easy to learn, but I'll consider using C for parts of the code to gain in performance... wrapping things in objects is very convenient, but if performance is an issue it's clear it's better not to do it...
     
  5. TheBunny

    TheBunny Well-Known Member

    Nov 8, 2008
    205
    0
    16
    MMO Mac Lead ZeniMax Online
    Baltimore
    #5 TheBunny, Jun 15, 2012
    Last edited: Jun 15, 2012
    Some general notes :)

    1. ObjC dynamic function dispatch is about x2 slower then C++ virtual functions

    2. ObjC compiler does not inline code,
    C++ functions, Templates can be etc.
    in some code this is a massive speed win vs Objc.

    3. All this given... ObjC is Perfectly fast enough to make most apps and many games... heck ObjC ran fine on old 68000 CPU NEXT boxes ;)
    So don't worry to much... also... you may find in tight loops with a lot of function calls it would be much faster to code those functions in C or C++ and call that from ObjC.

    4. Anyhow its perfectly fine to mix and match ObjC, C , C++ , Lua etc as needed.
     
  6. EdenWorldBuilder

    EdenWorldBuilder New Member

    Nov 21, 2011
    2
    0
    0
    Objective-C is fine but it has terribly slow libraries. As long as you avoid the libraries then the only issue is with really tight loops, where you want to juice every last bit of performance out, use C.

    Of course if you don't use the obj-c libraries your mostly coding like you would with C except with classes and properties.

    C/C++ is really the way to go. Obj-C locks you into apple's platforms, making it more difficult to release ports and there's many gamedev libraries for C/C++ that you will probably want to use anyway.
     
  7. 7floorgame

    7floorgame Active Member

    Feb 26, 2012
    30
    0
    0
    You can use Allegro with C or C++. It's a cross platform game engine.
     
  8. jDun1212

    jDun1212 Well-Known Member

    Feb 2, 2012
    65
    0
    0
    What about a game like infinityblade? or possibly NOVA 3? what might those be written in?
     
  9. AlienSpace

    AlienSpace Well-Known Member

    May 28, 2010
    416
    0
    16
    Independent developer
    Most games written by professionals are written in C++.
     
  10. Ovogame

    Ovogame Well-Known Member

    Sep 25, 2010
    570
    0
    0
    Game Developer
    Morestel, France
    +1 for C++. Mainly for cross platform reasons.

    JC
     
  11. jDun1212

    jDun1212 Well-Known Member

    Feb 2, 2012
    65
    0
    0
    How hard is C++ when compared to Objective-c?
     
  12. RebelBinary

    RebelBinary Well-Known Member

    Jun 11, 2012
    160
    7
    18
    Software Developer/Designer
    Ottawa, Canada
    #12 RebelBinary, Jun 19, 2012
    Last edited: Jun 19, 2012
    For a professional developer, C++ is the way to go, cause once you know C++, (with the exception of assembly) you pretty much know every other programming language.

    That being said, as C++ programmer for 15+ years I prefer using something like Corona SDK which is written in Lua and gets you a lot farther in making apps in less time then developing natively. I just want to get my ideas on the screen and not have to deal with doing a game engine. Less control and some limitations sure, but it's made programming far more enjoyable.
     
  13. glaze

    glaze Member

    Nov 17, 2011
    13
    0
    0
    iOS game programmer
    Finland
    Actually, you know imperative languages, but not necessarily functional languages.
     
  14. RebelBinary

    RebelBinary Well-Known Member

    Jun 11, 2012
    160
    7
    18
    Software Developer/Designer
    Ottawa, Canada
    Correct, you won't know Lisp or Scheme and also you won't know Logic programming like Prolog. I learned those in school. But for the purpose of 99%(magic number out of my head) of the software out there, understanding of procedural(imperative) programming is all you need.

    Curious are there any apps written in lisp on the iPhone? lol!
     

Share This Page