May. 29, 2008 @ 23:36

I’ve not had a lot of free time this week but I’ve managed to make a bit more progress with my Max SMD importer. Mesh import seems to work fine and it now imports the materials and UV mapping too which is nice.

I did have one colossal panic when suddenly Max would start crashing when you tried to add a modifier to the mesh or when you actually exited. Lots of error messages about corrupt heap which is never good for your heart pressure. After much debugging it was down to an out of range index which wasn’t my fault. A rather vague description in the SDK docs had me putting the wrong value somewhere. Doh!

So Sunday afternoon I decided it was time to tackle the part I’d been dreading – importing the bones and animation into Max. There’s very little decent information on making bones in the Max SDK and I don’t know many people who’ve found it easy.

My first task was just to template out some code to actually just create a bone in 3DS Max. I think having my teeth pulled is less painful. To illustrate, lets imagine a conversation between MaxScript and I…

Me: Hello. I’d like to make a bone please.
MaxScript: Sure, here you go.
Me: Great! Can I move it over there?
MaxScript: No problem. *moves*
Me: And rotate it a little to the left?
MaxScript: Anything you want! *turns*
Me: Fantastic!

Now, lets re-enact that little scene as it went for most of Sunday afternoon between myself and the MaxSDK:

Me: Hello. I’d like to make a bone please.
MaxSDK: What sort of bone? *shifty eyes*
Me: Well you know. Regular bone in Max that you make skeletons with.
MaxSDK: Like a helper?
Me: Err I guess, if that’s what it is.
MaxSDK: Ok. *creates*
Me: That’s not a bone! It’s just an object!
MaxSDK: That’s what you asked for a helper object bone!
Me: No, I meant a blue normal bone in Max.
MaxSDK: Oh you want a geometric object derived bone.
Me: Err yeah, whatever. Just make one please.
MaxSDK: Well you’ll have to tell me it’s class and super class.
Me: What? How the hell do I know that? Don’t you?
MaxSDK: Oh yes, but I just like to hear it. *sniggers*
Me: Oh FFS. *looks in SDK docs* I can’t find anything about that class!
MaxSDK: Well try harder!
Me: A clue? Nothing’s coming up when I search for “bone” or “bones”.
MaxSDK: Maybe I put it somewhere else…

Later that same afternoon…

Me: Ha! Found it! Make me a bone please.
MaxSDK: Oh very well….
Me: Can you move it over there?
MaxSDK: If you wish.
Me: And turn it a bit?
MaxSDK: Ok.
Me: What the hell? Why did you move it again?
MaxSDK: I didn’t!
Me: Yes you did it’s over there now!
MaxSDK: Oh yeah. Well I decided to reset the translation component of the matrix.
Me: Why you do that?
MaxSDK:
Me: I f***ing hate you MaxSDK…
MaxSDK: What? Oh sorry I wasn’t listening, I was just over there eating some more memory.
Me: Sod this, I’m going to the pub…
MaxSDK: Can you get me some chips on the way back?

The above was then followed by two more hours of wondering why I wasn’t allowed to alter the appearance of the bone. Oh I’m sorry MaxSDK, you said when I made the bone you would make it as an Object. You didn’t tell me that you wanted to make ita SimpleObject2. See I thought a SimpleObject would be somewhat LESS than a normal Object but no, in fact it’s more. Well bugger me. You are a tease!

I think you understand my frustrations thus far.

Been a while since I made any posts about what I’m up to these days so I thought it was about time I did. Not that I made many before but anyway…

In what little free time I’ve had over the past three months I’ve been hitting the Ham and Jam code pretty hard, doing what feels like a huge amount of coding to try and nail all the bugs we found in our last play test. There’s still some small niggles but if the hlcoders mailing list is to be believed, their inherent SDK bugs and hard to fix and not likely to go away.

Anyway, of the new thing to add was the deploy system for weapons with a bi-pod which, after two false starts, actually works now. The process of doing the deployment and swapping animations wasn’t too hard – it’s just all the other crap you have to deal with like the logic to check if you should be allowed to deploy and limiting player movement, preventing weapon selection, etc.

TF2 Heavy imported into 3DS Max 9

Still, apart from the art asset side of things, game play wise Ham and Jam is really starting to come together and resemble a proper game now.

I’ve been working quite a bit with 3DS Max plug-ins over the past week too and finally found a couple of hours to do some more work on the SMD importer I’m writing for Max 9, 2008 and 2009. I made a bit of a breakthrough today in that I made the first successful test run of the mesh re-construction code and apart from a small few snags at first, it actually works!

TF2 Heavy imported into 3DS Max 9

This may not seem like a big deal, but when you consider how an SMD file stores data it’s actually pretty cool. SMD files store each polygon in your model as a separate un-joined triangle. The problem with importing data like that is you get a huge number of duplicate vertices and your polygons aren’t actually connected together. As a result, you can’t smooth them out or set the normals properly as anyone who’s tried to use the MaxScript importer will know. The code I wrote analyses the data coming in from the SMD and uses some logic to reconstruct the mesh as one continuous mesh rather than separate triangles.

Lastly, you’ll probably of noticed over the last month or so I updated all my VTF tools to support the 7.4 texture version which started shipping with the Orange Box games. It took a while to do, mainly due to VTFLib which they rely on being a bit out of date. Nem usually handles the releases and while the code was there, he’d got really busy and didn’t have a chance to get it out as quickly as usual. Still, not biggy, it’s done now so hopefully everything should handle EP2/TF2 textures just fine now.

That’s all for now. Back to work…

I made a small update to my SMD exporter plug-in to fix a bug in the batch mode that a user reported. While I was at it I used it as an opportunity to tidy a few bits of code up and port it to Max 2009 at the same time.

I’ve tested it with the 64-bit version of Max 2009 under Vista so I’m assuming it works under 32-bit fine. Naturally let me know if there’s are any problems.