Previous Blog Next Blog
Prev/Next Blog
by date

Universal Binaries !

Universal Binaries !
Name:Paul Scott
Date Posted:Mar 04, 2006
Rating:5.0 out of 5
Public:YES
Comments:YES
RSS Feed:GarageGames Blog feedor Subscribe with .
Profile Page:View profile page for Paul Scott

Blog post
MacWorld '06: Strange Things Are Afoot
So, this thing happened a few weeks ago at MacWorld.
This crazy, crazy, ... really cool thing occurred. There was hoopla. There was fanfare. Grampa Steve put on his black shirt & jeans, and did that thing he does. The crowd did that thing they do, and things happened. Because something really interesting happened this year.

Apple started shipping the long rumored and awaited Intel based Macs.
And they put a great graphics card in 'em. Joy.


The Shiny Thing On My Desk
I've had one of the 'Developer Transition Kit's on my desk for a while now, and the mac-intel port of Torque has been 90% ready for some time now. The real, final hardware arrived in early February. It's pretty cool. It's got a dual-core processor inside, and we've got 2 of them in the office so far... So, I farmed one out to Tim Aste, on a temporary basis, to corrupt him. And so I could have it up and running on the network for my own purposes...
Yep, I've got a little 2 machine compile farm now. Sharing the build between 2 of these babies, I can do a clean build of TGE in about 4 minutes, and all of MarbleBlast Gold in about 2m30s. Distcc is my new favorite cool thing.


It Lives!
Porting work was pretty simple, really: just needed final hardware, a small voodoo shrine ( to get GCC to cooperate ), and some spare cycles... And I'm pleased to announce that MarbleBlast Gold, Torque Game Builder(aka T2D), and the Torque Game Engine are all ready to go as Universal binaries !
Here's the TGE demo and MarbleBlast Gold running side by side.




Torque Game Engine & MarbleBlast Gold Are Up!
New versions of MarbleBlast Gold and the Torque Game Engine are live on the site as of this morning. Torque Game Builder (aka T2D) is in very heavy development, so the Universal binary will go out with the next rev of TGB.

MarbleBlast's version number has been bumped to 1.6, and TGE's version number has been bumped to 1.4.0u .

This is not the awaited 1.4.2 release, with all it's promised goodies. That one will be out when it's ready, which should be pretty soon, actually. I've still got 1 show-stopper in there to deal with, and the glorious Matt Fairfax has just a little bit of wrestling with the windows side stuff yet.


Two At The Same Time Is Good
You can't tell from the above shot, but both are getting very good frame rates, even when running at the same time on the same machine.That's part of the magic of a dual core processor. It's exactly like having 2 processors on the system, sharing memory. And, because TGE 1.4 and later include threading support, processor intensive tasks can be decoupled from the main rendering thread, and run in a separate thread. When you have multiple threads, and multiple processors or dual-core processor, the MacOSX kernel will automagically move threads around between processors, balancing the load for the best performance. Very good stuff. Depending on the specifics of your game, this can be a big win.



Technical Stuff
The TGE 1.4.0u SDK comes with an Xcode file that is set up to build Intel binaries using GCC 4.0 with the 10.4u SDK, and build PPC binaries using GCC 3.3 with the 10.2.x SDK. The main benefit we get out of this is maintaining backward compatibility to 10.2, while still running natively on new hardware. So, with the new TGE 1.4.0u SDK and Xcode 2.2, you can easily build a game app that runs on both Intel hardware and PPC hardware, and even on older versions of MacOSX!

The way this 'Universal Binary' thing works is pretty simple in concept. Executable binaries for both Intel and G3/G4/G5 hardware is compiled and linked, then Xcode creates a file that contains both binaries, plus some header bookkeeping info for the kernel. You get an app that's about double the code size, but will run natively on all Macs. The same approach was used in the 68k => PPC transition about 10 years ago. The two sides were combined in what was then called a 'FAT' binary. This time, they're called 'Universal' binaries. As a humorous aside, the command line tool Xcode uses to create a Universal binary is called 'lipo'. Ah, programmer humor.

-
So, that's what I've been cooking.

Share and Enjoy.

/Paul

Recent Blog Posts
List:03/04/06 - Universal Binaries !
09/27/05 - Mac Work Gooder Now
07/19/05 - Internship Begins
05/19/04 - Just a little more...
04/07/03 - New Job + New Game Project
01/29/03 - Lost the Day Job
10/10/02 - Game Project, AI Thoughts
09/12/02 - Looking at Something of a Mess on Macs...

Submit ResourceSubmit your own resources!

Rubes   (Mar 04, 2006 at 06:05 GMT)
You rock, Paul. Thanks for providing great Mac support for TGE.

Eric Elwell   (Mar 04, 2006 at 07:24 GMT)   Resource Rating: 5
I rated your .plan a 5! Good read, and though I am not a fanatic Macsist, it's always good to know GG will be sharing the goodness with the Mac world.

Vashner   (Mar 04, 2006 at 07:53 GMT)   Resource Rating: 5
Lining up them little endians I see :)

Ben Garney   (Mar 04, 2006 at 08:08 GMT)   Resource Rating: 5
Congratulations, Paul!

(His .plan doesn't mention the long nights and stressful debugging sessions that went into this release - but they say that the sign of a pro is that they make it look easy. ;)

Tom Spilman   (Mar 04, 2006 at 08:44 GMT)
I'm not a big fan of the Mac, but this is cool. I don't think you'll find many game engines as portable as TGE has consistently shown to be.

James Randall   (Mar 04, 2006 at 08:53 GMT)
As a Mac user this is excellent news to wake up to on a Saturday morning :)

Thanks for the hard work that must have gone into this.

Now if only someone would port Torsion to the Mac....

Phil Carlisle   (Mar 04, 2006 at 10:20 GMT)
Great stuff Paul!

I really love macs, and now they have a decent video card? :)

Is it shader compatible?

Phil.

Paul Scott   (Mar 04, 2006 at 13:23 GMT)
@Phil : Yes it is. It is indeed.

At least, on the iMac and the MacBook Pro models. Those are very good machines.
Unfortunately, the new Intel-based Mac Mini, announced this past Tuesday, has Intel built-in graphics with 64mb of shared memory. That means that any shader based stuff will end up rendering at least partially in software... which ain't good for games. It's not a huge difference from the PC world, really. Dell does much the same thing on their lower end machines: built-in graphics, no slot on the motherboard for a better gfx card.
Edited on Mar 04, 2006 13:28 GMT

bank   (Mar 04, 2006 at 15:02 GMT)   Resource Rating: 5
that's cool! nive progress, I love it!
btw, the latest build still comes with "bug"(misspelling?) in game/fx/precipitation.cc:
Ln: 244:
ConsoleMethod(Precipitation, setPercentange, void, 3, 3, "precipitation.setPercentage(percentage <0.0 to 1.0>)")
should be setPercentange..
this is one of the "bugs" that comes from 1.3 if i'm not mistaken...

Mathieu   (Mar 04, 2006 at 15:58 GMT)   Resource Rating: 5
The Dual Core iMac will definitely be my next Mac development machine!
It's a little confuse for the compatilibities...
There will be:
- one project to build a Universal Binary compatible with all hardware but only for OSX 10.3 & 10.4
- one project to build an application compatible with PPC hardware on OSX 10.2, 10.3 & 10.4

I'm I right? :)

James Lupiani   (Mar 04, 2006 at 19:33 GMT)
Cool stuff, Paul! Good to see it all finally make its way out of the garage. One of these days I'll mess around with Macs...

Tom Spilman   (Mar 04, 2006 at 22:56 GMT)
@James - It will happen... even if i have to do it myself. =)

Paul Scott   (Mar 07, 2006 at 00:16 GMT)
@Mathieu: There is only one project. There's a place you change which OS version you're targeting for the ppc build.

Nigel   (Apr 12, 2006 at 02:58 GMT)
I don't suppose you've had a chance to try the intel compilers to see how much they are faster?

Loser   (Nov 06, 2006 at 02:36 GMT)
Paul, how can the people who bought iMac Core Duos (with the PPC version of Marble Blast Gold, version 1.5.6, pre-installed on the machine), upgrade to the Universal Binary 1.6 version? We all don't have serial numbers to input into the Demo download, which is the only download GarageGames makes available.

You must be a member and be logged in to either append comments or rate this resource.