PDA

View Full Version : character animation



oldmanwinter
January 14th, 2008, 07:42 PM
in this game i'm working on, i'm about to spend some time on the animation process, and i'm not sure if the method i'm currently using is that good. i'll try to explain it, though it might be hard to follow... right now, my characters are made up of different movie clips (one for each body part) which are moved around for each animation (kind of like a 2D skeleton). for each animation/action my characters can do, i've placed the body part movieclips in an animation movieclip(one for standing, one for running, etc), and repositioned those body parts on each frame of the animation movieclip. each of these animation movieclips has it's own frame within the "character" movieclip. so basically i have my character movie clip, and on each frame of that is an animation movieclip, and on each frame of that there are my body part movie clips which are positioned for the animation (and there are different frames for each body part, depending on what the character is supposed to look like).

Damn, this is hard to explain, let me try to give an example. lets say i have a character with the instance name "ninja", and he starts running. This line of code: ninja.gotoAndStop(4) will execute, taking the character movie clip to frame four, which contains the "running" movieclip. the "running" movie clip consists of eight frames, which are cycled at a rate dependant on the running speed of the ninja. each of these frames has the body part movie clips which have been positioned to look like a running character (so on one frame the right leg is bent in front of the extended left leg, in another the left is bent in front of the right, etc). within each of these body part movie clips are different frames with different looks for that body part, via a line of code which says: this.gotoAndStop(_root.character_body[_parent._parent.number]). each character has a "number" variable, and i use an array called character_body to control what each character looks like. the character_body of my ninja is #4, and i've set the fourth frame of each body part to look like the body part of a ninja (the head has a mask and hood, the torso is covered in black cloth, etc).

so to get to the point, i want to know if this is an efficient way to animate my characters. i don't really know how flash works when it comes to rendering objects, and i don't know if my current method is efficient. I'm worried that maybe with all these movie clips constantly loading and reloading, things can get really slowed down if i have a lot of characters on the screen doing stuff. i was thinking of maybe writing a script that manually changes the x/y coordinates and rotation of each body part with each animation, so everything is only loaded once and then repeatedly repositioned from that point on. would this be more efficient, or does it not make any difference. if you've bothered to read this whole post, thank you, sorry it was so damn long! and if you don't understand what the hell it is that i've described, please ask for more details. thanks!

fw2803
January 15th, 2008, 09:56 AM
Do you mind uploading the Flash source file up here? You know... Sometimes, graphics are just better than words.

Pasquale
January 15th, 2008, 10:28 AM
Ew.. hand animate it instead.

randomagain
January 15th, 2008, 11:48 AM
Sound kind of standard, although my experience with timelines is iffy

start out simple then add stuff, sounds like your trying to get it perfect from go

ArmoredSandwich
January 15th, 2008, 01:02 PM
adding stuff isnt really the answer, you need to plan your game. Not just **** around. If I had planned my game I wouldn't had to rewrite more than 80% just because there is a better way. Yes, you gotta know how you should do that what you would like to plan and the only way to find out is **** around. Hmm.. tricky :P

It wont matter if you do it by code or the way you do know as you are still using the same amount of movieclips with the same amount of details. If you have a fps issue, use less details and movieclips, maybe cache em as bitmaps too. You might wanna change the movieclips u use as graphics to graphics as they are smaller, im not sure if its faster :S

I guess that no matter how you do it, itll always end up taking alot of time. Animating and stuff always does :s

Charleh
January 15th, 2008, 01:26 PM
Is the reason you are using this 'skeletal' system so that you can add different movieclips together to create different combinations of arms/legs etc?

If not I'd just hand animate it instead of bothering with this. It will just get messy

Marz
January 15th, 2008, 05:12 PM
I like this guy!

He actually is using a skeletal system. I think he might be using it to show growth and different sections of arms and legs. And like me, I suck at hand animation but can code animation like the best of them.

The reason for really doing a skeletal system is you can have 3 sets of arms, 20 sets of torsos, 50 faces and other common related stuff and it'll end up giving you over 1000 possibilities. Especially if you use it with a clothing system / armor system where you can see what you are wearing.

I understand what they are talking about.

oldmanwinter
January 16th, 2008, 06:39 PM
thanks for all the responses guys!


I like this guy!

He actually is using a skeletal system. I think he might be using it to show growth and different sections of arms and legs. And like me, I suck at hand animation but can code animation like the best of them.

The reason for really doing a skeletal system is you can have 3 sets of arms, 20 sets of torsos, 50 faces and other common related stuff and it'll end up giving you over 1000 possibilities. Especially if you use it with a clothing system / armor system where you can see what you are wearing.

I understand what they are talking about.

yep, that's exactly what i'm doing: my character is able to equip different sets of gloves, boots, armor, headgear, and weapons, and as characters vary in size their weapons are scaled to be constant (so if you hand some dude who's 2x your size a weapon, it'll be the same size in his hand that it is in yours), and parts of both weapons and armor can be set to be different colors (depending on the metal they're made of, like in Ultima Online if anyone has played that game). i've been trying to keep my body parts pretty simple, i use the subselection tool like crazy and use as few vector points (or whatever they're called) as possible. and yes, i blow when it comes to hand animation

i've been reading some of the posts in that big thread about MCs vs bitmaps, would it make a big difference if i replaced some of my body part movieclips with bitmaps? like if i have 8 instances of the same enemy in a level (same size and equipment, maybe different weapons), should i convert all of the animations for this character to bitmaps and then load those instead of the movieclips? and would i be able to have this done via actionscript, like when my level loads, i load my character movieclip doing every animation the enemies will use with the enemies body parts, have all these animation frames saved as bitmaps, and then unload these bitmaps when the player leaves that level?

Marz
January 16th, 2008, 10:09 PM
You can load up individual body parts in the same manner that you would say, load up a movie clip, but I have a feeling that you want to do something a tad bit different.

Depending on how big your character is or how in depth your character animations are going to be will be the answer to most of your questions however. I have a basic movieClip Skeleton that has smaller movieClips in it. and then even smaller ones in that. It allows things like. if your shoulder moves, your entire arm moves and if your forearm moves, your wrist and hands move. I've just been fine tuning it to work even better however.

Lou
January 17th, 2008, 02:56 PM
thanks for all the responses guys!
i've been reading some of the posts in that big thread about MCs vs bitmaps, would it make a big difference if i replaced some of my body part movieclips with bitmaps?

Personally I would keep them as MovieClips if you want to scale, rotate, or set their transparency. Doing that with bitmaps dips performance, especially if you have a bunch of bitmaps doing it.

To the best of my knowledge, that big thread talking about using bitmaps for games doesn't mean changing out some movieclip body parts for bitmaps. What they are doing there is changing every pixel on the screen into a giant bitmap instead of vector data (I think...).

http://www.kirupa.com/forum/showthread.php?t=276114