How do you efficiently manage skill animations for multiple classes in Godot 4?

Godot Version

4.4

Question

Hi everyone,

I’m currently developing an indie game using Godot 4, and I’m facing some challenges with managing skill animations. My game will have multiple character classes, and each class is expected to have a lot of unique skills, each with its own animation.

I’ve looked into using AnimationTree, but as far as I understand, it seems like I would need to set up all the transitions and animations for every single skill manually. This feels very inefficient, especially as the number of classes and skills grows.

I’m wondering how other developers are handling this situation.

Is there a more streamlined or data-driven way to manage a large number of skill animations?

Do you use AnimationTree for all skills, or do you combine it with AnimationPlayer and handle skill animations through code?

Are there best practices for organizing and playing skill animations dynamically, without having to manually set up every transition in the AnimationTree?

Any advice, examples, or insight into your workflow would be greatly appreciated!
Thank you!

I can’t really speak to when to use AnimationTree or AnimationPlayer; I tend to simply use AnimationTree but that might be because that’s what my use-case calls for.

As for my workflow. I don’t do any animation configuration or editing within the Godot Editor. I build all of my AnimationLibraries within gdscript based on data input. The efficiency I was able to gain by setting this up comes in the form of abstraction and taking advantage of safe assumptions for my project.

Let me give you an example of animating a 2D scene in 8-directions:

I define how many track keys (8) and what time-value they will occur at:

"KeyTimes": [
  0,
  0.05,
  0.1,
  0.15,
  0.2,
  0.25,
  0.3,
  0.35
]

Now I can define the to assign to those track keys.

"KeyValues": [
  {
    "Paths": [
      "HandR:position"
    ],
    "Values": [
      "Vector2(0, 0)",
      "Vector2(2, -1)",
      "Vector2(4, -2)",
      "Vector2(2, -1)",
      "Vector2(0, 0)",
      "Vector2(-2, -1)",
      "Vector2(-4, -2)",
      "Vector2(-2, -1)"
    ],
    "DirectionMul": [
      "Vector2(0, -1)",
      "Vector2(1, 1)",
      "Vector2(1, 1)",
      "Vector2(-1, 1)",
      "Vector2(0, -1)",
      "Vector2(-1, 1)",
      "Vector2(1, 1)",
      "Vector2(1, 1)"
    ],
    "DirectionAdd": [
      "Vector2(-34, 10)",
      "Vector2(-24, 5)",
      "Vector2(-10, 2)",
      "Vector2(24, 5)",
      "Vector2(34, 5)",
      "Vector2(24, 15)",
      "Vector2(-10, 18)",
      "Vector2(-24, 15)"
    ]
  }
]

The Paths are what nodes + properties I’ll be manipulating.

The Values are the “base value” is at each of the 8 key times.

The DirectionMul corresponds to the direction (there happens to also be 8 but it’s not correlated to the KeyTimes). The ordering is Down, DownLeft, Left, UpLeft, Up, UpRight, Right, DownRight. For every direction I am multipling the base value by the DirectionMul value.

The DirectionAdd is similar to DirectionMul except instead of multiplying it does a base value addition for each direction. This acts as an offset. As an example, when facing down the right-hand node will be offset by Vector2(-34, 10) and all of the y base values will be multiplied by -1. The left hand node would be the opposite.

1 Like

ty for ur help! was big helpful to me!!