Universal Binaries !
by Paul Scott · 03/03/2006 (9:43 pm) · 15 comments
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
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 DeskI'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 GoodYou 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
#2
03/03/2006 (11:24 pm)
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.
#3
03/03/2006 (11:53 pm)
Lining up them little endians I see :)
#4
(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. ;)
03/04/2006 (12:08 am)
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. ;)
#5
03/04/2006 (12:44 am)
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.
#6
Thanks for the hard work that must have gone into this.
Now if only someone would port Torsion to the Mac....
03/04/2006 (12:53 am)
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....
#7
I really love macs, and now they have a decent video card? :)
Is it shader compatible?
Phil.
03/04/2006 (2:20 am)
Great stuff Paul!I really love macs, and now they have a decent video card? :)
Is it shader compatible?
Phil.
#8
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.
03/04/2006 (5:23 am)
@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.
#9
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...
03/04/2006 (7:02 am)
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...
#10
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? :)
03/04/2006 (7:58 am)
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? :)
#11
03/04/2006 (11:33 am)
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...
#12
03/04/2006 (2:56 pm)
@James - It will happen... even if i have to do it myself. =)
#13
03/06/2006 (4:16 pm)
@Mathieu: There is only one project. There's a place you change which OS version you're targeting for the ppc build.
#14
04/11/2006 (7:58 pm)
I don't suppose you've had a chance to try the intel compilers to see how much they are faster?
#15
11/05/2006 (6:36 pm)
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.
Torque 3D Owner Rubes