Previous Blog Next Blog
Prev/Next Blog
by date

TGEA 1.8 on a Mac

TGEA 1.8 on a Mac
Name:Matt Fairfax
Date Posted:Sep 20, 2008
Rating:5.0 out of 5
Public:YES
Comments:YES
RSS Feed:GarageGames Blog feedor Subscribe with .
Profile Page:View profile page for Matt Fairfax

Blog post

TGEA 1.8 runs on Macs!


Running TGEA on a Mac

After years of research, we here at GarageGames have painstakingly come up with a surefire process to run TGEA a Mac! Here is the procedure:

1) First, be sure that you buy an Intel-based Mac (this is critical)
2) Next, install Boot Camp
3) Then install Windows Vista
4) Download and install Torque Game Engine Advanced

And there you go...TGEA on a Mac!

Running TGEA on OSX

What? Wait! When the hordes were demanding that we port TGEA to the Mac, that isn't what you meant?!? Ohhh....

Well...how about we release a new version of TGEA that is designed to run on a Mac under OSX?

Fortunately for you, we were showing off just that very thing at Austin GDC this past week:




TGEA 1.8 running on an iMac at AGDC


Tell me more!

TGEA 1.8 is the next version of TGEA that we will be releasing. It is a FREE update that is aimed primarily at adding OSX support to Torque Game Engine Advanced.

This is a culmination of years of work and research by Alex Scarborough starting with his impressive Modernization Kit. For the last year or so, Alex has been hard at work hacking in a quick OpenGL shader solution into our InstantAction games like Fallen Empire: Legions, Rokkitball, Marble Blast Online, and ThinkTanks so that they are all playable on the Mac version of InstantAction. When he wasn't doing that, he was taking the lessons he learned from that and adding a proper OpenGL Shader layer to our cutting edge research and development engine ("Torque R&D" for now).

GFX2

For the last several months I have been hard at work at merging the next generation of GFX from Torque R&D back into TGEA. This means that we will be picking up a few things more than just an OpenGL layer. It also means that we will be able to directly benefit from the hard work and experience that GG Studios is putting into their next round of games.




You can use the Project Generator on OSX to create your Xcode project


StateBlocks

One of the fundamental changes that GFX2 introduces is the concept of StateBlocks. This is actually something that we borrowed from DirectX 10 and have implemented in software for the DirectX9 and OpenGL layers for now. The basic idea is that an active rendering state is contained in one object and you are able set that rendering state with a single call. The state that you set fully defines the render state. So the idea of a cannonical render state is gone. Which is good, your rendering worries about defining its own state and that's it. This should greatly reduce bugs that are introduced because state hasn't been cleaned up by a previous rendering object/pass (this is the cause of a lot of the graphical glitches you see in Torque and other engines).

Let me break this down into an example. In the past we might have done something like:


// Render time code
GFX->setBlendEnable(true);
GFX->setBlendDest(GFXInvSrcAlpha);
GFX->setBlendSrc(GFXSrcAlpha);


Now, when we are setting up our object we do this:


// Setup code, done once
GFXStateBlockDesc desc;
desc.setBlend(true, GFXSrcAlpha, GFXInvSrcAlpha);
GFXStateBlockRef myState = GFX->createStateBlock(desc);


And then when we render we can make a single call and it properly sets up the entire rendering state:


// Render time code
GFX->setStateBlock(myState);


This practically eliminates state bugs and what is even cooler is that when we make the switch to DirectX 10 this will all be hardware driven (fast!).

ShaderGen

One of the great things about GFX2 is that it has a proper GLSL ShaderGen implementation. This means that if you use Materials on your object (currently defined in script) then they will automatically work on both Windows and Mac. This can save your team and project a ton of time and make it so that your port to OSX is fairly trivial.




Use a Material and your shaders will just work on Windows and Mac


You can use CustomMaterials to specify your own hand written HLSL and/or GLSL shaders (if you want to remain cross-platform compatible you'll have to implement both for CustomMaterials).

Constant Buffers

Another big change that GFX2 brings with it is Constant Buffers. Instead of just "knowing" which register maps to which shader variable, in GFX2 you query the shader for a list of variables and then bind to them by name.

For example, previously if I wanted to set a float to the shader variable scaleLighting, I would have something like this in the shader:


uniform float   scaleLighting  :  register(C14)


and this in my C++ code:


GFX->setShaderVertexConstF(14, myConst);


I would have to know ahead of time that the shader was expecting my value to be in the 14th register and to bind it there. Instead with GFX2, I just query the shader for its "scaleLighting" variable and it hands back a handle for me no matter what register it is bound to.

At load time, I would have something like:


// Setup code
GFXShaderConstBuffer* myBuff = shader->allocConstBuffer();
GFXShaderConstHandle* myHandle = shader->getShaderConstHandle("$scaleLighting");


And then, when I rendered, I would have:


// Render code
myBuff->set(myHandle, myConst);
GFX->setShaderConstBuffer(myBuff);


This allows us to end up with a lot less mismatches between what the shader expects and what we are sending it and has the potential to allow the drivers to do some optimization on the shaders which could change which registers are bound to which variables.

Porting and Documentation

We know this is a lot of changes and it is going to be a bit daunting if you have GFX rendering code that needs porting over to GFX2. That is why our documentation guru, Michael Perry, is already hard at work on a general overview doc for GFX2 and a lot of porting docs and tutorials to help smooth your transition. It is also the reason that we tried to limit most of the changes between TGEA 1.7.1 to TGEA 1.8 to things that GFX2 directly relies on.



Check out a quick walkthrough of T3D on a Mac at AGDC...be sure to watch all the way to the end =)


When do we get it?!?!!

As you can see from the screenshots and videos we have a lot of the initial integration done. However, we do have few more big systems to work through and a ton of smaller spots (mostly StateBlock related) spots to finish merging over.

Our goal is to provide TGEA owners with access to a Beta some time in the next 3-4 weeks. As always, this is only an estimate and shouldn't be taken as a hard and fast deadline. We will be sure keep you posted on the progress if we aren't going to hit this estimate though.

We are really excited to finally provide this to you guys and that it is everything that it should be and that it is FREE!

If you are looking for more information you can read more over in the IRC Hour Chat Log

Recent Blog Posts
List:11/14/08 - TGEA 1.8 Beta is now available!
10/31/08 - CyberRifle
09/20/08 - TGEA 1.8 on a Mac
06/20/08 - Barricade Demo
06/13/08 - Follow Through - TGEA 1.7.1 Released
04/05/08 - TGEA 1.7 is Officially Released!
03/29/08 - Torque Game Engine Advanced Open Beta 2
03/19/08 - Torque Game Engine Advanced Open Beta

Submit ResourceSubmit your own resources!

Pat Wilson   (Sep 20, 2008 at 02:49 GMT)   Resource Rating: 5
Fantastic .plan.

I'm glad this is finally out in the open air. A significant amount of work has been put in to TGEA this year, and a lot of it has depended on other work. This update to TGEA is fantastic (besides the Mac stuff which is monumental). State blocks and constant buffers prevent many bugs that arise from bad states, or over-writing shader constants. The PIX output is so much easier to read since all shader constants are set in one call. You no longer have to skim through 20 lines of "setvertexshaderf" to find the call you are looking for. The rendering code is cleaner, and easier to follow without state calls scattered all over the place.

Hats off to Matt & Alex.

Josh Engebretson   (Sep 20, 2008 at 02:58 GMT)   Resource Rating: 5
Great post!!! TGEA + OSX = Moist and Delicious!

Edward   (Sep 20, 2008 at 03:20 GMT)
will AFX be added to this in due time?

Brett Seyler   (Sep 20, 2008 at 03:21 GMT)   Resource Rating: 5
Take that fools...

edited for mercy...
Edited on Sep 20, 2008 03:27 GMT

Rubes   (Sep 20, 2008 at 04:24 GMT)
I saw it with my own eyes. It really exists! Great work, looking forward to playing around with it.

Henrysan   (Sep 20, 2008 at 04:32 GMT)
Great work!

Kenneth Holst   (Sep 20, 2008 at 07:11 GMT)   Resource Rating: 5
In the immortal words of Q*BERT : "@%!#!"

Terence Tan   (Sep 20, 2008 at 07:50 GMT)
Nooooooo!!!!....I'm am just in the middle of seriously changing some engine code as well with TGEA 1.7.2...

Hmmm. .if it's out in 3-4 weeks..i hope the Afx integration comes out in the next few weeks after...

I've been thinking that a better approach for writing stuff with Torque is to really keep all my changes in 'new' classes which are cloned from the default classes (i.e. Player et al)....So that when cool stuff like this happens, we can roll it in with a minimal level of fuss...

For me, a big problem is sometimes that base classes needs changes (i.e. like pulling energy out of ShapeBase and sticking it somewhere else..our items don't have energy!)...ho hummm..good thing I didn't do that today...i guess WinDiff is your best friend then....
Edited on Sep 20, 2008 07:53 GMT

Stephan (viKKing) Bondier   (Sep 20, 2008 at 08:23 GMT)
holy grail!!!!!
Thanks a lot guys! 8-))))))

Champagne for every one!

Guy Allard   (Sep 20, 2008 at 08:25 GMT)
Linux???

Christian S   (Sep 20, 2008 at 10:15 GMT)
Matt; Ive been around this place for app. 5 years and allways liked the engines, community and slappings enough to stick around to learn how to code so I can make 'something gamish'. Normally my opinion is that the raw engines combined with the community ressources is the real value of this place, but lately you guys at GG have made efforts to develop the 'old' tech that surely outshines what one would expect from the really small pile of greens one had to put out to get 'hands on'.

It might be that all this is 'your way of testing' the inns and outs of T2 (or whatEverItsNameWillBe) -but!

The ROI one gets from being here is incredible, and I really want to state how much I appriciate it. Thank you (folks@GG) so much for keeping the techs alive and handing back ROI that far exceeds what one could ever expect.

/CBLS

Guimo   (Sep 20, 2008 at 12:23 GMT)
Awesome!

Even when having Mac support is nice, for the the most important thing with this update are the enhancements on the shader pipeline. Stateblocks were a must have (werent they available first in DX9?) and shader variable handler query are a real improvement. You are just a small step from handling semantics.

Congratulations.

P.S.
Please dont flame me if I say I would love to see some improvements in TGE also. It is slowly dragging behind all the other versions.

@Guy - You have a really twisted sense of humor you know... :)

Taylor Petrick   (Sep 20, 2008 at 12:31 GMT)
Wow. I am so speechless. All hail.

Nicolas Buquet   (Sep 20, 2008 at 12:43 GMT)
Congratulations !

This is the end of an anxious wait !

What about performance on Mac ? Does it run on powerPC Mac ?

NIcolas Buquet
www.buquet-net.com/cv/

Mike Rowley   (Sep 20, 2008 at 13:30 GMT)
This is a major boost for TGEA. Congrats and can't wait to see it for myself. :-)

Quote:

Our goal is to provide TGEA owners with access to a Beta some time in the next 3-4 weeks. As always, this is only an estimate and shouldn't be taken as a hard and fast deadline.

ROTFL Right!! hahaha, you know better. It's in black and white now. LOL. (just ribbing you due to the fact that some, will inevitably take this time frame as hard coded fact.)

Konrad Kiss   (Sep 20, 2008 at 14:17 GMT)
Dang, just when I was becoming familiar with GFX.. :) j/k

I've honestly never would have thought that this would happen within 2-3 years. I'm not the ideal Mac fanboy, though I do work on a Mac, and I really like it. Overall, I am just really really really happy that my game will support both platforms now.

This is something I've given up when I chose TGEA for its enhanced gfx and faster rendering speed over TGE that had the option to publish on multiple platforms.

I wonder what the future holds for TGE now - is there still a reason not to switch to TGEA?

Congratulations to everyone involved in making this possible - and cheers to Michael, who still needs to write a truckload of docs. :)

Rubes   (Sep 20, 2008 at 15:43 GMT)
I can't speak for Matt, but I'll echo what he told me at AGDC: performance on the Mac is excellent, perhaps even faster than on the PC. And there should be something like a 2-3-fold speed boost from TGE, I believe. And no, it will not run on PowerPC Macs. Only Intel-based.

But obviously, Matt would be the better source for this info.

Gareth Fouche   (Sep 20, 2008 at 15:49 GMT)
Fantastic news!

Alex Scarborough   (Sep 20, 2008 at 15:58 GMT)
@Guimo: Actually, no. Stateblocks were first available, in D3D10. They do make a handy abstraction for us though which greatly simplified the D3D9 and GL GFX implementations.

@Nicolas, Rubes: Technically there's nothing stopping you from running it on PowerPC Macs. However, I never put any effort into supporting them because 1) It's a rapidly shrinking user base, and 2) Apple didn't update their PPC drivers for close to two years. If you're willing to put up with two years of unfixed bugs on 10.4 PPC then PPC support is certainly possible. I'm not sure what the situation is like on 10.5 PPC.

@Rubes: Performance is quite good on Macs. There are situations where performance can suffer though, e.g. OS X drivers don't deal well with running low on VRAM, and since the OS uses VRAM for the windowing system you have a fair bit less to work with from the get go. That particular point was driven home hard during the game ports. If you've got an asset heavy game you'll need to do a lot of optimization to support 128 MB cards on OS X.

Brian Richardson   (Sep 20, 2008 at 17:34 GMT)
Woot, cool to see this coming out! DX9 did have a stateblock object used to support their FX framework. But it wasn't core to DX9, so it was hard for them to implement them efficiently and I don't think it was widely used.

Alex Scarborough   (Sep 20, 2008 at 17:43 GMT)
@Brian: Really? Learn something new every day...

By the way folks, thank Brian for stateblocks and constant buffers. Wait till you see what else he's been working on.

Michael Hense   (Sep 20, 2008 at 17:54 GMT)
i'm just reading this!!! all i got to say is ALLLL RIIIGHT!!!!

--Mike

Szzg007   (Sep 21, 2008 at 16:55 GMT)
super cool ..I gayly expect TGEA1.8

Jaimi McEntire   (Sep 22, 2008 at 15:18 GMT)
Quote:

super cool ..I gayly expect TGEA1.8


Yeah, it's great. But I don't think what you said means what you think it means. :)

James Brad Barnette   (Sep 22, 2008 at 16:33 GMT)
rotl

DALO   (Sep 23, 2008 at 22:55 GMT)
Just a quick question, I have a game made in TGE that I'd like to port to TGEA 1.8. Would it be wise to start porting now to 1.7.1 to get the majority of it ready and assume that the conversion to 1.8 will be smooth? or should I wait till 1.8 is released?
Thx.

Matt Fairfax   (Sep 23, 2008 at 23:05 GMT)   Resource Rating: 5
It really depends on how much custom rendering code you've done.

If you have done custom rendering code (anything that talks to OpenGL directly), then if you convert to TGEA 1.7.1 you are going to have an additional overhead of converting that custom rendering code from TGEA 1.7.1 to TGEA 1.8. I would recommend waiting for TGEA 1.8 in that case.

If you haven't done much with rendering directly, then you should have a pretty smooth transition from TGEA 1.7.1 to TGEA 1.8 so there is no reason to not get started right now.

Kiyaku   (Sep 24, 2008 at 11:38 GMT)
A-W-E-S-O-M-E-!

My mac is screaming all the day of joyness :P
Edited on Sep 24, 2008 11:55 GMT

Ray Noolness Gebhardt   (Sep 25, 2008 at 16:07 GMT)
Very cool stuff. I can't wait to try it out on my Mac Pro.

Bartholomew IU   (Sep 29, 2008 at 06:38 GMT)
Just curious. Can I choose the OpenGL rendering in PC?

Marc Schaerer   (Oct 02, 2008 at 12:01 GMT)
Fantastic news :)

Finally high performance on both platforms (given that the user has a 3D card, not an Intel CPU to VGA/DVI adapter ^^). Great thing :)

Congrats

Nicolas Buquet   (Oct 09, 2008 at 10:00 GMT)
I can't register on instantAction.com.

After the registration form filled, my browser show me a blank page at https://login.instantaction.com/account/register

Tested with Safari and Camino, on my MacBook Pro on 10.5.4

Nicolas Buquet
www.buquet-net.com/cv/

Problem solved : I have registered. I accessed the registered page perhaps after a router reboot ?
Edited on Oct 10, 2008 11:41 GMT

Nicolas Buquet   (Oct 09, 2008 at 10:03 GMT)
2 questions about the TGEA plug-in :

will it be available for developer to distribute our applications via our own web hosting our to deploy on a customer-LAN/intranet ?

Will we be able to recompile the plug-in to merge engine changes we did ?

Nicolas Buquet
www.buquet-net.com/cv/

Clint Herron   (Oct 10, 2008 at 18:38 GMT)   Resource Rating: 5
Looks fantastic!!! Totally stoked about the Mac support!

--clint

DALO   (Oct 16, 2008 at 18:42 GMT)
I feel like a little kid counting the days down till Christmas when I ask this but any word/updates on the progress of TGEA 1.8 and a guesstimated time of arrival?

Deborah Marshall   (Oct 16, 2008 at 18:50 GMT)
DALO: We are looking at an open beta for all current TGEA owners very soon. If it doesn't come by the end of next week, Matt Fairfax will post an update blog telling you of the team's progress.

James Brad Barnette   (Oct 16, 2008 at 19:23 GMT)
awesome. can't wait especially now that I have a mac.

lol even thogh I have booted to OSX like 5 times total.

Matt Fairfax   (Oct 25, 2008 at 00:58 GMT)   Resource Rating: 5
Hey all,

We were really hoping to have a Beta release out to you guys this week and we got very close but I'm sad to say it isn't going to happen =(

We've got pretty much all of the major and minor rendering systems ported over to GFX2, however we have one critical bug and one blocking bug left. The critical bug has to do with incorrect lightmaps on Interiors and the blocking bug is a crash in the TerrainBlock when it loads in some of our demos on the Mac.

Hopefully we can get those fixed early next week but I have jury duty on Tuesday and that may delay things a slight bit.

If we haven't released the Beta by next Friday (hopefully that doesn't happen), I will jump back on here and give another status update.

Stephan (viKKing) Bondier   (Oct 25, 2008 at 06:26 GMT)
Thanks for keeping us updated. Very much appreciated. :)

John E. Nelson   (Nov 04, 2008 at 19:33 GMT)   Resource Rating: 5
I am looking forward to beta testing TGEA 1.8 on my Intel-based Mac.

Dave Young   (Nov 07, 2008 at 15:06 GMT)
Hey Matt, it's Friday after the Friday! How goes the good battle?

Taylor Petrick   (Nov 07, 2008 at 15:52 GMT)
I was gonna ask that too. :P

James Brad Barnette   (Nov 07, 2008 at 16:10 GMT)
???

Matt Fairfax   (Nov 07, 2008 at 19:37 GMT)   Resource Rating: 5
Hey guys,
I *just* got out of meeting about when to release the Beta =)

We had a little bit of a setback with me getting really sick and then losing a day to jury duty. However, I did spend this week getting together a build that I handed off to QA.

They came back with a few concerns mostly centered around the Mission Editor not being completely functional on the Mac and recommended that we take the time to remedy that before we release and I agreed with them.

I think the Beta will be more useful to you guys and will generate better bug reports for us if we can address a few more small details before it goes out.

I really appreciate you guys being patient with us =) It will definitely be worth it!

Stefan Lundmark   (Nov 07, 2008 at 19:59 GMT)
I think everyone appreciates the status updates, Matt. It's really cool to see how much has happened to TGEA that last year or so and I hope you guys take the time to make the next release stable, and if that means delaying, so be it!

Thanks again.

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