Jump to content
  • Advertisement
Sign in to follow this  
Ilarion

Animated scenes?

This topic is 3414 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi all, Sorry in advance if the following doesn't make sense... I'm trying to design a game that will have several scenes in them where the characters are doing different actions. From an imagination stand point, I can fully visualize what I want to happen. However, from a technical stand point, I don't quite understand how animations are handled in that case. From what I understand, animations for models are basically stored as part of the model. Jump, run, walk, idle, etc are just repeating key frames on the animation time line. However, how do you control a scene (or in-game movie)? Are you still calling on animations that are part of individual models? Or should there be a scene file that holds that information (especially if its an animation that only occurs in that specific scene)? How are cameras controlled during animated scenes? For instance, (and this only for example sake) if I wanted to recreate the opening scene of Metal Gear Solid 4. They have a low shaky camera, that looks like its being held by an actual cameraman and not on some type of A -> B track. They have multiple animations and effects occurring. I just like to get a sense on how that was accomplished. If there's any good reading material that you can point me to, it'd be very much appreciated. Thanks, .ilarion

Share this post


Link to post
Share on other sites
Advertisement
Hi there, thought id take a crack at your question since noone else has [smile]

- I presume that the animations for the characters are modeled in some 3d modelling application such as max, maya, blender, and so on. When you want to run the animated scene you would load these animations in and apply them to the appropriate mesh. It may be a good idea to model the whole scene in your 3d application so you dont have to worry about timing each meshes animations individually to fit in sync with the other models in the scene. I dont yet know how to animate meshes so it could be not as easy as ive made it sound.

- A scene file could be a good idea, i presume it would store the different meshes, animations, and the cameras A -> B points ( see below ). But in order to make something like that you would have to create a tool to write the files for you.

- As for the camera, have you every heard of Catmull Rom splines or Hermite splines? Direct3D provides functions to calculate splines given 2 points, 2 tangents and a "weight" ( the weight being a point on the spline to calculate the position of ). If you use these to create a path for your camera to follow, you would obviously get a smooth, curved transition from point A to point B and then C, D, E.. etc. Now, you've said you didnt want a direct translation from 1 point to another, so after calculating the position of the camera on the spline, you can then go on and adjust the cameras position to add an effect of some sort, like bumpy-ness. Im sure you can figure something out.

Anyways, thats what i would do in your position. [smile]
Sorry i couldnt give you a direct "how to" on what ive you've asked, to be honest ive never tried something like this and your question is little large.
~CC

PS: If your interested in knowing how to calculate your own Hermite or Catmull Rom splines ( for your own vector class if you have one ), i have the math written up already in my own vector classes ( 2, 3 and 4-D ) and have tested them against direct3D's versions. Just let me know if you want them and ill post them here.

Share this post


Link to post
Share on other sites
Thanks for the reply! It definitely helps me to understand a bit more of what I need to do.

Although I'm still unsure about how animations should be played out in a scene, you gave some good insight.

Thanks

Share this post


Link to post
Share on other sites
What you really want to do is to encode your animated scene onto a timeline of some kind. Saying precisely at what time, or other condition in more advanced system, some change in the scene takes place. A straightforward way (saying nothing about how practical or effecient it is) is to simply code it as a huge honking switch statement. In pseduoish-code:


Map entities; // Container of all updateable and renderable objects in the scene

for (int tick=0;tick<numberOfTicksInScene;tick++) {
time t1 = now();

switch(tick) {
case 0:
entities["actor_a"].setAnimation(WALK);
entities["actor_a"].setPath(someSpline);
break;
case 30:
Entity fx = createEntity(FLASHY_EFFECT, createPosition(10,20));
entities.add(fx, "effect_a");
break;
case 60:
entities["actor_a"].setAnimation(DEATH);
...
case 79:
...
default:
break;
}

for_each(Entity e in entities)
{
e.update();
e.draw();
}

time t2 = now();
sleep(33 - (t2 - t1)); // Static framerate of 30 fps
}




Obviously, that approach isn't very flexible. So instead you'd probably want to read from a scriptfile at what time every event should take place. This script file could in it's simplest form be a tab-separated textfile:


Time Action Actor Parameters
0 Animation actor_a WALK
0 Move actor_a (0,0);(10,0);(10,10);(20,10)
30 AddActor effect_a FLASHY_EFFECT, (10,20)
60 Animation actor_a DEATH
79



It could also be coded in a generic purpose scripting language such as Lua or Python, or maybe exported in a preexisting format directly from your modeling software.

Each of those approaches of course comes with their own problems. For the textbased method, you'd need to find a way to parse the file and convert the text strings into data types acceptable by your functions. The scripting language method would mean that you'd have to find a way to integrate the scripting engine into your code. The last option presented would likely have to deal with a complex proprietary file format.

This all being how I would approach the problem and by no means some standard method, if such a thing were to exist, but it might give you some idea to work from (provided that I interpreted your question correctly).

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!