Advertisement

Mac Game Programming

Started by May 30, 2010 05:52 PM
7 comments, last by Oluseyi 14 years, 5 months ago
Hey everyone,

I am new to programming on the mac and was curious about Cocoa and do I need to learn it?

My goal is to work on a 2d Tile based RPG like the old final fantasy, and dragon warrior games. So, I will be using OpenGL and I am thinking about using SFML as well.

Do you guys think it is worth the extra time to learn a new API (Cocoa) for this type of game ? I'd also like to keep the code portable to Windows / Linux as well. I know Cocoa is not available there, but I'd learn and use it if it would help my programming.

I'm working on a Macbook with Snow Leopard and Xcode 3.2.

Thanks for any advice you can give.

Michael
Michael RhodesTiger Studios Web Designhttp://tigerstudios.net
You're planning to use a cross-platform compatibility layer (SFML), so why do you care about Cocoa vs Carbon? So long as SFML is programmed using modern APIs, you can focus on a single API (SFML's) and build and deploy to Windows, Mac and Linux.

There's no point to learning Cocoa for your game unless you want it to be a Mac-exclusive, feel like rewriting huge chunks of your app for no real reason, or plan to add some special Mac-only features that SFML doesn't already support.
Advertisement
Well, the thing is that I am new to the Cocoa vs Carbon APIs and not sure what is there to use. I'm wondering if there would be some reason to chose cocoa over sfml. I really like the Mac so far and could see myself doing all my programming on it, however, the only mac I have is this 13 inch macbook and it is a little small to use as a full time computer.

So unless there are some performance benefits, or ease in programming by using Cocoa, I think I may stick with SFML.

thanks for the advice.... and I still welcome any other comments from anyone else with some experience in Mac programming,

Michael
Michael RhodesTiger Studios Web Designhttp://tigerstudios.net
If you want to program cross-platform games, then stick with SFML + OpenGL.

If instead you want to write desktop Mac applications, you should learn Cocoa.

Carbon is dead to all intents and purposes, and has been for years - let it rest in peace.

Tristam MacDonald. Ex-BigTech Software Engineer. Future farmer. [https://trist.am]

Quote: Original post by mrhodes
Well, the thing is that I am new to the Cocoa vs Carbon APIs and not sure what is there to use. I'm wondering if there would be some reason to chose cocoa over sfml.

That really depends on SFML. If SFML is written to take advantage of the Cocoa APIs on OS X, then you get all the advantages of those APIs as well as 64-bit support (Carbon will not see a 64-bit version; Apple changing its mind on this is one of the things that kept Adobe Creative Suite 4 32-bit on OS X while the Windows version saw a number of 64-bit apps), all while still writing to a single API for multiple platforms. If SFML is not written to use Cocoa, then with time your games will face an artificial performance/functionality limit simply because the library you're using can't take full advantage of the system.

Quote: Original post by mrhodes
I really like the Mac so far and could see myself doing all my programming on it, however, the only mac I have is this 13 inch macbook and it is a little small to use as a full time computer.

Does your Macbook have a mini DisplayPort? If it does then you can connect a second monitor to significantly expand your display space. You can hook up a full-size keyboard (USB or Bluetooth), too, if you want. Put all of these in your normal workspace at home and preserve the ability to take your computer with you on the go.

Quote: So unless there are some performance benefits, or ease in programming by using Cocoa, I think I may stick with SFML.

There are potential future benefits, but I don't think they're significant enough to advise you to pick up Cocoa right now. I think you should eventually pick up Cocoa - every Mac programmer should, IMO - but for now spend your time making your game for your whole potential audience - Windows, Mac and Linux.

Good luck, and happy hacking!
Thank you Oluseyi and everyone for your replies.

As for SFML and Cocoa usage, I'm not sure. I just did some looking on the sfml site and didn't find anything to verify that it uses Cocoa and I also checked a SFML template in Xcode and it does not link in the Cocoa framework that I can see.

I am thinking about learning Cocoa anyway just because I probably should be using, or know the main api for the Mac.

Like I said, I am just going to be working on a (hopefully) simple Tile based RPG, single player. This is just a hobbie for me so taking the time to learn a new API isn't an issue. Although, I looked at some tutorials and so far not sure if I'd want to use Objective-C over C++. Maybe it would just take some getting used to. I'll probably stick with C++ though.



Thanks again for the advice...

I'll post more if and when I have questions. It's good to know there are some Mac programmers here to help, although I suspect once I get my basic coding done my game will be agnostic to the platform I'm using.

Later,


Michael


PS: I guess I should add that I am interested in having my program work on the iPhone/iPad as well. I do not have either of these devices, however the newest Xcode comes with a simulator for them. I thought I read somewhere that these devices cannot have custom frameworks added to them, so I'm thinking that could potentially rule out SFML ? like I said, this is something I am thinking about as well.

[Edited by - mrhodes on May 31, 2010 8:42:06 AM]
Michael RhodesTiger Studios Web Designhttp://tigerstudios.net
Advertisement
While you don't need to know Cocoa to write a Mac game, learning Cocoa would help if you want to write content creation tools, like world editors, for your game.

If you're looking for other Mac game developers, check out iDevGames.

http://www.idevgames.com

Mark
Mark Szymczyk
Author of Mac Game Programming and Xcode Tools Sensei
http://www.meandmark.com
Thanks Mark for the link, I'll look into that right now...

And I will be looking into making some minor tools at some point. At least something for making maps, and editing quest/ item lists.

I think I'll hack away at what I can, and also learn Cocoa as well.

Now, can anyone tell me if Cocoa can be used with C++ and not Objective-C ? I'm not really fond of what I have seen so far for that. I'm sure I'll figure this out as I research a bit more into Cocoa

Thanks guys,

Michael
Michael RhodesTiger Studios Web Designhttp://tigerstudios.net
Quote: Original post by mrhodes
PS: I guess I should add that I am interested in having my program work on the iPhone/iPad as well. I do not have either of these devices, however the newest Xcode comes with a simulator for them. I thought I read somewhere that these devices cannot have custom frameworks added to them, so I'm thinking that could potentially rule out SFML ? like I said, this is something I am thinking about as well.

Yes, SFML is (currently) not an option for iPhone OS devices.

Quote: Original post by mrhodes
Now, can anyone tell me if Cocoa can be used with C++ and not Objective-C ? I'm not really fond of what I have seen so far for that. I'm sure I'll figure this out as I research a bit more into Cocoa

No, Cocoa is an Objective-C API.

In summary: using Cocoa requires Objective-C. It does not, however, require that your entire application be written in Objective-C, since Objective-C is a superset of C and a variant known as Objective-C++ is a superset of C++. This means that you can write all your core logic in straight C++ and only use Objective-C[++] for interfacing with the Cocoa APIs.

To what end accessibility? Gamasutra speaks to Valve and other developers about creating games for different audiences about the very good reasons you should consider making your game more easily played.





View the full article

This topic is closed to new replies.

Advertisement