We begin this development blog of Captureball with the further expansion of the prototype playground version of the game. Quite a lot of work has already been done on the design, adjusting, and game feel of the moment to moment gameplay. The character movement in this 3D dodgeball arena is a key thing to get just right and has been the main goal. Even with the largest amount of value tweaking it can still never feel exactly right without a little help from animations.
Even the basic very basic animations can help improve the various actions that can be performed by the player. As we can see above, our player characters are very stiff and locked into a Tpose position for all actions. Actions like catching, throwing, running, and jumping are all performed in the pose, but we are looking to start to implement a rudimentary animation system that can be fleshed out as other systems are.
To easily utilize the power of Unreal Engine’s animation abilities connecting the player character controller’s C++ class to an animation state machine blueprint seems to be the quickest way to go. The character and the animations are all prototypes pieced together and imported from Blender. These eventually will be updated and changed around so for the time being the rapid development of visual scripting in Unreal’s blueprints is a handy tool in these kinds of situations.
The core of the player animation starts here by creating a C++ class that inherits from the AnimInstance class. Here we are able to connect the PlayerCharacter class to the custom AnimInstance in order the read the the different player movement values and states. The variables like bIsJumping will be able to read from our new animation blueprint to get the correct pose corresponding to jumping.
On the blueprint grid we are now easily able to add the update animation function made in our C++ player character class which will make it easier to connect the code to the animations and blendspaces.
After creating the state machine the nodes of the states can be populated with the blendspaces made from the animations connected to the player. In the above example is the Idle/Run state where the animation will blended between two animated poses depending on the the move speed value connected from our player character’s C++ class! The connecting of animations and blendspaces to C++ fields will needed to be done in for each gameplay action the player can take.
This is the current state of our animation state machine, it will need to be expanded upon as development continues. The hardest part is trying to make sure all the transition states are well throughout and setup. With visualizing state machines it is easy to create a spaghettis monster, but with clever uses of blendspaces that may be a way to hopefully help avoid confusing graphs.
The basic Idle to Run aminations implemented allows for our character’s arm to get a little more relaxed. The transitions will be showcased in future development blog entries and there is still a lot more developments to do for Captureball. Overall this basic animation system setup will help us develop and expand upon the fun found in the heated moments of Captureball.