How do you animate your units?

How do you animate your units?

Share and discuss visual creations and creation practices like texturing, modelling and musing on the meaning of life.

Moderators: MR.D, Moderators

How do you animate your units?

I adapt existing COB/Lua scripts
18
55%
I draw the key frames on paper then hard code COB/Lua
3
9%
I code COB/Lua without drawing it
12
36%
I use Upspring's animation editor
0
No votes
I use an other animation software suite (Please specify)
0
No votes
 
Total votes: 33

User avatar
Beherith
Posts: 5145
Joined: 26 Oct 2007, 16:21

How do you animate your units?

Post by Beherith »

So Ive been thinking of getting into animating some units, but find the whole COB thing a nightmare. I would like to know if anyone has found a more streamlined/visual approach to animation.

I also am baffled by all the movements being at constant speed. I would very much like if I could use constant acceleration instead of constant speed. I believe it could offer much more realistic animations.

Also, Im in search of some kind of method to rig the models; in my words, it would mean that I loaded up the model in 3d, and maybe set each joints degree of freedom and movement limits, and if I push and pull a peice, it would move the peices. Kind of like if i dragged the left foot forward, it would also adjust calf and thigh positions to accomodate for that movement.

Please offer any advice/experience you have in this matter.
User avatar
Argh
Posts: 10920
Joined: 21 Feb 2005, 03:38

Re: How do you animate your units?

Post by Argh »

I animate by building the key frames in UpSpring, writing down all the numbers, then building the animation steps, then adjusting the timing via a constant. It's the easiest way, really- it rarely takes me more than an hour to do animations for simple stuff like a typical robot with walkcycle and firing animations.

You don't need to use constant speeds. What you need to do is to have constant time.

There's no rule saying that during a period of 1000, one rotation event can't take 700, another 300, for example. Using constant time means that you have a value that everything else is relative to, and lets you adjust timing for the whole sequence by changing just one number. If you want it to be faster, divide the constant in half, and now it's 350 / 150, for example.

Getting fancier than that is pretty expensive. The cheapest way to do true acceleration would probably be to build a series of move-now / sleeps and use smoothAnim interpolation, but I avoid it like the plague, because it's relatively expensive. Even fancier than that would be a ratcheted move-now that did true acceleration per gameframe with interpolation... you don't want to know how much that will cost, though. It's something you could use for a super-unit or a demo.

As for rigging, UpSpring is about as easy as you can get.

The rest of what you're talking about is building an IK system, and it'd just be a waste of time. If you build the keyframes, they're by-definition within your constraints; so your only trouble is if tweens go outside said contraints (happens frequently with double-twist rotations) and the only real cure for that is a tween key that fixes the issue (this happens all the time even in systems with IK btw).
Last edited by Argh on 28 Sep 2010, 10:19, edited 1 time in total.
Master-Athmos
Posts: 916
Joined: 27 Jun 2009, 01:32

Re: How do you animate your units?

Post by Master-Athmos »

I also fire up the model in Upspring, do the translations and rotations there and code those values into the script. In contrast to Argh I wouldn't call a walkcycle "simple stuff" and I especially object that this is the easiest way...

It's very hard to get a smooth and believable walk cycle. I spend most of the time looking at things ingame and then changing things as I see fit. That's why I think that there's a huge need for a WYSIWYG editor for animations where you immediately can play the "keyframes" you added in and are able to see if everything runs smooth and believable. The Blender export plugin might be such a solution but I have to admit I've never really tried it...
User avatar
Argh
Posts: 10920
Joined: 21 Feb 2005, 03:38

Re: How do you animate your units?

Post by Argh »

If you build animations with Lua, you can reload now, apparently, for testing in realtime.

But yes, compared to doing stuff with IK in a real editing suite, it's not fun.
Master-Athmos
Posts: 916
Joined: 27 Jun 2009, 01:32

Re: How do you animate your units?

Post by Master-Athmos »

Argh wrote:If you build animations with Lua, you can reload now, apparently, for testing in realtime.
Which is one of the biggest advantages over COB for me. It really saves a lot of time as you don't have to reload the mod...
User avatar
Beherith
Posts: 5145
Joined: 26 Oct 2007, 16:21

Re: How do you animate your units?

Post by Beherith »

What I meant by constant speed is that joints have infinite acceleration. I would be fine with constant acceleration. But I guess Ill look into the engine and see what I can do.

I think Ill try the blender export plugin. But blender is notoriously hard to use.
User avatar
zwzsg
Kernel Panic Co-Developer
Posts: 7049
Joined: 16 Nov 2004, 13:08

Re: How do you animate your units?

Post by zwzsg »

Master-Athmos wrote:
Argh wrote:If you build animations with Lua, you can reload now, apparently, for testing in realtime.
Which is one of the biggest advantages over COB for me. It really saves a lot of time as you don't have to reload the mod...
docs/cmds.txt wrote:/reloadcob <unit_name>
User avatar
rattle
Damned Developer
Posts: 8278
Joined: 01 Jun 2006, 13:15

Re: How do you animate your units?

Post by rattle »

reloading the cobs was kinda broken, some variables got messed up and stuff like that
User avatar
zwzsg
Kernel Panic Co-Developer
Posts: 7049
Joined: 16 Nov 2004, 13:08

Re: How do you animate your units?

Post by zwzsg »

Well, it works for me, but then I kept from TA the habit to initialize all my "static-var" in Create()
User avatar
Beherith
Posts: 5145
Joined: 26 Oct 2007, 16:21

Re: How do you animate your units?

Post by Beherith »

I apologize for the noobish question, but looking at the source didnt clear this up: Whats the difference between move and smoothmove?
User avatar
Masse
Damned Developer
Posts: 979
Joined: 15 Sep 2004, 18:56

Re: How do you animate your units?

Post by Masse »

Beherith wrote:I apologize for the noobish question, but looking at the source didnt clear this up: Whats the difference between move and smoothmove?
This is purely a guess, but I'm guessing smoothmove has acceleration and deceleration at the ends.
User avatar
zwzsg
Kernel Panic Co-Developer
Posts: 7049
Joined: 16 Nov 2004, 13:08

Re: How do you animate your units?

Post by zwzsg »

smoothmove let the engine interpolate a series of move/turn now separated by sleeps into a smooth movement, that is, move/turn with speed.

I dislike smoothmove because, as every dumb algorithm trying to guess and correct input that's bad in the first place, it fails on anything a bit complex.

If you realised there can be a "speed" after "move/turn", then you do not need smoothmove.
User avatar
Beherith
Posts: 5145
Joined: 26 Oct 2007, 16:21

Re: How do you animate your units?

Post by Beherith »

Thanks zwzsg! That cleared it up, but now im wondering how acceleration can be passed to a move command...

Code: Select all

void CUnitScript::TurnSmooth(int piece, int axis, float destination, int delta, int deltaTime)
{
	if (!PieceExists(piece)) {
		ShowScriptError("Invalid piecenumber");
		return;
	}

	AnimInfo *ai = FindAnim(ATurn, piece, axis);
	if (ai) {
		if (!ai->interpolated) {
			TurnNow(piece, axis, destination);
			return;
		}
	}

	// not sure the ClampRad() call is necessary here
	float cur = ClampRad(pieces[piece]->rot[axis]);
	float dist = streflop::fabsf(destination - cur);
	int timeFactor = (1000 * 1000) / (deltaTime * deltaTime);
	float speed = (dist * timeFactor) / delta;

	Turn(piece, axis, speed, destination, true);
}
Upon further inspection, it seems that both move and turn have acceleration parameters, but they are both passed as 0:

Code: Select all

void CUnitScript::Turn(int piece, int axis, float speed, float destination, bool interpolated)
{
	AddAnim(ATurn, piece, axis, speed, destination, 0, interpolated);
}


void CUnitScript::Move(int piece, int axis, float speed, float destination, bool interpolated)
{
	AddAnim(AMove, piece, axis, speed, destination, 0, interpolated);
}
User avatar
zwzsg
Kernel Panic Co-Developer
Posts: 7049
Joined: 16 Nov 2004, 13:08

Re: How do you animate your units?

Post by zwzsg »

Beherith wrote:im wondering how acceleration can be passed to a move command...
You can't!

You can only have acceleration in spin (and even, it only works sometimes).
User avatar
Licho
Zero-K Developer
Posts: 3803
Joined: 19 May 2006, 19:13

Re: How do you animate your units?

Post by Licho »

Wasnt there a branch with skeleton based animations? I think it was to be coded with lua with some high performance stuff done by engine (matrix operations).
User avatar
Beherith
Posts: 5145
Joined: 26 Oct 2007, 16:21

Re: How do you animate your units?

Post by Beherith »

So in essence, I would like the current constant speed infinite acceleration move to be replaceable with a varying speed constant acceleration move.Image
finite acceleration move.PNG
(8.01 KiB) Downloaded 3 times
User avatar
d-gun
Posts: 126
Joined: 03 Jan 2010, 18:32

Re: How do you animate your units?

Post by d-gun »

Licho wrote:Wasnt there a branch with skeleton based animations? I think it was to be coded with lua with some high performance stuff done by engine (matrix operations).
http://www.youtube.com/watch?v=JwL67-loGWU

posted in 2008
User avatar
Argh
Posts: 10920
Joined: 21 Feb 2005, 03:38

Re: How do you animate your units?

Post by Argh »

I would like the current constant speed infinite acceleration move to be replaceable with a varying speed constant acceleration move.
That may be possible with Lua as a new command. It's certainly not possible with BOS- if you want acceleration, you need to code it yourself.

I don't really think you want this, though- the cost of it will be rather high per Piece, as that's going to be the equivalent of a move --> speed command for every rotational Piece every gameframe. Faking it adequately with good keys is a lot easier and cheaper :-)
User avatar
AF
AI Developer
Posts: 20687
Joined: 14 Sep 2004, 11:32

Re: How do you animate your units?

Post by AF »

Nobody should be coding new units in BOS unless theyre copy pasting 95% of the code to save time
User avatar
Wartender
Conflict Terra Developer
Posts: 300
Joined: 17 Jan 2009, 22:37

Re: How do you animate your units?

Post by Wartender »

i really wish spring had an IK animation system :(
Post Reply

Return to “Art & Modelling”