New animation system is finally in

Improving the artwork in Warzone2100 - not for mod discussions

New animation system is finally in

Postby Per » 19 Oct 2016, 08:58

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.
Per
Warzone 2100 Team Member
Warzone 2100 Team Member
 
Posts: 3605
Joined: 03 Aug 2006, 19:39

Re: New animation system is finally in

Postby Jorzi » 20 Oct 2016, 08:30

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-
Jorzi
Regular
Regular
 
Posts: 1944
Joined: 11 Apr 2010, 00:14

Re: New animation system is finally in

Postby MaNGusT » 20 Oct 2016, 08:46

Jorzi wrote:Also, will we be able to animate the weapons firing?
and propulsions.
Image
User avatar
MaNGusT
Art contributor
 
Posts: 945
Joined: 22 Sep 2006, 10:31
Location: Polar region, Russia

Re: New animation system is finally in

Postby Per » 20 Oct 2016, 19:21

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! :-)
Per
Warzone 2100 Team Member
Warzone 2100 Team Member
 
Posts: 3605
Joined: 03 Aug 2006, 19:39

Re: New animation system is finally in

Postby Tzeentch » 20 Oct 2016, 20:43

got any videos for a side by side comparison? That would be nice.
More or less grey
User avatar
Tzeentch
Trained
Trained
 
Posts: 234
Joined: 14 Oct 2012, 14:24

Re: New animation system is finally in

Postby Per » 20 Oct 2016, 21:17

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.
Per
Warzone 2100 Team Member
Warzone 2100 Team Member
 
Posts: 3605
Joined: 03 Aug 2006, 19:39

Re: New animation system is finally in

Postby Jorzi » 21 Oct 2016, 00:50

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-
Jorzi
Regular
Regular
 
Posts: 1944
Joined: 11 Apr 2010, 00:14

Re: New animation system is finally in

Postby Per » 22 Oct 2016, 01:19

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: 3605
Joined: 03 Aug 2006, 19:39

Re: New animation system is finally in

Postby Per » 27 Oct 2016, 23:57

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.
Per
Warzone 2100 Team Member
Warzone 2100 Team Member
 
Posts: 3605
Joined: 03 Aug 2006, 19:39

Re: New animation system is finally in

Postby MaNGusT » 28 Oct 2016, 12:18

Is it availble as nightly build?
Image
User avatar
MaNGusT
Art contributor
 
Posts: 945
Joined: 22 Sep 2006, 10:31
Location: Polar region, Russia

Re: New animation system is finally in

Postby Per » 28 Oct 2016, 19:24

Since the latest nightly is from yesterday, then yes.

http://buildbot.wz2100.net/files/ as usual.
Per
Warzone 2100 Team Member
Warzone 2100 Team Member
 
Posts: 3605
Joined: 03 Aug 2006, 19:39

Re: New animation system is finally in

Postby Jorzi » 30 Oct 2016, 20:02

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-
Jorzi
Regular
Regular
 
Posts: 1944
Joined: 11 Apr 2010, 00:14

Re: New animation system is finally in

Postby Per » 04 Nov 2016, 22:20

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?
Per
Warzone 2100 Team Member
Warzone 2100 Team Member
 
Posts: 3605
Joined: 03 Aug 2006, 19:39

Re: New animation system is finally in

Postby MaNGusT » 05 Nov 2016, 09:12

I assume that +z should be up and xy should be right-handed insted of left-handed, afair.
Image
User avatar
MaNGusT
Art contributor
 
Posts: 945
Joined: 22 Sep 2006, 10:31
Location: Polar region, Russia

Re: New animation system is finally in

Postby Jorzi » 06 Nov 2016, 20:11

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-
Jorzi
Regular
Regular
 
Posts: 1944
Joined: 11 Apr 2010, 00:14

Next

Return to Artwork