Download

Sharing code between Anim Blueprints for similar characters

Are there good tips for how to create reusable modular anim blueprints.

Say I have like 10 different monsters that all need foot IK and locomotion state machines. The skeletons are likely to be drastically different between the monsters. Most will have similar humanoid structures but totally different proportions. Some will be completely off the wall different.

At the moment, the only way I can see to do this is to copy paste the nodes between each anim blueprint. I see anim blueprints extend from AnimInstance and I should in theory be able to extend anim blueprints from other anim blueprints. But the skeleton seems to be an issue. It seems like I can’t change the skeleton in a sub class. In fact, it makes more sense to not even have a skeleton in the base class itself. I just want some code that is reusable with instance variables for certain things, and groups of nodes for computing foot IK.

I could potentially create a C++ class that extends AnimInstance and give it some member variables but the Anim Graph itself is still hard to modularize and reuse between classes.

Maybe I can also use macros, but I somehow doubt macros work with Anim Graph. Haven’t really tried it yet, but there are state machines involved as well.

I have levels of state machines within state machines as well, so it can become nightmarish to try to recreate that for each new monster when the logic is always going to be essentially the same without it being modular.

Any more info on this?

I have similar problem, currently I need to recreate all the locomotions and graphs for multiple monsters which don’t share the same skeletons. Its becoming quite a huge pain.

I do use macros a lot since they are very handy here but still if you use variables and you don’t have the same parent animation blueprint since you cant, there is no correct class to set as base class for the macro library either.

Kind of curious how you guys solve this, as I can’t imagine having a game with 100 diffent characters with basically the same functionality.

Ditto this. Biggest pain.

What you might be able to do (haven’t tried it yet) is to create a macro library wherein each macro takes all the necessary parameter objects like montages etc. (this way it isn’t dependant on the anim graph). Macros are after all “expanded” when compiles so you end up as if you’ve copied your nodes to your AnimBP. In theory it should work; for the Event Graph at least.

I’d use the same skeletons as much as possible among your enemies. To share variables and logic between independent anim instances put logic in a component that references specific anim nodes. This would all have to be done in C++.