Carbon or Cocoa for Games

Sage
Posts: 1,066
Joined: 2004.07
Post: #1
Which API do you use and why?
Quote this message in a reply
Moderator
Posts: 698
Joined: 2002.04
Post: #2
Neither, SDL; fast, free, easy, lots of documentation, cross-platform, and allows access to OpenGL, lots and lots of plug-in libraries for sound loading/playback, image loading, ad nauseum.

Mark Bishop
--
Student and freelance OS X & iOS developer
Quote this message in a reply
Sage
Posts: 1,232
Joined: 2002.10
Post: #3
Both, depending on what needs to be done. You can freely mix and match the two.

Cocoa is nice for overall app ease of use (events, document architecture, prefs, windowing etc)
Carbon has a native pixel format (ARGB GWorlds) and some useful Mac APIs are still Carbon-only (Quicktime, Resource Manager.)
Quote this message in a reply
Moderator
Posts: 608
Joined: 2002.04
Post: #4
Cocoa, because I don't see the point of making it harder on myself by using Carbon.
Quote this message in a reply
Member
Posts: 370
Joined: 2002.04
Post: #5
For games, neither - Allegro for cross-platform ability. For other apps, Cocoa, for ease of use and because it's so much more intuitive than Carbon.

Did you ever wonder why we had to run for shelter when the promise of a brave new world unfurled beneath the clear blue sky?
Quote this message in a reply
Moderator
Posts: 3,572
Joined: 2003.06
Post: #6
Almost all Cocoa for any system UI stuff with plenty of Carbon thrown in here and there as needed for other things like QT. I try to replace Carbon code as Apple comes up with more/better Cocoa for equivalent functionality. 100% daily dosage of C for the actual game code and OGL and OAL for graphics and sound. No Cocoa or Carbon is allowed past my timer callback, so I guess I can't really say I use either for the actual game.
Quote this message in a reply
Moderator
Posts: 771
Joined: 2003.04
Post: #7
Cocoa, Carbon and SDL!!!
Well, I don't use Cocoa for games directly, but SDL uses it internally. I usually don't use Carbon, but for my entry on CreateMacGames latest contest I had to use speech synthesis and, as usual, while it was easier to set up and use on Cocoa, Carbon let's you control a lot of things not implemented in the Cocoa wrapper (like, for instance, the speed & pitch of the synth. voice).

Now, if I ever make a game wich requires a heavy GUI, Cocoa is the right choice.
Quote this message in a reply
Moderator
Posts: 592
Joined: 2002.12
Post: #8
I use Cocoa as I came into Macs at the OS X stage so had no past history pre OS X and hence no need to reuse any existing code.

I also use Cocoa as I enjoy using Objective-C. You may ask why and I will tell you. It makes a nice change from the kind of coding I do in my day job.
Quote this message in a reply
Superpig
Unregistered
 
Post: #9
Cocoa, because when I went into #idevgames and said "Can anyone help me get started" mdavis1982 pointed me to his template, which was written in Cocoa. Rolleyes
Quote this message in a reply
Member
Posts: 257
Joined: 2004.06
Post: #10
Cocoa here because my home programming experience on the Mac started with OS X. Though I have played around with SDL and GLUT. And I've been meaning to start learning OpenGL as well.

The brains and fingers behind Malarkey Software (plus caretaker of the world's two brattiest felines).
Quote this message in a reply
Moderator
Posts: 508
Joined: 2002.09
Post: #11
Cocoa, because I feel it's closer to the system than Carbon (which is not really true, but it's just a feeling I have).

Also, with Cocoa some tasks are easier to code than with Carbon. The only thing that bothers me is that Cocoa doesn't have support for 2D arrays, but that's easily solved.

However, I sometimes use some Carbon functions, for example CGDisplay's functions are very handing, especially when you wanna do fades.

Basically I use Cocoa and C for just about anything, not just for games.

"When you dream, there are no rules..."
Quote this message in a reply
Moderator
Posts: 608
Joined: 2002.04
Post: #12
Taxxodium Wrote:However, I sometimes use some Carbon functions, for example CGDisplay's functions are very handing, especially when you wanna do fades.
Technically, I'm not sure CGDisplay functions are part of Carbon but rather CoreGraphics.
Quote this message in a reply
Luminary
Posts: 5,143
Joined: 2002.04
Post: #13
For most games, you'll be using very little of either. They each have their specific ups and downs as far as games go. Personally, I'm not a fan of AGL, so I tend to go with Cocoa, but I wouldn't say that either is necessarily a better choice.

Of course, as soon as you need a standard Mac OS widget, Cocoa wins hands-down.
Quote this message in a reply
DoG
Moderator
Posts: 869
Joined: 2003.01
Post: #14
Nick Wrote:Which API do you use and why?

The poll is pretty borked. Carbon and Cocoa are not exclusive of each other (au contraire!), and most of the time you will use some parts of Carbon, even if you are coding in Obj-C. Also, just because some API is in C, it doesn't mean it's part of Carbon (QT, OpenGL, for example).

Carbon also contains a lot of stuff for which object-orientation doesn't work well enough to create a Cocoa wrapper.

Cocoa is dependent on the Obj-C language, and vice versa. Cocoa & Obj-C provide a very good object-oriented environment, if OO is your kind of tea. Also, Cocoa has a more advantageous learning curve than Carbon, but in the end you can do the same thing with either API.

Personally, I find Cocoa excellent for UI related things, but prefer to steer clear of Obj-C for performance reasons, hence prefer to code in C++ for core things (despite OSC's crusade againts evil).
Quote this message in a reply
Moderator
Posts: 771
Joined: 2003.04
Post: #15
DoG Wrote:The poll is [...] evil

Wink That's why I posted (last post, 7 months ago! before this thread resurrected), but didn't vote.
Quote this message in a reply
Post Reply 

Possibly Related Threads...
Thread: Author Replies: Views: Last Post
  Cocoa or Carbon? Leroy 5 3,763 May 17, 2007 06:54 PM
Last Post: SethWillits
  Newbie question: Cocoa and Carbon - which for what and how to get started? BliTz 3 3,241 Jul 27, 2006 10:07 PM
Last Post: OneSadCookie
  Carbon C/ Cocoa API Questions Stalin55 3 3,291 Jul 3, 2006 02:07 PM
Last Post: OneSadCookie
  Noob Cocoa and Carbon Questions MonitorFlickers 15 6,269 Feb 23, 2006 06:01 PM
Last Post: Tesselate
  Setting Up Cocoa For Games Nick 9 4,479 Oct 2, 2004 12:41 PM
Last Post: Nick