Sign in to follow this  

C#/MDX animation

Recommended Posts

DvDmanDT    1941
Hi everyone. I'm working on a top-down 2d game/AI experiment platform, using C# and MDX. Top-down as in Ortho-something projection (orthographic? orthogonal?) from straigh above. Most things are great, my only problem is how to do character animation. First, I though about just using animated sprites, but I want equipped items to be visible (if you change armor, your appearance should change as well). This is possible using prerendered sprites, but that's kinda unflexible. Then I though about using different sprites for legs, body/arms and head, and just rendering them on top of eachother. This could definitly work, assuming I could come up with a way to create those animations. But then I came to think about crawling and/or dead bodies. That's when I started considering using full 3d models for my characters. That way, I could use ragdolls on hit for example, and each equippable item would only need one texture. My characters will be controlled by clicking on a target location for moving, and right-clicking on a location to fire in that direction. The player character will (should) aim towards the cursor, but he can move in another direction. How should I animate this? Graphics is a very small part of this game, so I don't want to spend weeks coding this, and I'd also preferr as CPU-cheap as possible. Any avaible (free) libraries or good articles? If you recommend 3d models, what format should I use? Are there C#/.NET/MDX libraries avaible? Can it handle the things I need? Is there any place where I can find models for this kind of thing (preferrably low-poly)? All comments, tips and suggestions are greatly appreciated!

Share this post

Link to post
Share on other sites
VizOne    598
You should probably go for skeletal animation. If you don't know what it is: you create your mesh as normal, but additionally you define a skeleton that describes the "bones" of your mesh. Each vertex of the mesh is then assigned to one (or multiple) bones. Whenever you change the pose of the skeleton, all vertices will follow the bones to which they are attached. If you define different poses and interpolate between them, you get a smooth animation. So far for the basics.

Now, if you rotate e.g. the spine bone(s) you can control the direction of the upper body independently of the direction of the waist and below. This would allow you to have your character walk in one direction and look/aim into another. Of course you'd want to constraint the maximum angle between upper body and waist. Walking forward while looking straight to the back isn't healthy in real life either :-)

Direct3D has built in support for animated meshes (look for ID3DXAnimationController etc.), so MDX should have it as well. BTW., you might want to replace MDX with SlimDX which is - unlike MDX - actively worked on.

Then again, skeletal animation isn't actually that difficult. There has been a great article which describes the code part quite well. There might be other good articles so feel free to google :-)

As a 3D modeller I use Blender which supports all the necessary stuff.

Btw. orthographic projection seems to be the correct term (but it's not orthography - which is spelling). Orthogonal projection is fine as well and synonym to orthographic projection AFAIK. Direct3D uses "orthographic projection".

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this