New animation system is finally in

Improving the artwork in Warzone2100 - not for mod discussions
Per
Warzone 2100 Team Member
Warzone 2100 Team Member
Posts: 3780
Joined: 03 Aug 2006, 19:39

New animation system is finally in

Post by Per »

I just pushed the new animation system I've been working on for a while to git master, for inclusion in the next release.

From the lengthy commit message:
New mesh animation system

Scrapped the old crappy animation system because it made absolutely no sense and was horribly limiting. The new system is based on two mechanisms. The first is a new section in PIE files called ANIMOBJ that modify the position, rotation and scaling of frames for the given mesh level. The second is a new directive in PIE files called EVENT which tells the game to use a different model instead when the given event is triggered for the game object, such as burning and moving.

There used to be three animations systems in the game - texture coordinate flipping, key frames, and skeletal. Key frames are now merely expressed in terms of skeletal frames in which scaling for all but the key frame is set to a fixed -1000, which disables the frame entirely.

The reason that this information went into the PIE files is simply because it was easier. Making a new file format when there is current exactly two models with proper animation (supercyborg and oil derrick) made little sense. In the long run we should reconsider the whole PIE format.

Scaling now actually supported, in all three dimensions. It used to possible to specify in ANI files, but was never used. Each level can now have separate animation framerates and cycle counts (how many times to run an animation, zero for infinity).

Currently implemented for structures and droid bodies (which includes cyborg feet).

Currently supported animation event types: Movement, power generator active, firing, and dying. All units can now have a dying animation. However, babas no longer run around screaming before they die - this was just too hard to generalize (and was pretty much broken anyway).
I have started on documentation for the new system here:
https://github.com/Warzone2100/warzone2 ... n.markdown

Please let me know what is missing, and I'll add it. If there are any building-is-active animations you want me to enable, then that might be easy to do, as well.

Next I will focus on merging in Vincent's excellent graphics work.
Jorzi
Regular
Regular
Posts: 2063
Joined: 11 Apr 2010, 00:14

Re: New animation system is finally in

Post by Jorzi »

Looks promising, but what about rest pose, i.e. the ability to set the default transformation for model parts? I can work around this with blender, but it would make the data more human readable if parts could have the origin at their natural pivot point. Also, I could mirror the tracks without the need for an extra normal map. I guess this could be implemented as an "idle" event, which is enabled even as a structure is being built etc.
Also, will we be able to animate the weapons firing?
ImageImage
-insert deep philosophical statement here-
User avatar
MaNGusT
Art contributor
Posts: 1152
Joined: 22 Sep 2006, 10:31
Location: Russia

Re: New animation system is finally in

Post by MaNGusT »

Jorzi wrote:Also, will we be able to animate the weapons firing?
and propulsions.
Image
Per
Warzone 2100 Team Member
Warzone 2100 Team Member
Posts: 3780
Joined: 03 Aug 2006, 19:39

Re: New animation system is finally in

Post by Per »

Both weapons and propulsions can have animations now (you can actually have a 'weapons firing' animation on propulsions, too, if you like!). Just set the appropriate EVENTs for these models, and they will swap models when engaging in that activity. (However, if you set both weapons fire animation and movement animation for the same model, and the unit can move and fire at the same time, the result will not look so good.)

How would you like to specify the default transformation? I suppose it would be a rotation+translation line, similar to those of animations? Would it apply in addition to animation, or apply only in the no-animation state? I'm afraid I know very little about this stuff, but if you try to describe what you want in terms I'll understand, then I'll try to make it happen! :-)
User avatar
Tzeentch
Trained
Trained
Posts: 300
Joined: 14 Oct 2012, 14:24

Re: New animation system is finally in

Post by Tzeentch »

got any videos for a side by side comparison? That would be nice.
Per
Warzone 2100 Team Member
Warzone 2100 Team Member
Posts: 3780
Joined: 03 Aug 2006, 19:39

Re: New animation system is finally in

Post by Per »

Tzeentch wrote:got any videos for a side by side comparison? That would be nice.
Until someone takes advantage of the new animation abilities, it continues to look exactly like before.
Jorzi
Regular
Regular
Posts: 2063
Joined: 11 Apr 2010, 00:14

Re: New animation system is finally in

Post by Jorzi »

Per wrote:Both weapons and propulsions can have animations now (you can actually have a 'weapons firing' animation on propulsions, too, if you like!). Just set the appropriate EVENTs for these models, and they will swap models when engaging in that activity. (However, if you set both weapons fire animation and movement animation for the same model, and the unit can move and fire at the same time, the result will not look so good.)
Cool :) I really need to take a look at this once I have some breathing room.
Per wrote:How would you like to specify the default transformation? I suppose it would be a rotation+translation line, similar to those of animations? Would it apply in addition to animation, or apply only in the no-animation state? I'm afraid I know very little about this stuff, but if you try to describe what you want in terms I'll understand, then I'll try to make it happen! :-)
I think the simplest would be a "default" animation which plays anytime no other animation plays. If nothing is specified, the default anim would be a single frame infinite repeat of position 0, rotation 0 and scale 1. You could , for example, override it to make cyborgs rock back and forth slowly while standing, but mostly, I just want to make sure that stuff can have a transform even when it's not moving or doing something.

Even for static objects, being able to construct them from a bunch of parts (like a cluster of meshes) would be quite useful. Take for example a helicopter rotor.
It consists of 3 identical blades. If I merge them into one mesh I cannot duplicate texture coordinates, because the object space normals are different. However, with multiple pie levels, I can have 3 different object spaces, all using the same normals.
ImageImage
-insert deep philosophical statement here-
Per
Warzone 2100 Team Member
Warzone 2100 Team Member
Posts: 3780
Joined: 03 Aug 2006, 19:39

Re: New animation system is finally in

Post by Per »

Jorzi wrote:I think the simplest would be a "default" animation which plays anytime no other animation plays. If nothing is specified, the default anim would be a single frame infinite repeat of position 0, rotation 0 and scale 1. You could , for example, override it to make cyborgs rock back and forth slowly while standing, but mostly, I just want to make sure that stuff can have a transform even when it's not moving or doing something.
Ok, I have changed it to allow this now. If ANIMOBJ directive is used without any related EVENT, then that is the default animation for that model. Should work for droid components and structures. I have not pushed this change to git master yet, but I expect to do that soon. (Also fixed a crash with super cyborgs. Ooops.)
Per
Warzone 2100 Team Member
Warzone 2100 Team Member
Posts: 3780
Joined: 03 Aug 2006, 19:39

Re: New animation system is finally in

Post by Per »

Per wrote:I have not pushed this change to git master yet, but I expect to do that soon.
It has been pushed to master.
User avatar
MaNGusT
Art contributor
Posts: 1152
Joined: 22 Sep 2006, 10:31
Location: Russia

Re: New animation system is finally in

Post by MaNGusT »

Is it availble as nightly build?
Image
Per
Warzone 2100 Team Member
Warzone 2100 Team Member
Posts: 3780
Joined: 03 Aug 2006, 19:39

Re: New animation system is finally in

Post by Per »

Since the latest nightly is from yesterday, then yes.

http://buildbot.wz2100.net/files/ as usual.
Jorzi
Regular
Regular
Posts: 2063
Joined: 11 Apr 2010, 00:14

Re: New animation system is finally in

Post by Jorzi »

Some comments after trying to work with the new system:
-I see you still retain the units from the old system. I was hoping to get rid of the ridiculous units and scaling (and as usual, the axis definitions are inconsistent). I can see how this works for the time being, but I think now would be a good time to change it, since we need to convert all the animations anyway.
-The idea of a base pie object that references several animated pie objects seems quite nice and intuitive to work with.
-Please include units for all parameters in the documentation.
ImageImage
-insert deep philosophical statement here-
Per
Warzone 2100 Team Member
Warzone 2100 Team Member
Posts: 3780
Joined: 03 Aug 2006, 19:39

Re: New animation system is finally in

Post by Per »

I changed the scaling to 0.0 -> 1.0 for shrinking and > 1.0 for enlarging now.

I can change the other units (and the axis definitions), if you like. Any preferences as to how?
User avatar
MaNGusT
Art contributor
Posts: 1152
Joined: 22 Sep 2006, 10:31
Location: Russia

Re: New animation system is finally in

Post by MaNGusT »

I assume that +z should be up and xy should be right-handed insted of left-handed, afair.
Image
Jorzi
Regular
Regular
Posts: 2063
Joined: 11 Apr 2010, 00:14

Re: New animation system is finally in

Post by Jorzi »

I think the most logical for those who read the files would be to have angle in degrees and position in the same units as the pie definition itself (256 units per square).
This of course means that the values should be floats (maybe they are already?)

@Mangust: The .pie geometry definition uses y up, -z forward while connectors have z up and y forward.
ImageImage
-insert deep philosophical statement here-
Post Reply