Developing in C++

Discussion in 'Public Game Developers Forum' started by jlauener, Jul 21, 2011.

  1. jlauener

    jlauener Well-Known Member

    Jul 7, 2011
    48
    0
    0
    Hi guys,

    Is there anybody here developping Iphone games in C++? Which framework do you use/recommend? What are you experience about them?

    Currently I'm using OpenFrameworks which is just fine for prototyping:

    http://www.openframeworks.cc/

    Because it is a bit limited and the iPhone platform doesn't seem to be their first target, I'm considering moving to something else. I came accross Cocos2D-X this morning and it looks very promising:

    http://www.cocos2d-x.org/

    Cheers,
    Joel.

    PS: I already have most of the game logic written. I do not need any physics/math library. All I need is to draw sprites, text and play sounds.
     
  2. Lightworx

    Lightworx Well-Known Member

    May 21, 2010
    134
    0
    0
    Italy
    To develop for the iOS platform you should be familiar with Objective C, rather than C++. Of course a good grounding in any programing language will help you get to grips with Cocoa (Apples Objective C).

    You could try the Corona SDK which uses Lua....
     
  3. Ovogame

    Ovogame Well-Known Member

    Sep 25, 2010
    570
    0
    0
    Game Developer
    Morestel, France
    I'm using my own C++ cross lib (PC/MAC/iOS) written in C++ and Opengl. The nice thing about this is that I'm making 99% of the dev on my PC, witch is extremely fast to compile and run the game and add ressources.

    JC
     
  4. Ovogame

    Ovogame Well-Known Member

    Sep 25, 2010
    570
    0
    0
    Game Developer
    Morestel, France
    Luckily, this isn't exactly true. I have only few files in Objective C that handle the minimum low level system stuff (they never change from project to project). Everything else is 100% C++. I guess if you want to write Apps and not game, you might need to get more involved with the iOS API but otherwise, I always use cross platform libs before any tigh in specific libs.

    JC
     
  5. naythan

    naythan Well-Known Member

    Jun 5, 2009
    328
    0
    0
    winner
    ask any coder, any real coder, it doesnt matter if you code with objective c or c++, codings coding!
     
  6. Ovogame

    Ovogame Well-Known Member

    Sep 25, 2010
    570
    0
    0
    Game Developer
    Morestel, France
    May I ask what is a real coder :)

    I've been coding for the last 26 years, I'm pretty sure I'm a real coder. You are right coding is coding, but releasing on multi-platform is crucial for indie dev. C++ will be easier to port your code than Objective C. Oh, and if you want to get a job in the AAA industry, you better learn C++ as it is the de facto language.

    JC
     
  7. jlauener

    jlauener Well-Known Member

    Jul 7, 2011
    48
    0
    0
    Ovogame:
    <like> :)
    The only thing is that I'm more focused on mobile gaming so for me testing directly on the device (or at least simulator) is a must. Currently I'm developping on MacBook/Xcode and I have to say I'm quite pleased with the link/run speed. I can have my app running directly on my iPhone in like 10seconds! Of course compilation is a bit slow, but it doesn't look any slower than with VisualC++ (from my experience compiling Windows applications).

    Can you simulate or run on a device from Windows? From what I know this is impossible.

    Naythan:
    So if it doesn't matter, I can choose whichever I want :p I do not get your point sorry...
     
  8. TheCrib

    TheCrib Well-Known Member

    Aug 11, 2010
    273
    0
    0
    Programmer
    Tokyo, Japan
    Amen to that.
    I'm also developing mostly on PC.. Visual Studio, Visual Assist X, VIEmu.
    ..nothing that I can find on Xcode. And of course multi-platform is a nice bonus.

    If I had to do native-looking Apps with lots of UI, then that would be different. But for games, it makes more sense to rely on low level APIs.

    Though I'll admit that if one has no experience, then the C++ + OpenGL learning curve can be quite steep.
     
  9. Mobigame

    Mobigame Well-Known Member
    Patreon Indie

    Mar 29, 2009
    405
    0
    0
    We use mainly C++, and Arm Assembly when we can (for Matrix operations for example). It's why Perfect Cell runs at 30 FPS on the first iPhone with a lot of 3D meshes and real time lighting effects.

    With Objective C you will never get good performance for a game. But it depends on the game I guess. Objective C is a high level programming language, it's better to do Apps only for now.

    OpenFrameworks seems to be a good start. Oolong is a good framework too, but it's not for beginners: http://code.google.com/p/oolongengine/
     
  10. Ovogame

    Ovogame Well-Known Member

    Sep 25, 2010
    570
    0
    0
    Game Developer
    Morestel, France
    Off course not :)

    Basically, when I need to test on the device, I copy all my src code on my mac and compile and test on the device. But I never use the simulator as my PC is simulating the same exact thing. I'm not use to XCODE so I'm 10x faster with visual and I find adding ressource faster than on the mac (anyway, all my tools are on my PC). Also, I can do a lot of things that you can't do on the simulator: like updating my ressource on my hard drive and just pressing a key inside the game to reload everything (like texture, text, snd... any data you like). Witch is very fast (no need to exit the game). Finally, I like to create editor for the game from inside the game itself and you need a mouse so having my game working on computer is crucial.

    check this one from Jump Birdy Jump:
    http://www.youtube.com/watch?v=v3mHYl_dWK8

    I find having my game compatible with computer and iOS a huge plus: speed up production and easy to make computer version.

    JC
     
  11. naythan

    naythan Well-Known Member

    Jun 5, 2009
    328
    0
    0
    winner
    hey wait, hold up! i dont have any coding experience, but i do have the pink slip to my car
    [​IMG]
     
  12. Charybdis

    Charybdis Well-Known Member

    Apr 2, 2011
    281
    1
    0
    Programmer
    Kyoto, Japan
    That is true for me too. I only use my Mac at the end when I have to build the package. I agree that having a PC build has many benefits, and is worth the extra hassle.
    However, it is not for beginners. I would definitely reccommend using something like cocos2d if you are fairly new to programming.
     
  13. blitter

    blitter Well-Known Member

    Marmalade SDK. Has it all...C++, cross-device, super fast simulator, 100% PC if you want (though Apple insist on their Mac-only app store binary uploader)...

    The list goes on, but I don't want to sound too keen! I just highly recommend it.
     
  14. jlauener

    jlauener Well-Known Member

    Jul 7, 2011
    48
    0
    0
    Mobigame:
    Gosh... Assembly this reminds me of the good old days :) Oolong could have some potential but I think using it I would spend too much time of the framework side, not enough on the game side.

    Ovogame:
    Nice level editor! And nice game btw :) Personally I think of using Java for the tooling side. Building GUIs with Swing is so easy. Guess it is just a matter of taste.

    Blitter:
    Thanks for pointing me to Marmalade this looks like a rock solid framework (EA, PopCap, Konami, ...) and the Basic license fee is affordable. Definitively worth trying the Trial version.

    Aside from that nobody tried cocos2d-x? On their website they say it run on iPhone/Android/wPhone but on the other side the documentation doesn't seem to be written in proper english...
     
  15. Rutabaga

    Rutabaga Well-Known Member

    Aug 30, 2010
    58
    0
    6
    San Francisco
    #15 Rutabaga, Jul 21, 2011
    Last edited: Jul 21, 2011
    I just started working with Marmalade a month ago and really enjoy it. I was previously using DragonfireSDK and was fairly easily able to port all my existing code over. I’ve only had about a year of coding experience and was completely unfamiliar with any OpenGL concepts, and I still found Marmalade pretty easy to work with. The documentation isn’t amazing for someone in a similar situation to me, but I think if someone has any background with the OpenGL concepts it should be a fairly simple transition in. Especially for 2D stuff, I couldn’t be much happier. (I have 0 3D experience or knowledge.)

    And, where the documentation gets confusing, they make up for with a huge number of examples and actually outstanding customer support with troubleshooting on their forums.
     
  16. Lazer

    Lazer Well-Known Member

    May 14, 2011
    114
    0
    0
    If you're just getting into game development/programming, and not working on a deadline or anything, I highly recommend spending a fair amount of time learning about OpenGL. It'll help the performance of everything you make, and help with cross platform development, and help with understanding how it is that you best learn and understand frameworks. It's not easy, but it is worth it.
     
  17. GlennX

    GlennX Well-Known Member

    May 10, 2009
    761
    0
    0
    UK
    All of my stuff is 99% C++ and my current project is GLES2.0 only (so 3gs and above), I've found the limiting factor to be the iPad1's appalling pixel shader performance and iOS's concurrency to be so efficient and the CPU so fast that I've never had to break out the assembler at all. Topia supports more than 2000 AI units, all interacting with each other on 3gs at 30 FPS. To be fair, the C++ is very efficient, I spent a lot of time in the 90s looking at compiler output as I transitioned from Assembler to C to C++. Topia does no dynamic memory allocations at all while a level is running, uses minimal inheritance and no virtual functions in the creature class, minimises float to integer conversions and when it does them, uses a oldschool iEEE hacking tricks to make this possible.
     
  18. TheCrib

    TheCrib Well-Known Member

    Aug 11, 2010
    273
    0
    0
    Programmer
    Tokyo, Japan
    I see were you're coming from.. but I'm not so sure that float->int is so terrible anymore. Certainly not for free, but also not as heavy as it was on PC a while ago (now not a problem on PC also).

    Dynamic allocations are always worrisome, but I wouldn't avoid them 100% if they can bring some benefit and simplify the code.. though of course I wound't touch the heap 2000 times per frame either (^^;)
    In a few cases I have custom allocators myself (fixed pool of objects that get reused and a constructor running with a placement new).

    Congratulations on your work.
     
  19. jlauener

    jlauener Well-Known Member

    Jul 7, 2011
    48
    0
    0
    Totally agree, dynamic memory allocation should be avoided as much as possible.

    By the way it looks like C++ is the only language that allows putting an object on the stack. At least from my knowledge...

    Very good idea!
     
  20. GlennX

    GlennX Well-Known Member

    May 10, 2009
    761
    0
    0
    UK
    This is true but I was able to get round multiple float to int conversions.

    My world wraps and is 16k x 16k on x and y. I changed this to 16384.0 <= x < 32768.0 which means the integer version of my coordinates is always shifted to the same position. I can just pull out 10 bits of x and 10 bits of y to convert this to the memory address in my 1k x 1k heightmap (for collision and a few other things). I can also pull out 7 bits of x and y to convert to the memory address in my 128*128 space partitioning (this is what allows thousands of creatures to interact without grinding to a halt). Reading a single bit tells me if a creature is in the left/right or top/bottom half of a partitioning cell. It's all rather oldschool while allowing me to work in floats for AI and rendering purposes.
     

Share This Page