Complex animation logic

Imagine that I’m making a fighting game and I have lots of animated characters. Each character has standard moves such as punch and kick and then a few specialty moves. I’d like to express the available animations for a character indirectly. I also have lots of animations for the same move that are all not the same length.

Unfortunately I can’t find a way to do lots of complex logic in order to decide which animation should play.

  1. As a sample, in the animation graph, I can use a “Select from Int” node with many animation sequence nodes feeding into it and then I use an integer to select from them. This works. But the actual logic I need is the combination of five different variable and random numbers. Branching is not allowed in the Animation Graph. So I looked for something else.

  2. I explored the Montage feature and watched the youtube videos and maybe I’m looking too far into the example but it looks like it is for hard coded animations. The timeline is fixed. I’d like each section to represent a set of animations that I can select from based on complex logic such as which character it is, and various state. But it doesn’t look like it works that way.

  3. Today I saw that an an actual hard coded animation sequence has an optional pin that you can check so that the anim will take an Animation Base as an input. So I tried using the Event Graph with branch nodes and an animation variable with the type “Animation Base”. Think of it as a massive set of if-statements in the Event Graph that all set a variable that says which animation sequence to play. That failed. As soon as I changed the animation base reference while the animation sequence was playing, the whole engine crashed.

I expect that the most common animation use-cases will be handled easily but this has me on my fifth try ( I only showed three above). So what am I missing that makes this easier? I am a veteran C++ programmer but the C++ has it’s own complexities and what I’m doing should be very common across many users.

Again, what am I missing?

Scott

So assuming your characters are rigged properly I think there are various rigging animations you can perform.

For handling the state and which animations should kick next you probably want a state machine of some kind.

I’m not the best person to answer this but I would think that this is what you need to get going:

Thanks for the reply. I know about state machines and have many of them running. Let me ask a different way…
Imagine that I have thousands of animations and I need to select which one of them to play. I’m hoping that I don’t have to instance all 1000 animations into an animation blueprint and then use blending to decide which one(s) actually play. I need a more powerful mechanism to do the logic and then return which one to play. I’ll figure it out eventually.

Probably not instantiate the thousands of them, but as an animation is playing you can work out all the following possible animations that could be fired off from that state and instantiate only those. Keep a pool of them if you like. This is beyond my capabilities at this stage but that’s how I see it my head. HTH :slight_smile:

I just moved from 4.8.3 to 4.10.2 as an experiment. We have a feature that is tied to 4.8.3 so we have been behind. But my idea #3 above is working great as-is in 4.10.2. The crash had been in the C++ code that processes the Notifies and obviously it isn’t crashing there any more. I take this to mean that the developers finished the feature that I needed. This is a wonderful day.