Previous Blog Next Blog
Prev/Next Blog
by date

Restructure, Refactor, Rewrite, Re...

Restructure, Refactor, Rewrite, Re...
Name:Alex Scarborough
Date Posted:Dec 13, 2006
Rating:4.8 out of 5
Public:YES
Comments:YES
RSS Feed:GarageGames Blog feedor Subscribe with .
Profile Page:View profile page for Alex Scarborough

Blog post
Sorry, not many shiny pictures in this one.

End year two. It doesn't feel like it's been that long...

This is mostly a look back on how the past year has gone, and what I have planned for the (hopefully near) future.

So, first big thing of 2006: Dynamic Range Lighting

Wow, that was a fun resource to release. First a huge thanks to Jeff Raab (my usual partner in crime) for getting the windows version up and running. Next another huge thanks to John Kabus for working with us on the finishing touches, releasing it, and ensuring that we didn't accidentally hurt sales of any products (*cough* TLK *cough*).

In the ultimate irony, I did not own a copy of the TLK when the resource was released, and went a week without being able to access my own resource. Oops. So ya, just so you know John, I bought the TLK entirely to use the DRL resource.

Next action of 2006: Dynamic Range Lighting 2.0 Right, who saw that coming?

I also submitted an IOTD for this resource, which despite all logic actually went up. In addition, it had downloadable precompiled executables for Mac and Windows, and loads of happy documentation. It was more like a miniature free product release than a resource release. Only without as much QA, which lead to a couple of bug fixes that not everyone picked up on. All in all though, it went over pretty well.

And here I drop out of submitting resources. Sorry about that.

Not that I didn't write up some possible resources. I put together a GLSL version of the TGE water upgrade resource (which I believe is the most popular resource ever released, way to go Manoel!). Initially I wanted to break my work up into two resources. One resource would be a very simple integration of GLSL into TGE, making it easier for various objects to load GLSL shaders and generally being cleaner than previous shader integrations (read: I added a couple of dgl functions to load shaders), the other being GLSL water. Manoel believed that a GLSL integration should have lots of solid examples behind it, such as bumpmapped interiors, reflective water, and DRL.

I figured why not, and promptly moved all of the resources over to GLSL.

<insert quiet hush hush stuff I can't talk about>

Sadly the resource was never released.

However, I did work closesly with Jon Jorajuria, Alan James, and Ian Roach on adding these GLSL enhancements to their awesome games. Thanks guys for testing and abusing the code!

The Illumina demo marked the first time the GLSL work I had done was available to the general public in any form.

It sucked. My bad. I hadn't considered that people wouldn't have updated their drivers since 2004/5, nor had the code been extensively tested on cards which don't support shaders. Untested code is buggy code, and damn did it show.

I don't want to talk about that anymore.

Around the same time as the Illumina release I wrote up the OpenGL FAQ and Shader FAQ articles on TDN. Check out the OpenGL one! It got lots of love and includes tons of neat little tips on how to use spiffy OpenGL features like FBOs, VBOs, GLSL, and more!

Please ignore the shader one. It is unloved. Maybe you can give it some love.

Now about here I basically drop out of everything (as far as you know). I resurfaced once a month to post a .plan and, word to the wise, my .plans usually said nothing about how I was really spending my coding time.

Would you like to know what I've really been up to?

The last update of my GLSL code that went out to the few people I was working with was from June 28th. July 1st, I ripped out everything I had done and started over from scratch.

The GLSL code as of June 28th was modelled much like the existing Cg resources. Each object was responsible for tracking its own shader, etc. Happy fun with making sure they all loaded, that shaders were supported, and, best of all, ensuring that they were properly reloaded when our context was destroyed and a new one created. Clearly no way to handle shaders.

From this desire to keep shaders centralized I wrote a shader manager for Torque.
ShaderManager function list (well, half of it, give or take).

The shader manager uses a pure virtual class, Shader (aren't my names so imaginative) to handle all shader management, and all objects which use shaders also deal with the Shader class. Behind the scenes, there are actually four classes which implement shaders, GLSLShader, CGShader, ASMShader, and ATITShader. Each class handles a different kind of shader, and together they allow you to load crossplatform shaders on almost every programmable GPU, from the GeForce 3/Radeon 8500 up to the GeForce 7950/Radeon 1950 (sorry, no 4.0 shaders supported). In addition, as you may note, the shader manager allowed for setting global paramters, which applied to all shaders. What you can't see is that global parameters could be set from script, allowing for easy script control of shaders (yay!), and all global parameters could be saved into a .cs file which could be exec'd on launch to reload and initialize all global parameters (some of this was written entirely for the shader IDE I mentioned in my previous .plans).

But of course, shaders are only part of the equation.

Meet the Modernization Kit!

Remember that resource with spiffy GLSL stuff that I never released? Be glad I never released it. You're looking at the latest incarnation of where that has gone. I am currently going through and moving as much of the code as possible into separate files, and clearly marking all changes for easy merging.

Some things you can glean from that short little file list: Shaders, vertex buffers, a material system, DRL, and some sort of GLSL validation.

Shaders are essentially the shader manager described above, though it is currently being streamlined to work better with the material system.

Vertex buffer objects: They're vertex buffer objects. mkVBOManager.cc contains all the code which manages VBOs, allocates them as needed, and wraps using them.

DRL: DRL is being moved out of scenestate/scenegraph (WHY DID I EVER PUT IT THERE? WHY?!) and into its own class. Because DRL has virtually no reliance on anything Torque specific (getting window size is probably the most Torque specific thing it does), this class will be essentially drag and drop into any OpenGL based engine.

Materials: mkMaterial.cpp. At the moment, the material system is a very basic script interface that allows you to explicitly specify shader fallbacks. It also contains some early code for setting parameters in script on a per material basis, and loading shaders based on a user set shader quality level. It may be expanded to modify other portions of the current rendering state, but this is highly unlikely.

I'm restructuring, refactoring, and rewriting all of this old code, documenting it, expanding it, testing it.

Only one thing left to do when that's all done with.

See you all next month!


Recent Blog Posts
List:08/31/07 - Various musings
03/01/07 - Modernization Kit: Now on Windows!
01/31/07 - A couple of personal records
01/27/07 - Read a manual today!
01/04/07 - Old games and new tech
12/13/06 - Restructure, Refactor, Rewrite, Re...
11/10/06 - Just another month gone by
09/25/06 - Shiny pictures and upcoming resources

Submit ResourceSubmit your own resources!

Mathieu   (Dec 13, 2006 at 08:50 GMT)   Resource Rating: 5
Impressive.

Stephan (viKKing) Bondier   (Dec 13, 2006 at 09:34 GMT)
Still don't want to marry me Alex? I may request divorce from my wife for you... 8-P
Nah, okay, you would mind suffering sugircal operations, just to remove that beard, there can't be two bearded guys home. ;-)

Ok, enough insanity, time for a rant:
[rant]
Got damn Garage Games, why don't you want this guy to release his stuff? TGE-A killer? Do you really want Mac users to switch to another game engine like Unity, that has many many stuff TGE is missing and TGE-A will provide to Open GL in a not so close future.
Make it an option pack, and charge some bucks from it, but do something GG! this is a plea from the heart.
I like Torque, Garage Games and the community around, but OpenGL users need more support.
[/rant]

STef

Alex Scarborough   (Dec 13, 2006 at 15:46 GMT)
@Stephan:

You may have missed some subtle hinting in my .plan.

What is a word that would make you very very happy that starts with "re" that you do with software after thoroughly going over it?

I've got a couple of other words for you too. Free. Resource.

Think about it.

Stephan (viKKing) Bondier   (Dec 13, 2006 at 15:55 GMT)
@Alex.
Okay! I signed divorce papers... ;-)

re-lease? you are going to rent the code? right? (slam stef on the head - he doesn't like it)

8-)

I'm much more concerned about GLSL resource issues with GG in fact.

But you know what are my thoughts on your work.

Thanks.

STef

Alex Scarborough   (Dec 13, 2006 at 16:17 GMT)
Right, may as well spell this out.

Release. For free. As a resource. Because I've been talking with GG a lot over the past couple of months, this came up, they wouldn't really mind seeing it out there.

asmaloney (Andy)   (Dec 13, 2006 at 16:50 GMT)   Resource Rating: 5
Wow Alex. Just wow.

Rubes   (Dec 13, 2006 at 18:34 GMT)
^^ Yeah, what he said. My goodness.

Aaron e   (Dec 13, 2006 at 22:44 GMT)
Alex,

This sounds great. I'm crossing my fingers that this resource will also work for those with earlier versions of Torque (1.4.2 for example) and those without TLK.

Either way, keep up the great work. :)

Alan James   (Dec 13, 2006 at 23:36 GMT)
Looks great as always, Alex. Glad to see you're keeping busy. =)

Can't wait for the next "re".

- Alan

Alex Scarborough   (Dec 14, 2006 at 00:12 GMT)
@Andy, Rubes: It's a bit less wow when you consider that I've been working on this for five and a half months.

@Aaron: We'll see. I'm focussing on 1.5 at the moment though.

@Alan: When have I not been busy?

Alan James   (Dec 14, 2006 at 01:22 GMT)
I guess subtle humor is harder to convey in print. =P

asmaloney (Andy)   (Dec 14, 2006 at 01:44 GMT)   Resource Rating: 5
I meant wow as in - that's a hell of a lot of work to release as a resource for free - kind of wow...

Look forward to it!

Tony Richards   (Dec 14, 2006 at 01:50 GMT)   Resource Rating: 5
Quote:


@Aaron: We'll see. I'm focussing on 1.5 at the moment though.



Awesome... I can't wait to see the final resource.

Rubes   (Dec 14, 2006 at 04:05 GMT)
I could work on that for five and a half years and I wouldn't have gotten that far!

KevinG   (Jan 04, 2007 at 08:04 GMT)
C&C and that entire franchise rocks. There is a certain chess-like eligance to it, plus
massing 200-300 cheap-o units and storming an entire base is always fun/funny.
I just bought C&C Generals Delux Edition for around $10 at some closeout sale.
Best $10 i ever spent.

Oh ya, the rest of your post was cool too.
Impressive as always.

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