Skinning: Brief Version

So, continuing the epic saga of epic epicurry… mmm, Indian food…

With the Vegetation in place and in play, it was finally time to begin programming the creatures (ie. the most important element of the game). I am absolutely ready for this. There is nothing else I need to do, so this is where I get me some Object Orientated Programming: working out what sort of data structure hierarchy the Creature base class is going to need and extending it from there. Nothing can stop me now! I have totally not forgotten anything important! At all!

Some of these data structures are blatantly obvious, and the very first things I code into the Creature class: things like “position”, to tell the creature where in the world it is, and “model”, a 3d model which… will…

… oh.

Okay, so there might be something else I need to do first. [blows dust off of a copy of 3ds MAX]. I can’t really do anything testable with the Creature class if I don’t have a placeholder model to render in it’s place now can I?

Now if I was a sensible, professional programmer in an actual development studio, I would knock up a quick box and leave it at the alter at that, letting the actual artists do the modeling and animating and all the other things I officially suck at. But since I am neither sensible nor professional (and, as a side note, also somewhat lacking in the “actual development studio” department) I figured it would be better to actually set up a rigged torso model, complete with a (very basic) skeleton and with skinning. And, for once, I was right. Building non-skinned placeholder art would have been a massive waste of time.

For those not following, “skinning” and “skeletons” are technology usually used for 3D animation. The idea is that a 3D model can have a number of really simple bone objects placed inside it, and it’s geometry can be “skinned” onto the skeleton so that the geometry deforms when you move and rotate the bones. Now, I don’t actually need animation for the torso, but I do need to deform it. Creatures can have thick or thin shoulders, stomach and thighs, (all of which affect their stats) and three scalable bones inside the torso object allow me to do this easily.

To show you what I mean, here’s “Bob” and his skeleton. Bob is the very first creature I ever made: I cheated to make him, importing all the body part meshes I’d modeled by this stage (torso, 2 leg types and a tail) into one file and deforming them manually in ways the final engine would be able to do automatically.

However, right though I may have been in the long term to do the skinning straight up, in the short term it completely halted any further progress on the Creature class, forcing me to hack together a skinning system Frankenstein style from bits and pieces of (primarily) the XNA skinning tutorial, along with a few optimisations I’d made in other projects and an adaptation that allowed me to deform and animate at the same time. Ultimately it worked, but it took a while to figure out.

The advantage of this, though, is that by the time I got back to the Creature class, and was ready to start playing with randomly generated creature statistics and their interactions (like how leg sizes affect torso orientation and height, that sort of thing), I had completed, animated models I could import to the environment and use to simulate the very first protoCreature of the game. Ever. Of all time.

It's... ALIVE!

Finally, time to start programming creatures!


Thanks to technical difficulties, this post was not amusing. We apologise for this, and for any inconvenience this may cause. We were going to regale you with a picture of Cthulhu puppies, but thanks to other technical difficulties (y’know, real ones), that’s not happening either.

  1. #1 by Gravel on August 16, 2011 - 12:34 am

    D’awww. He’s so cute!

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: