Previous Blog Next Blog
Prev/Next Blog
by date

Forrest Gump Meets the Avatar of Virtue

Forrest Gump Meets the Avatar of Virtue
Name:Jay Barnson
Date Posted:Jun 30, 2006
Rating:4.3 out of 5
Public:YES
Comments:YES
RSS Feed:GarageGames Blog feedor Subscribe with .
Profile Page:View profile page for Jay Barnson

Blog post
The Avatar of Ultima VII now has a new party member...



Yeah, this is a silly bit of Forrest Gump-ery. Though I did a little bit more than just photoshop an image in (or manipilate Richard Nixon's lips). Those familiar with Evi's awesome work may recognize the character on the right.

As many horrible ideas do, it began with the question, "How Hard Would It Be...?" If you are an indie game developer, these questions could lead to many months of painstaking labor, so they are dangerous to ask. But I'd been wanting to play around with the full-release version of Torque Game Builder Pro, and I hadn't had a chance since my "first impression" review a month ago.

Maybe it was a little bit of Aveyond envy (a killer 2D RPG that's become a hit indie game). Or maybe too much sugar at the office. Probably the sugar. But I took some time out to play with this horrible idead and get it out of my system. The question was, "How hard would it be to create an Ultima 7 - style engine with 3D animated characters in TGB?" It's a question that will likely never be answered, but I wanted to get it out of my system. Finding myself with a few minutes before going to see "Superman Returns" (and a couple of hours afterwards), I threw together a new project in TGB to test out some ideas. I called it "Hackenslash 2" after one of my horrible ideas from last year - whipping out an RPG from scratch in only one week. Hey, you never know!

I used Exult and my old Ultima 7 games (yep, still got 'em, and proud of 'em!) to rip the graphics so I could try and get the 3D model to match the perspective of the Ultima VII games. I used Cubix Studio's female content pack (one of the BEST DEALS in indie gaming content packs BTW; I recommend it highly!) . I thought it would be fun to get the camo-clad lady running around in Brittania.

3D shapes are still missing a bit of functionality in TGB, but I still consider them to be one of the great strengths of the engine. They are also incredibly easy to use, and can be mixed freely with 2D imagery. My initial attempt to drop her into some Ultima 7 imagery didn't work well, because mere 3D rotations wouldn't do the trick. I could get her facing north just fine, but walking around never looked right. Part of the reason why is that the perspective in Ultima VII is not "perspective correct" - every object is displayed as if the camera was looking about a foot or two to the right of the center of EVERY object. Naturally, in a true 3D world, the camera is looking at only one spot at a time. It's very slightly M.C. Escher-esque, but that's always the case of 2D games trying to represent a 3D world with a simulation of angles.

So I had to force the 3D shapes to behave incorrectly. To do this, I recalled a little-used tool called a shear (or skew) matrix. I had to look up how to do it in Moller and Haines' excellent book, "Real-Time Rendering." It was trivial to set up the matrix, but I once again had to dig into the C++ source code under TGB's hood to add this functionality. So I have a "local projection" matrix added to the t2dShape3D object, which is disabled by default. I added console functions accessible via TorqueScript for enabling, rotating, and adding shear to this matrix. At render time, the object's true rotation matrix is multiplied by the local projection matrix and the result is concatenated to the rendering matrix chain.

The first time I tried it, the female character got twisted all over the place, because I'd multiplied the matrices in the wrong order. I do that ALL the time. It was the bane of my existance when I was working on Void War's engine. I try to pretend to be a genius coder and all that, but when it comes to 3D I really do tend to program by Braille. I keep a copy of Real-Time Rendering handy and just keep fiddling with things until they behave correctly.

By the end of the night (time that SHOULD have been spent working on Apocalypse Cow, if I'd had any sense at all), I had camo-girl running around looking like she belonged in Brittania circa 1991. Okay, so her animation was about 1000 times better, and she doesn't have the black outline (I could do that by doubling her poly count, but that wasn't the POINT). But I bet she could kick the Guardian's butt any day! Especially if I outfitted her with a magical M-16.... VAS CORP that, sucker!

So that's part 1 of what will likely be a 100-part engine if I move any further on it. Tiles of different sizes, layered tiles for different elevations, a seamless "full world," a conversation system, an inventory system, a quest system, combat, stats, massive game-state tracking... all fun, busy projects. Not to mention trying to produce REAL art assets instead of borrowing from one of the best PC RPGs of all time. But this was an amusing, nostalgic little diversion.

Jay Barnson
Rampant Games
Tales of the Rampant Coyote

Recent Blog Posts
List:04/30/08 - Frayed Knights Pilot Episode Now Available
03/28/08 - Frayed Knights - The Interview!
03/17/08 - The Future of Indie RPGs
02/27/08 - Frayed Knights, Late Nights
02/11/08 - Why Indie RPGs? Indies of the Round Table #1
01/30/08 - Frayed Knights: Beware the Priests of the Pus God!
12/31/07 - Frayed Knights Development - Frayed Nerves!
12/13/07 - Indie RPG News Roundup - December 13th

Submit ResourceSubmit your own resources!

David Montgomery-Blake   (Jun 30, 2006 at 15:51 GMT)
You know, I am suddenly very, very irritated that I hadn't thought of doing this first. But I'm also very, very glad that someone else did. Just seeing the screenshot got me all weepy and remeniscent of U7. Ah! It is still one of my favorite all-time RPG's ever.

But damn you for doing it first! (not that I had even thought about doing it, but it's one of those "hey that company just stole the game idea that I had in my head for the last ten years and told no one about so I'm going to be surly and complain" moments)

>:E

Grrr. I'm scary!

Jay Barnson   (Jun 30, 2006 at 16:05 GMT)
Bah, this isn't a game idea. It's just a clever hack. Well, not even that CLEVER, really, but saying that makes me feel better. It's fiddling with TGB to see what it's capable of doing with a little gentle persuasion. I'd have to say that the opportunity is still wide open :)

Ultima 7 really DID rock, didn't it? I am extremely grateful to the Exult team for making it possible to still play the game on modern hardware.

Saurabh Torne   (Jun 30, 2006 at 16:16 GMT)   Resource Rating: 3
perspective is not properly aligned but maybe you designed it like that on purpose

Jay Barnson   (Jun 30, 2006 at 16:30 GMT)
Okay, you caught me... this was an earlier picture when I was still playing with the matrices and hadn't gotten it EXACTLY right.

I can't guarantee I've got it exactly right in the final version, either. Though comparing it with hand-drawn art, I found it hard to get a perspective that was exactly right with every other character. What seemed to work in comparison to the Avatar was still a hair off compared to Iolo, or some other characters from some of the other art I pulled over.
Edited on Jun 30, 2006 16:30 GMT

Phil Carlisle   (Jun 30, 2006 at 16:56 GMT)
Couldny you use render to texture and just uniformly scale it up and write it as an outline mask...

Kidding.. nice idea.

Jay Barnson   (Jun 30, 2006 at 16:58 GMT)
Yer gonna make me go back and work on that, aren't you, Phil? :)

Chris Calef   (Jun 30, 2006 at 17:08 GMT)
Wow, I think you're the first person I've ever heard of who has an actual use for the shear row of the matrix! Always wished I could think up something to do with that. :-)
Nice work. Ultima rocked!

David Montgomery-Blake   (Jun 30, 2006 at 17:37 GMT)
Regardless of the cleverness of the hack, the coolness factor is maxed out. I have long been longing for a RPG that felt as expansive and complete as Ultima VII. But now that I've rediscovered Aveyond, I'll just have to buy it and play it instead (Doh! The purchasing page seems to have JSP errors! I'll have to pick it up later).

Timothy Aste   (Jun 30, 2006 at 18:02 GMT)   Resource Rating: 5
Man, I've been dying to take a crack at making a Ultima Online clone in TGB for awhile now. Great plan!

Prairie Games   (Jun 30, 2006 at 18:31 GMT)   Resource Rating: 5
Hey, that's really cool. I am personally dying to work with TGB. I didn't consider using 3d shapes with it. Nice plan!

Jay Barnson   (Jun 30, 2006 at 18:52 GMT)
Man, if only we had more TIME to do all the projects we wanna do!

Simon Love   (Jun 30, 2006 at 20:43 GMT)
Ahhh...ultima 7...pinnacle of my Gaming life...that game is so amazing, although it does look a bit aged by today's standards. Thanx for the memories!

Kevin Rogers   (Jun 30, 2006 at 21:11 GMT)
Very cool, Jay! =)
Quote:

but walking around never looked right. Part of the reason why is that the perspective in Ultima VII is not "perspective correct" - every object is displayed as if the camera was looking about a foot or two to the right of the center of EVERY object.

It seems like a straight-up orthographic projection would do the trick since that's effectively how the 2D graphics are being rendered....?
Edited on Jun 30, 2006 21:13 GMT

Jay Barnson   (Jun 30, 2006 at 22:48 GMT)
Kevin....

Dang it. I think you are right. I had never done an orthographic projection with 3D matrices before, and I made an assumption (and we all know about what happens when you assume) that it was done with rotations and shear. After you mentioned it, I looked up some information on it... and found some good info here:

www.codeguru.com/cpp/misc/misc/math/article.php/c10123__2/

I'm going to give it a shot over the weekend. Sounds like I'm getting dragged back into this bit of algorithmic doodling! And this is why this community rocks!

Kevin Rogers   (Jul 06, 2006 at 23:53 GMT)
Hey Jay,
Definitely a good resource! Although with OpenGL, of course you don't have to calculate the matrix for the projection yourself... glFrustum() or gluPerspective() are used to specify a perspective projection and glOrtho() and gluOrtho2D() are used to specify an orthographic projection.

See the OpenGL Programming Guide, Chapter 3 - Viewing for more details.

Have fun! =)

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