Best Porting Options - Mac (Cocoa/OpenGL) to Windows

Member
Posts: 509
Joined: 2002.05
Post: #1
After releasing my sales stats for GL Golf here - http://www.idevgames.com/forum/showthread.php?p=121362 - I decided I NEED to get it ported to windows. I'm now trying to figure out my best option for this.

Background-
GL Golf is programmed in Objective-C using Cocoa and Open GL using XCode. It is about 13,500 lines of code (all files and whitespace). Cocoa is used for the interface, internet connections, and sound (NSSound), and the preference file.

Options-
* Pay someone (maybe around $1000 and/or percentages of sales) to port it for me.

* Convert it from scratch to cross platform C/C++ code, reprogramming lots of Cocoa things along the way.

* Convert it from scratch to cross platform Objective-C code, reprogramming lots of cocoa things along the way, but keeping the majority of MY classes/code unchanged.

* Gradually start converting everything I can in my current XCode project to be cross platform, and eventually it will build on both the mac and windows.


I think I want to stay with Objective-C and go with the last method I chose. That way I can stay in Objective-C and then when I update the game I can keep one set of files and everything I change on the mac will be changed on the windows version.

Does anyone have any experience or advice about OPENSTEP? Is it worth using or looking into, does it do things like NSString and other relatively simple cocoa methods?

EDIT : Also, what is the best method for interfacing for both Mac and PC? Should I go with SDL or use Cocoa for Mac and then something else for windows?

Also, if someone has a cross platform game that sells decently, could you post your percentage of mac buyers and windows buyers, I'm curious to what I should expect.

Thanks
Quote this message in a reply
Moderator
Posts: 529
Joined: 2003.03
Post: #2
I'm probably talking through my a$$, but maybe you could use GNUStep to port it.

"Yes, well, that's the sort of blinkered, Philistine pig-ignorance I've come to expect from you non-creative garbage."
Quote this message in a reply
Member
Posts: 509
Joined: 2002.05
Post: #3
Leisure Suit Lurie Wrote:I'm probably talking through my a$$, but maybe you could use GNUStep to port it.

Oops, thats what I meant by Openstep, I'm going to have to look into that some more!
Quote this message in a reply
Moderator
Posts: 529
Joined: 2003.03
Post: #4
Jake Wrote:Oops, thats what I meant by Openstep, I'm going to have to look into that some more!

Ah. Not am I talking through the wrong end. I can't read, either.

*hides under a rock*

"Yes, well, that's the sort of blinkered, Philistine pig-ignorance I've come to expect from you non-creative garbage."
Quote this message in a reply
Moderator
Posts: 529
Joined: 2003.03
Post: #5
I should probably beat Jon to suggesting using Unity to port it to Windows. Might be the least aggravating path, although it'll set you back over 1 grand for the crosss platform version. OTOH, you were willing to pay someone that to port it for you...

"Yes, well, that's the sort of blinkered, Philistine pig-ignorance I've come to expect from you non-creative garbage."
Quote this message in a reply
Moderator
Posts: 1,140
Joined: 2005.07
Post: #6
The most "cross platform" way to do it would be to do everything in C/C++ and have everything work in SDL or similar cross-platform libraries. However, GNUStep would provide a quicker option assuming all your Cocoa classes are also implemented in GNUStep, and that you can somehow get GNUStep working on Windows without requiring Cygwin. (or perhaps there's just a set of libraries you can include with your install)

Edit: Apparently there are Windows binaries available.
Quote this message in a reply
Member
Posts: 257
Joined: 2004.06
Post: #7
Jake Wrote:EDIT : Also, what is the best method for interfacing for both Mac and PC? Should I go with SDL or use Cocoa for Mac and then something else for windows?

I've been experimenting with creating Win32 versions of a couple of my projects using wxWidgets. I haven't been too entirely successful at it (due to lack of time and what not) but it seems a promising route. I used it to create my OMG entry, Chemical Bonds. It will give you classes for preference handling, basic internet connectivity (I think), and maybe sound.

Okay... the website appears to be not there. I'll point you to the Wikipedia article then: http://en.wikipedia.org/wiki/WxWidgets

The brains and fingers behind Malarkey Software (plus caretaker of the world's two brattiest felines).
Quote this message in a reply
Luminary
Posts: 5,143
Joined: 2002.04
Post: #8
I'll just say, everyone I know who's gone "Ooh, GNUStep!" has later gone "Argh! The pain!".

I'd really recommend ditching Objective C entirely and going for C/C++ with SDL.
Quote this message in a reply
Member
Posts: 509
Joined: 2002.05
Post: #9
OneSadCookie Wrote:I'll just say, everyone I know who's gone "Ooh, GNUStep!" has later gone "Argh! The pain!".

I'd really recommend ditching Objective C entirely and going for C/C++ with SDL.

Thats the advice I was waiting for someone to say before I tried it, I remember looking into it a while back and not ever installing it/trying it.

What are your thoughts on Objective-C and SDL, just using the language without cocoa, that way I wouldn't have to reprogram most of my code, and I have no speed concerns because hardware has advanced so much sense uDevGames 2004 when I started.

So if I used GNUstep I would have to use an installer and install files just to allow my game to run on windows? I just remembered how much I hate windows and installers!
Quote this message in a reply
Luminary
Posts: 5,143
Joined: 2002.04
Post: #10
Jake Wrote:What are your thoughts on Objective-C and SDL, just using the language without cocoa, that way I wouldn't have to reprogram most of my code, and I have no speed concerns because hardware has advanced so much sense uDevGames 2004 when I started.

I bet you're using more of Cocoa than you think you are. Objective C as a language gives you very little functionality...

It also ties you to developing using MinGW as your compiler, with whatever ObjC support (or lack thereof; I doubt anyone actually cares or tests if it works) it provides.

Quote:So if I used GNUstep I would have to use an installer and install files just to allow my game to run on windows? I just remembered how much I hate windows and installers!

I don't know about installers, but you'd have at least one more DLL to bundle with your application...
Quote this message in a reply
Moderator
Posts: 916
Joined: 2002.10
Post: #11
Where's the rewrite in Unity option? =)

Anyways, Jake, do you think this program will be as well received in the Windows world as the mac world?
Quote this message in a reply
Member
Posts: 509
Joined: 2002.05
Post: #12
I guess it can't hurt to switch to C++, I have the C++ pocket guide and know a little bit about it, and then I'll be much more experienced in C++. Does cocoa include things like memory management and/or does it add more to the language then I would expect?

I wonder what the easiest way to do this is, I wonder if I can transition slowly by gradually changing over each of my classes to C++, linking them together with Objective-C++. That way I can get what I think is cross platform code running in XCode, and when I'm all done with that I can try to get those files to compile on Windows.

And I seem to be hearing alot about Unity from people (Dan comes to mind), maybe I could do that but I'm afraid to take on anything to big because I really don't have the free time like I use to when I was single and in high school.

And I doubt it will be as well perceived by the windows world, but I figure even if it does 10% as well it will be worth it, and it has the potential to do much higher then that (although it probably won't)
Quote this message in a reply
Apprentice
Posts: 17
Joined: 2006.10
Post: #13
A few years back, I took a look at GNUstep. I even wrote some documentation for it. The sense I got then was that Foundation support was pretty good, but that AppKit stuff wasn't nearly as well developed. That was 6 years ago, things might have changed. The code I wrote for GNUstep I ported into Cocoa when I got the chance, and didn't go back.
Quote this message in a reply
Moderator
Posts: 1,140
Joined: 2005.07
Post: #14
The majority of your stuff should transition into C++ fairly easily. The only thing is, depending on how "Cocoa" your style of memory management is, you might have to redo some of that. Also, if you're making some assumptions about message calling using id, then you might have to tweak some things. Other than that, it's essentially changing how you define the classes, how you call your methods, changing a few data structures (like if you use NSArray), and switching out your window setup/event code.
Quote this message in a reply
Member
Posts: 509
Joined: 2002.05
Post: #15
akb825 Wrote:The majority of your stuff should transition into C++ fairly easily. The only thing is, depending on how "Cocoa" your style of memory management is, you might have to redo some of that. Also, if you're making some assumptions about message calling using id, then you might have to tweak some things. Other than that, it's essentially changing how you define the classes, how you call your methods, changing a few data structures (like if you use NSArray), and switching out your window setup/event code.

I think most of my actual "game" code is pretty procedural, and doesn't really use Cocoa too much, so C++ might be a good idea, I do want some experience with C++ instead of just Objective-C.


I have a question about mixing C++/Objective-C. Say I have my controller class, which controls the UI and starts the game. the Controller class controls my glView class, which runs the game. glView creates a level class, which handles everything associated with a level. The level class creates a tree class, which loads and draws trees ect.

Could I first reprogram the Tree class in C++, then make my level class an objective C++ file, and then start replacing things like [trees doMethod] with trees::doMethod(), then keep repeating the process until I get everything class to C++? That way I could do this gradually, and keep making other updates to the mac version while I'm working.


Oh, and I talked to Dan on AIM I'm pretty sure he's on the Unity payroll Wink, which I'm considering but I think it would almost be better to make a new game from scratch using Unity
Quote this message in a reply
Post Reply 

Possibly Related Threads...
Thread: Author Replies: Views: Last Post
  Options for Web Game Development in OS X Nick 4 4,074 Sep 20, 2008 01:13 PM
Last Post: Nick
  Trying to port an OpenGL Windows game anthony 2 3,853 Jan 26, 2007 02:16 PM
Last Post: anthony
  initializing opengl in cocoa FreeKQuency23 6 3,852 Apr 2, 2006 12:10 PM
Last Post: arekkusu
  XCode project build options + makefiles = compiling fun! Lavareef 2 6,448 Nov 10, 2005 04:30 PM
Last Post: dair
  Windows Event Loop -> Cocoa Timers maaaaark 2 4,149 Apr 11, 2005 11:22 AM
Last Post: Red Marble Games