NokiMo
pilotsixtyone
pilotsixtyone

patreon


12/04 Devlog/Update

As challenging as it can be, spending time in Unreal and figuring out the best way to make things work is actually what I enjoy most about developing Project Joshi, more so than animating or designing characters. At least right now. I enjoy the challenge of avoiding repetitive code so I can do things once and just simply re-use it with slight alterations.

Here's an example: Because of how the branching system works, the Anim BP is going to require dozens and dozens of different animation states. Here's what my current AnimBP looks like as of this writing.

For those unaware of how the AnimGraph in Unreal works, basically each rectangle in the above image represents a 'state' . Each state has an animation inside of it that will loop indefinitely. This is useful for things such as idle animations. Since Project Joshi has a branching system, there's going to be a lot of these states.  In addition there needs to be at least two states for each move. For example, if one character performs a Vertical Suplex, there needs to be an animation for the character holding the opponent in the air, as well as another animation for the opponent suspended in the air.

Then comes in the transitional rules; the way to communicate to the AnimBP to tell it what the next state should be. How we tell the AnimBP that we want to transition from a Vertical Suplex to a Fireman's Carry. There's a few ways to do this, and initially I was using Animation Notifies.

Animation notifies (the yellow rectangles) are placed inside the timelines of animations and can then be used as events in the AnimBP, which you can then used to run whatever code you need to. I was using this to adjust booleans needed to update the AnimBP; basically saying "OK, it's now time to transition to something else". In order to transition from one state to another, a certain condition must be true. So when the animation played and the notify was called, that boolean condition was then set to true, and then the Anim BP would update.

This worked completely fine, however I had to make a boolean for every individual animation state. Not only that, but I also had to manually set every other boolean to false to make sure no other state was active. So I thought about it and decided to use a struct.

As you can see that alleviated the monotonous task of manually setting each boolean to false, and I all I had to do was set the appropriate boolean to transition to true.

However, doing this in tandem with the animation notifies led to...

Just lots of unsightly, elongated spam and duplication. It took up so much space and every time I updated the struct list, I had to check every single usage of the struct in the event graph to make sure the new booleans were included. Which of course just extend its length further and further. So I thought about it long and hard and finally after about a week I came to my current solution: Enums. Though I'd been fully aware of enums and have been frequently using them in the project I got fairly creative with how I used them here.

So firstly, I made the new enum, which is basically the exact same thing as the list of bools the struct has but it's an enum instead. I then added this to the data table of my move library.

The bottom two entries in the screenshot are what I'm using in the Anim BP for the transitional rules. I'll explain further in a bit.

So each character in the game has a component used for various types of information. Such information now includes this new Animation State enum. I'm getting the information from the movelist in the data table and passing it into the character component, but it doesn't end there. Now instead of using anim notifies, I'm using an animation state.

I made this handy function where I can get the information passed from the move list data table to the character component and send it straight to the AnimBP. And then from the AnimBP all I need to do is update the transitional rules like so:

So as long as a certain enum is active, the state can be transitioned into. In conclusion, my Anim BP event graph has gone from looking like this:

To this. Completely clean and empty. ๐Ÿค“

No duplicates, no spam, and I've created the code once so that I can just keep re-using it over and over.

If you made it this far you have my gratitude. Thank you very much.


Related Creators