Game Development Community

TGEA 1.8 on a Mac

by Matt Fairfax · 09/20/2008 (2:13 am) · 50 comments

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:


www.rustycode.com/matt/plan_09_19_08/TGEA_1_8_on_a_Mac.jpg
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.


www.rustycode.com/matt/plan_09_19_08/xcode.jpg
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.


www.rustycode.com/matt/plan_09_19_08/glsl_materials.jpg
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
Page«First 1 2 3 Next»
#41
11/07/2008 (3:06 pm)
Hey Matt, it's Friday after the Friday! How goes the good battle?
#42
11/07/2008 (3:52 pm)
I was gonna ask that too. :P
#44
11/07/2008 (7:37 pm)
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!
#45
11/07/2008 (7:59 pm)
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.
#46
12/09/2008 (6:33 am)
The wonderful reality of this is just sinking in--but I have a question--does this mean that the OPCODE/polysoup stuff builds on OSX as well?
#47
12/09/2008 (6:34 am)
@Lee: Yes it does, and yes, it works.
#48
12/09/2008 (6:49 am)
Woohoo! This is good news!

Have you heard of anyone trying to build on Linux? Even just the server?
#49
12/09/2008 (8:07 am)
I'm also interested in TGEA server on Linux!!!
#50
12/09/2008 (6:51 pm)
Hi. This great news. I for one have been looking forward to this. As a user that has started with TGE and then upgraded to TGEA. As i was a primary pc user but also purchased a intel mac. I like the idea of using my mac with TGEA and also using a lot of the content packs witch i have also purchased. Thank you.
Page«First 1 2 3 Next»