Procedural Animations vs Roblox Animations

Is using procedural animations less optimized than Roblox Animations? How about the default R15 animations?? Is one better than the other?

By procedural animations I mean editing the Transform/C0/C1 property through a script rather than playing an Animation created through the plugin.

1 Like

I personally prefer Roblox animations, because it’s less code and easier to work with.

1 Like

I think that the plugin is better, because ROBLOX usually has more efficient scripts

In my experience, there is basically no noticeable difference between the two performance-wise.

Using roblox animations is better for most cases because theres little code to do, but it really comes down to what you are using the animations for

if you are animating something like a planes propeller, i would just change the Transform or C0 to make it spin instead of using roblox animations because of how the speed will change while you are flying, and i have to turn the propeller according to that.

But, if you were animating something like a reload for a weapon, then i would use roblox animations because you can get much more detail in and it will look better than if it was just a list of cframes

1 Like

You didn’t answer the question I was asking.

1 Like

I might be wrong but if I was to guess, procedural animations would probably be more heavier on performance compared to roblox animations.

Think of it like this:

Procedural Animation: Having to calculate how the player will move/behave in different scenarios in many seconds while replicating it to others in a custom way while still having to do animations properly and smoothly.

Roblox Animations: Having an ID corrolate to some pre-made keyframes that are played whenever you want it to play with specific connections and thats about it. Should automatically replicate if you did it correctly.

Though it could honestly depend, it might be able to go the other way around actually.

Though if you want to do procedural animations, it might be more difficult if you don’t know what you’re doing.

Well at the end of the day they are still just setting the Transform/C0/C1 property right?

It depends on the use case.

Performance wise, as long as you’re doing the procedural animations correctly, there’s no noticable difference in performance.

I know because I’ve built an entire animation module using procedural animations. Script performance is basically the same.

3 Likes

I can second this, have also built an animation module with no differences (including replication).

If ROBLOX is using the same transform code under the hood, then the animations shouldn’t be more efficient, unless of course the code you write is messy and you don’t optimize anything. The animation is literally 1 line of code in a for loop, and if you use a module you will end up using tables, so good table management really decides whether you are writing an efficient animator or not.

But yeah, I haven’t seen any difference in performance and I think if you are a capable programmer, managing animations at a low level (procedural) allows for more control in how the animations play out.

1 Like

The differences in performance for setting Transform/C0/C1 properties are going to be negligible for the most part. IMO using either method because one might be more efficient isn’t the correct approach to animation, your use cases for animation is what’s important.

Unless you have really strong reasons why you wouldn’t want to use the Roblox animations then there really is no need to reinvent the wheel. By the time you rewrite most of the API that makes Roblox animations so strong (Auto replication, playback layering, multi track playback, playback weight and time modifying, play and stop blending, keyframe action system) you’re losing any performance gains a custom system might have had.

That being said if your animation isn’t based around static keyframes then Roblox animations probably aren’t the solution, or at least not fully. You can add your own IK or FK layers into your roblox animations by adjusting Transform/C0/C1 during playback, you can totally negate animations from playing on certain limbs, there are still a lot of options you can work with to make roblox animations work for most purposes.

I would recommend only ever using a full custom keyframe or procedural system if Roblox animations cannot achieve your desired result. Personally speaking I’ve only ever needed a custom system a handful of times. Roblox animations are surprisingly powerful if you take advantage of all they offer.

7 Likes

The reason why I’m thinking about my own animation system for characters is because I’m planning to animate the legs procedurally. However, I do want to swap back and forth between this and the default R15 animations.

I also want to animate certain limbs while keeping the default animations playing on other limbs. For example, procedural animation the arms and upper torso while keeping the legs moving like the default walking animations. Do you have any idea on how to do this?

In the animation editor you can “disable” limbs from animation playback, so if you wanted the legs to not be influenced by an eating animation you can turn them off and any animation playing under the eating animation will still show on the legs.

If you wanted to force a limb to not display its animation pose you can set the Motor6D objects to have an empty CFrame for a Transform value on RunService.Stepped.

You can play with animation weight too. If you wanted to have A walk animation play at “half” of it’s values you can give the walking track a weight of 0.5, if you wanted to have it not display at all a weight of 0, fully a weight of 1.

If you wanted to go as far as to make strafing animations with roblox animations you can use AdjustWeight to dictate which animation plays “ontop” of the others. If you we holding down W and D for instance you could play your forwards and right walking animations at a weight of ~0.5 to get them to blend together.

3 Likes

That’s pretty interesting, I had a hunch it was that afterall.

https://www.roblox.com/games/600987158/Glacier-Development?refPageId=4cdcfa25-7573-4345-baaf-08505433946b

In this place for example, when you have out a gun and moving it’s obviously using procedural animations through a script, editing the joints on a Renderstepped. The thing is when you hold down shift, the leg animations suddenly switch over to the default R15 animations. When you let go and still walking, it’s back to their custom procedural animation loop.

I was wondering how they did this. My gut instinct told me they were overriding that part of the default R15 animation by constantly setting Transform/C0/C1 to whatever they want.

That brings me to my next point. I want to do that for my own game, but wouldn’t this be considered a “hacky/unconventional” method??

1 Like

Not hacky at all, Transform was exposed so this kind of thing could work. I do a combo of this and some roblox animation weight blending in Apocalypse Rising 2 and I’ve gotten some really nice results.

The base layer movement animations are all roblox animations. When the player equips a firearm it sets the arm transforms to empty cframes and runs some procedural code to position the gun and arms.

1 Like

I have a question. Could I make animations for guns (holding, reloading, sprinting, etc) using the animation editor, then edit the shoulder C0 at runtime to make the arms (and thus the gun assuming the gun is welded to an arm) follow the mouse? Or will editing the shoulder C0 override any animations playing? I don’t want to completely set the C0 to a new value, just “add” to it if you will to change its orientation.

1 Like

Yes! C0 and C1 value sets won’t overwrite any Roblox animation sets. When roblox animations get applied to a Motor6D (by the client that called :Play() or by replication) they use the Transform property of Motor6D objects. Parts are oriented with a Motor6Ds C0, C1 and Transform factored as follows: Motor6D.Part1.CFrame = Motor6D.Part0.CFrame * Motor6D.C0 * Motor6D.Transform * Motor6D.C1:Inverse()

So if you animated all your holding, reloading, sprinting animations to face “forwards” and then edited the C0 of the Waist, Neck and Shoulder joints you’d be able to aim at at the mouse. For what it’s worth this is the kind of thing that inverse kinematics does better than roblox animations will. The arms in the video I posted use the same IK method from this tutorial when a firearm is equipped. The firearm gets positioned, then the arms reach for their grip positions on the firearm.

1 Like

So I could make the animations, then set the Shoulder C0 to something like CFrame.Angles(math.asin((mouse.Hit.p - mouse.Origin.p).unit.y), 0, 0) , and that will make the arms follow the mouse while retaining the holding animation (and other currently playing animations)? I tried your inverse kinematic demo and had the arms hold onto points specified on the gun, then rotated the gun to face the mouse, but it didn’t look that good because the shoulders did not rotate with the gun; they stayed oriented the same and the arms just tried to grab the points. Thinking back on it I could probably get my desired behavior by changing the shoulder C0 as I described above along with the IK solve. Thanks

Yea that’d work for making it vertically point to the mouse, you just might need a hard 90 degrees added is all.

In my IK example places and code example I preferred always having the hands reach to their goal positions. In some cases having the shoulders always be anchored in place might be more desirable and achieving that is just a matter of tweaking the return cases in the SolveIK() function.

1 Like

Thanks for the help.

So to wrap this up if I would procedurally animate the legs with my own custom loop (without the use of raycast) just a point moving in a circle to IK my leg to, it would not be any more or less optimized then if I were to make that cycle as an animation thru the Roblox animator plugin?

Kinda late but i would like to give an answer to this question. Procedural animations are hard coded animations using a keyframe and interpolating into that keyframe, Roblox animations are similar but have multiple keyframes and several other features that make it easier for animators to make animations. I’m mentioning this so that you can get an idea of what im about to say.

If you use procedural animations then what you could expect is much more smooth animation transition for example, Black magic 2 uses procedural animations to tilt the character depending on where it is moving, it also has another benefit in roblox, where you dont need to own the animations.

Roblox animations on the other hand are just as great but animations are much more stiff, if you get what i mean, but it is much more efficient in coding as it doesn’t require much code. It also has support of multiple keyframes though you can pull this off in procedural animations, it again is much more work to do.

Why not use both? If you ask me optimisation of procedural animation solely depends on how you implement it. You would find that if your planning to use one key frame use procedural animation. If your animation has multiple key frames use roblox animations, pretty simple solution.