Maya Integration

Published November 13, 2007
Advertisement
Today's journal takes a look at the less-glamorous side of game development: tools and pipeline. If you've ever been tempted to integrate your game with a content authoring package (like Max or Maya) read on, and hopefully benefit from the totally unscalable way I tried to do it.

The first version of my Maya plugin was all about the geometry data. I spent most of my time just trying to pull out the triangles, bones and animation curves underneath the mesh, and spit out the XML objects my game need to reproduce them. This worked pretty well, and before long, I had my little cow running around. Well, running on the spot actually, because he didn't have any physics. So I added some more exporter code to look for a Maya rigidBody node, and map it's parameters across to my physics object. With the physics on, he fell really well - a little too well, because without any collidable meshes, he couldn't land on anything. So I added some blind data (Maya speak for custom parameters) to a Maya capsule mesh to flag it as "Custard Solid". A quick tweak of the exporter to look for this parameter, and now my little cow hit the ground ... and promptly fell over. Hmmm ... need another parameter to allow you to constrain the physical degrees of freedom passed to the solver: "Custard DegreesOfFreedom". Now he's running ... but only for a single frame - need to make the animation cycle. Add a quick "Custard Loop" parameter, update the exporter, etc.

This was a running battle - pretty much every new object I tried to create needed it's own extra attributes, or new values on old attributes, and a corresponding bit of magic exporter code to handle the attribute.

By last week, it got to the point that I couldn't remember all the magic parameters you needed to add to make things happen. And even opening old scenes that had been marked up with custom parameters didn't help - because the custom parameters were buried deep within the Maya object graph - it was nearly impossible to tell where data had been added. In short, it was utterly unscalable and really hard to maintain.

To replace this band-aid solution, I wanted a solution that would automatically expose any new parameter in the engine without me having to write any new Maya plugin code, I wanted the game information to be more organised and easier to find in the Maya scene, and I wanted it to be "self healing" - so that old Maya files would automatically load in and get any new parameters the game had added since the Maya file was created.

The solution I settled on (which I'm really happy with) was to embed game engine objects straight into Maya (using a Maya proxy node). This allows all the internal game objects and their parameters to be exposed in the Maya UI without me writing a single additional line of code. Then, rather than adding a tangle of isolated parameters to the Maya nodes, I can directly attach the actual game objects I want to use in the engine. So, for example, if you want a group of Maya shapes to be a rigid body in the game, you just select them all and attach a game physics object. You can then set any game physics parameter (like mass, axis locking, pushable flags, etc). If you want a mesh to be a gun, you just select the shapes, and attach a "Gun" object. You then get access to the rate of fire and any other parameters that gun might have.

Then at export time, I just find the list of game objects attached to any Maya node and attach them directly to the exported shapes.

Here's a game "Gun" object as it appears inside Maya:

Disabled


There are several big wins for me in doing it this way: it saves me having to write a custom editor to attach game behaviour to the model it allows all the character data to live in a single file (the Maya file), and it makes it much easier for me to let other people create game objects (as they can do everything straight from Maya). But the most satisfying bit is the stuff I didn't expect - like all of a sudden being able to change the fire rate of a gun, or turn gravity off, or precisely control which shapes are part of a given rigid body - all of which I get for free through the embedded objects.

Next entry, I'll show you the new toys that needed all this =)

Cheers!
Previous Entry Stable
Next Entry Mooving Parts
0 likes 0 comments

Comments

Nobody has left a comment. You can be the first!
You must log in to join the conversation.
Don't have a GameDev.net account? Sign up!
Profile
Author
Advertisement

Latest Entries

Moose Sighting

1394 views

Constraints

1563 views

Moose

1296 views

Melon Golf

1856 views

Toon

1359 views

Spaceships

1110 views

Rendering Pt2

1201 views

Hardware Shaders

1241 views
Advertisement