Interpolating animations with DAIN

Talk about the mods you'd like to see in Daggerfall Unity. Give mod creators some ideas!
User avatar
carademono
Posts: 210
Joined: Sat Jul 11, 2020 3:20 pm

Re: Interpolating animations with DAIN

Post by carademono »

Bumping this. It would be incredible to have smoothly animated NPCs and MOBs!

l3lessed
Posts: 1399
Joined: Mon Aug 12, 2019 4:32 pm
Contact:

Re: Interpolating animations with DAIN

Post by l3lessed »

I'm unsure about the billboard animations, but I can tell you the weapon animations code is in the weaponbasics script. Base game for weapons does 5 frames, including frame 0 and has a frame speed of 10. So, if I understand the original code properly, you should be able to create a 60fps animation then change the frames to 60 and the frame time to 1 to get 60fps.

However, as stated above, there isn't enough animation data as of last I knew to create 60fps animations from the current base 5. I asked and wanted to do this a long time ago before I gave up because no artist said it was worth the time and effort to create hundreds of frames. That is when I went for the hardcoded option of manually processing the position of each 5 frames and then aligning them properly to remove cutoffs from frame movement to get the best compromise I could using default sprites/assets.

Here's the explanation from the serialize object for the weapon animations

Code: Select all

    /// <summary>
    /// Defines animation setup for weapons.
    /// </summary>
    [Serializable]
    public struct WeaponAnimation
    {
        public int Record;                          // Index of this animation
        public int NumFrames;                       // Number of frames in this animation
        public int FramePerSecond;                  // Speed at which this animation plays
        public WeaponAlignment Alignment;           // Side of screen to align animation
        public float Offset;                        // Offset from edge of screen in 0-1 range, ignored for WeaponAlignment.Center
    }
Technically, a 3d artist could record a video of 3d weapon attacks, convert it to a 60 fps 2d sprite and add an alpha layer, and then import that as the new animation sprites and updated weaponBasics.cs. This would save the tedious task of hand drawning hundreds of spites, but would require time finding the 3d animations, recording them, and converting them.
My Daggerfall Mod Github: l3lessed DFU Mod Github

My Beth Mods: l3lessed Nexus Page

Daggerfall Unity mods: Combat Overhaul Mod

Enjoy the free work I'm doing? Consider lending your support.

User avatar
carademono
Posts: 210
Joined: Sat Jul 11, 2020 3:20 pm

Re: Interpolating animations with DAIN

Post by carademono »

No need for 60 fps, just having 10 or 15 would be a huge improvement, wouldn't it? But that might not be possible with such a low starting framerate.

l3lessed
Posts: 1399
Joined: Mon Aug 12, 2019 4:32 pm
Contact:

Re: Interpolating animations with DAIN

Post by l3lessed »

Well, smooth animations are largely done for my mod, and with a few more passes over the next few releases, I think my method would look as good or better than creating a 15 frame animation, but that is just an opinion. My method ensures it offsets the maximum amount of times it can in the short animation time to provide the most "frames" for smoothing as mathematically possible.

The one advantage of having more frames would be having more detailed animations for the melee, dagger, and flail weapons, as those are very complicated and show the 5 frame hopping a little more, even with animation smoothing code. However, my smoothing code would have to be completely rewritten to handle the new frames and their positions, and I refuse to go down that road again with another 10 frames. Again though, that is 10 frames times the number of weapon types there are for a total of over a hundred plus hand drawn frames from scratch; that's allot of work for any artist, let alone a free project.

Another thing to consider, at least for weapon animations, is they quickly get crazy fast if you go warrior build at all. A hi frame animation would be highly under utilized because their wouldn't even be enough frame time to render the full frames. Most attacks are under one second, and at 100 speed, they are insanely fast on screen; they are somwhere around .2 seconds. I plan on normalizing this a little more at some point, so weapon speeds are not so crazy unrealistic at high and low stat values.
My Daggerfall Mod Github: l3lessed DFU Mod Github

My Beth Mods: l3lessed Nexus Page

Daggerfall Unity mods: Combat Overhaul Mod

Enjoy the free work I'm doing? Consider lending your support.

User avatar
King of Worms
Posts: 4751
Joined: Mon Oct 17, 2016 11:18 pm
Location: Scourg Barrow (CZ)
Contact:

Re: Interpolating animations with DAIN

Post by King of Worms »

I really await the moment your project is ready :) Will it have all the parts in one package?
-smooth weapon animations, advanced hit detection
-shields
-weapon bob when walking

If I remember right, you will release it as a side version of DFU. So maybe after 1.0 release its time will come?

hfc2x
Posts: 25
Joined: Mon May 03, 2021 3:57 am

Re: Interpolating animations with DAIN

Post by hfc2x »

l3lessed wrote: Mon Apr 12, 2021 8:41 pm Technically, a 3d artist could record a video of 3d weapon attacks, convert it to a 60 fps 2d sprite and add an alpha layer, and then import that as the new animation sprites and updated weaponBasics.cs. This would save the tedious task of hand drawning hundreds of spites, but would require time finding the 3d animations, recording them, and converting them.
carademono wrote: Mon Apr 12, 2021 11:08 pm No need for 60 fps, just having 10 or 15 would be a huge improvement, wouldn't it? But that might not be possible with such a low starting framerate.
Correct. There's no need for sprite-based animations to be more than 30 fps. Sure, you can have 60 fps animations, but they look really uncanny when it's obvious they're not a 3D object, because how a 3D model tends to react in real time to changes in environmental lighting (or it's what we're normally used to seeing in most games anyways). 2D sprites are more static objects, that are meant to be a representation of an actual object, so our brains tend to have a different set of expectations for them.

You can check most 2D-based games (even fighting games, which run at 60 fps), and animators usually target 30 frames as a nice medium between fluid animations, and also "correctness" in style. What I mean by this is that 2D animation has been around for the longest time, and got its start at around 24 fps give or take, which has become the standard, so anything over that will immediately look extremely uncanny. Add to this that a lot of the time you see a 2D game running at a high framerate, the animations will likely never go over 30 fps because sprites are drawn by an artist, and they likely want to conserve their sanity. But the most important reason is because it's a stylistic choice; sprite-based games have been around for decades, and the amount games were going to render was limited by memory. Modern sprite-based games don't have memory limitations anymore, but they're aiming for the same style, which is already set in stone.

TL;DR: Just use 30 fps animations at maximum. They look extremely fluid, trust me lol.

l3lessed
Posts: 1399
Joined: Mon Aug 12, 2019 4:32 pm
Contact:

Re: Interpolating animations with DAIN

Post by l3lessed »

I'm up for 30 frame animations, but again, who is going to produce the 25 frames spread over all the weapon/sprite variations?
I really await the moment your project is ready :) Will it have all the parts in one package?
-smooth weapon animations, advanced hit detection
-shields
-weapon bob when walking

If I remember right, you will release it as a side version of DFU. So maybe after 1.0 release its time will come?
I'm very close, but I keep letting other projects side track me. Currently, I let the minimap suck up allot of coding hours that could of been used to finish 1.0 release.

1.0 release will have
  • shields with shield bash and timed blocking.
  • animation smoothing
  • Directional attacking using mouse yaw or movement direction or both.
  • hand bobbing when moving, which changes based on movement speed to look more real.
  • physical weapons (weapons cast an arc of rays to mimic the 3d space a weapon swing/sprite animation does)
  • recoil animations (If physical weapons is turned on, it will detect object collisions with the world and play a recoil animation on hitting something)
  • weapon parrying (can be activated or if timed right, your attack can block out/parry an enemy attack.
  • particle effects to create metal sparks on attack collisions and parry's so users can tell.
  • customizable movement modifiers for each weapon type and attack/sheath state
  • customizable attack speeds for each weapon.
Probably forgetting a few things.
My Daggerfall Mod Github: l3lessed DFU Mod Github

My Beth Mods: l3lessed Nexus Page

Daggerfall Unity mods: Combat Overhaul Mod

Enjoy the free work I'm doing? Consider lending your support.

User avatar
King of Worms
Posts: 4751
Joined: Mon Oct 17, 2016 11:18 pm
Location: Scourg Barrow (CZ)
Contact:

Re: Interpolating animations with DAIN

Post by King of Worms »

This will be so epic :)

User avatar
John Doom
Posts: 126
Joined: Wed Dec 01, 2021 5:59 pm
Location: Italy
Contact:

Re: Interpolating animations with DAIN

Post by John Doom »

:) I just did a test with "Flowframes", a similar program. Judge by yourself:
frames-8x-RIFE-RIFE3.1-8fps.gif
frames-8x-RIFE-RIFE3.1-8fps.gif (48.91 KiB) Viewed 1082 times
Attachments
frames-8x-RIFE-RIFE3.1-8fps.zip
(162.98 KiB) Downloaded 63 times

Post Reply