Visualscripting Animation System

6 weeks half time

For my specialization I wanted to focus on working with animation, using the nodeeditor in our engine. Since I have previous experience using the Snowdrop engine I already had a clear design in mind, however since our nodeditor was sort of designed after unreal engine, I had to do some more research into the other engines unreal / unity to see how they do things.

I quickly realised that the node editor we had, made it really difficult to make state-type nodes that you can step into. So i quickly pivoted away from using states and tried to make animation nodes that could execute animations using blends, adds and transitions.


Code snippet of our nodes.

These are the nodes that I decided we needed in order to use our nodesystem to execute scripts and switch animations. They are quite simple in their design and the "state" type nodes have a should exit bool so that we can control the flow in which order the "states" are executed. So in order to get the animationsystem to run our blended animations and/or added animations i had some code. Since we were using a component system, the animation component itself kept track of which state it was in by having a member variable that i change in the nodes. If its blending or adding, in this particular instance we cant both blend and add. That is something I would like to have added if I had more time.


This was the first node i created and we use it to switch between states very quickly. It has a loop functionality if we want to loop it and also if we want to wait for the entire animation to finish before exiting. This was basicly take our current pipeline which was trigger animations through code and expose it to the node editor so this was fairly simple.


My first attempt at adding animation. I just tried adding them together to see what happens. In this test i even removed the scaling because the whole thing grew into some giant blob. This was only adding the translation and rotation. I now realised its not that easy to just add, so I had to do some more research and found a very nice book. Hands on - C++ Game animation programming, so after skimming through i found out the problem. I have to subtract the base pose so i only get the delta,

I asked my animators for some simple test animations that were easily blendable to see if it worked, so this is just playing two different animations that affect different parts of the buffalo body. I tried adding other animations but since they were not created with adding in mind it was hard to tell if they worked in the beginning.


This is my blend node, which just takes two animations and blends them together using a value, in the image I didn't clamp the value, however i quickly realised this and added a clamp internally to the node.


This bone node took some time to get working, since I was not entirely sure how our mesh / bone pipeline was implemented. When I eventually found out it was fairly straightforward I just got the transform of the object itself and multiplied matrices in the correct order. My teacher said that there might be a framerate lag between the position of the cube and the hand. I think because we run our scripts between the position of the player and the actual draw the lag never happened.


Animation events, fairly straight forward. I find the frame I want the event to happen on and then exit through that event flow node once. I had alot of trouble with this node, trying to design it. Either i went for seconds or i went for frames. I ended up with frames because it gives more precision and also I had less bugs doing it this way.


Well straight away I ran into an issue, which was how to create an actual state node. One which I can traverse through the hierarchy, and also link different states together. It was something I never put time into researcher because of two main reasons.

1. I didn't want to mess too much with the script editor because we are using it for our game-engine and if I mess with it too much I might end up breaking the game blocking multiple disciplines.

2. I didn't feel confident enough even if I did dive into the node-editor to actually make a node state system that worked within the time frame and also have some functionality to show it off.

Another big issue I encountered once I started getting a lot of nodes up and running was to create an actual system that used them. It worked fine for our quite simple AI buffalo in the game. Exiting out of states and blending between them when the AI only had three states was fine but I struggled a lot to make good use of this system when I tried to apply it to our player since it has a lot more states to go between.


Looking on how to evolve this system is to look at my struggles. Evolving the system I would sit down and really create the state type of nodes that can be seen in Unreal or Unity. This way it would be a lot easier to manage larger systems. Creating a way to move through i hierarchy using states would also benefit the node system as well since it would be fairly simple to create grouping functionality.

I would like to also add a 2D blendstate node, this was something that was on my planning but I ran out of time.