Game Engine: Yet MORE Lessons

I currently don’t have an animation system in the engine.  This means that I can only rotate a single object (group of one or more models) about.  So now I’m curious as to what I should do. 

  1. Take the time to implement a decent Skeletal Animation system.  This can be considered overkill at this point, I think.
  2. Implement a custom animation system.  I will be developing custom tools at some point to leverage the custom content/formats I need so it makes sense to a certain point.  I don’t need something complex, just something really simple.

I’ve only started to think about this but the reason I cannot rotate individual models is the way I’ve architectured the engine, and I think I’ve done it right.  A Model, a set of meshes/vertices/triangles/normals/etc. has no concept of rotation or location…  it only has knowledge of the local location space, the offset of each mesh in the model, etc.  An object is a collection of Models and the only interface that can be used to render a model onto the screen is the DrawAll method in the RenderingManager (a component of every drawable object).

The RenderingManager only has one Location and Rotation variable.  Because I don’t have great modeling skills, putting a whole bunch of meshes together to form a single model is really annoying to me, and the fact that I have no animation system in place means I’ll have characters with arms and legs stretched out “running” all over the place.  The temporary (or permanent) solution was to add a collection of model offset vectors to the RenderingManager that would correspond to each loaded Model.  DrawAll will iterate through the list of models and call the Draw method with the newly added Location Offset argument and it will render a given model at an offset from a fixed location (for example, the origin of the object.  The interface to set these parameters isn’t very nice (you have to push stuff onto vectors from within the objects init function) but that can get better.  What I’m wondering now is if I should also add a Rotation offset, that is, a rotation variable that will affect the model around its local origin rather than the objects origin, or should I come up with some better strategy.

The benefits I see are that I can directly write an animation system that takes advantage of the location and rotation offsets.  The only downside I can think of right now is the amount of time it’ll take to create animations without a tool (which I guess is true with a skeletal animation system as well) and the pre-processing/speed and beauty of the final implementation.  Skeletal Animation has been around for awhile, and its tested and well supported now.

A key frame system has been around longer, is somewhat easier to produce I think, but more than one animation for a given model(s) can be monotonous as you don’t have that basic skeleton template to work with.  I shall have to do some more thinking.

Edit:  On another note, the model rendering system makes building a Particle generator as a single entity a lot more difficult if I plan on having the ability to add “distict” particle generators in a single entity.  IE.  Flames and smoke coming from a single object rather than two seperate emitters.  I will have to plan it all out so I don’t shoot myself in the foot…  again.

Advertisement


Leave a Reply

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

WordPress.com Logo

You are commenting using your WordPress.com 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

Follow

Get every new post delivered to your Inbox.