• Register
Post news Report RSS Porting a cross platform game to Mac OSX

So there aren't very many games for OSX. Ever wonder why?

Posted by on

The Journey Begins


As an aspiring indie game developer, I believe strongly that my game should run on all the operating systems possible - Why limit myself to one operating system when there are happy, friendly people willing to buy my game on all three?

So when I was designing ScrumbleShip, I made sure to choose cross platform ways of doing things - Every library I chose worked on Linux, Windows, and OSX. This made running my game on windows and linux a breeze - No issues worth mentioning.

However, I immediately ran into a problem with OSX support - Namely, there didn't seem to be any easy ways to create a Mac program from other operating systems. So I'd need my own Mac - But with prices starting at $1000, a new Mac was about $967 above my meager indie budget. This kept me from really focusing on OSX support for the first year of ScrumbleShip.

Cross Platform? Not quite.


When I finally got my hands on a used machine, I ran into another problem - SDL, which created windows and handled input for me, couldn't jump through the hoops required to get a modern OpenGL window from OSX. (OpenGL is how you render cross platform 3D) So even though I could "run" ScrumbleShip on the Mac, I couldn't actually display anything on the screen.

Naturally, I had to replace SDL - "GLFW" seemed to be a better fit for my situation, and could make OSX hand me a modern OpenGL window. It took about a month of work to rip out the old SDL code and replace it with GLFW code.

Then I ran into a third problem.

One of these things is not like the other


The OSX version of OpenGL is a little different from the Linux and Windows versions. In Linux and Windows, you can mix older and newer OpenGL. So I used the new OpenGL when I needed power, and the old OpenGL when I needed something quick and simple. In short, all my 2D graphics used the older OpenGL.

You cannot mix old and new style OpenGL on OSX. It's one or the other.

Exciting
First Mac-Compatible 2D rendering.

So over the next couple months I slowly replaced all my old-style rendering with the much more complex new-style rendering. This involved removing my cross-platform font rendering library, and basically re-writing a simplified version of it in modern OpenGL.

But at the end of all that, I had code I could import into XCode, compile, and run. ScrumbleShip had finally made it to the Mac!

Mac
Success!

Then my Mac broke. That one wasn't Apple's fault, but it has kept me from updating the Mac build. Thankfully my neighbor is a Mac-user and has graciously allowed me to borrow her computer, so I'll be able to hand out an OSX version again within the next few weeks.

Conclusions


Despite the lack of cross platform tools, some not-quite-cross platform libraries, some poor choices on Apple's part about how to support OpenGL on their platform, and failing hardware, I successfully got my game working on OSX. I can really understand why many developers wouldn't make this choice, however - The time I spent getting Mac support hasn't really justified the money coming in via Mac users.

But I still think it was the right thing to do. Each game coming out on OSX helps break down the barriers between the systems, and OSX users deserve cool voxel space games just as much as Linux and Windows users. Besides, there's least one good thing that came out of the porting effort - GLFW is smaller and easier than SDL for our purposes.



Cheers,
-Dirk

Post comment Comments
Guest
Guest

What about building a Hackintosh?
That's what i did in the end, now my pc duel boots Windows & MacOSX

Reply Good karma Bad karma+2 votes
dirkson Author
dirkson

Well, there's a couple of problems with that.

The first is that this is some legally pretty murky water, and could get me in trouble. So as an indie developer, I have to avoid situations like that.

The second is that OSX *really* hates AMD cpus, which I happen to have.

Cheers,
-Dirk

Reply Good karma+1 vote
Post a comment

Your comment will be anonymous unless you join the community. Or sign in with your social account: