Procedural Animation

TimeFrame

Time Frame is the most recent game I have been creating. In it the player finds himself inside a lab unaware of who he is and must escape. Gameplay is made challenging through both parkour and advanced movement mechanics combined with combat against unique Procedurally animated AI enemies and bosses. The player also has the ability to slow down when in a pinch, with access to guns, melee weapons and even a grappling hook.

Procedural Animation

One of the biggest challenges creating this game was learning and implementing the concept of procedural animation. I have long appreciated the work that goes into making procedural animation work and how much it can add to a games immersion and unique feel. Wikipedia: A procedural animation is a type of computer animation, used to automatically generate animation in real-time to allow for a more diverse series of actions than could otherwise be created using predefined animations.

Spiders

The spiders were one of the first enemy types I created for this game. And special as they were the first to utilise procedural animation. I pictured the lab crawling with mechanical spiders, moving wherever they please to try and prevent the player from escaping, which required me to tackle a few problems. After a lot of trial and error I had a spider that could walk on any surface somewhat realistically, with only some minor issues with steep inclines.

Snake 1st Attempt

After a successfully first attempt into procedural animation for the spiders, I decided to begin working on a more complicated enemy for the player. I pictured a snake that was able to traverse any landscape, have more than 1 head, each indepent in thinking to make it hard for the player to defeat. My first attempt at this worked somewhat well, however it was not very scalable for multiple heads, was quite CPU intensive due to having to use mathematical formulas to dictate certain movements (sin movements for each body, bezier methods for creating the necks of each head) and ultimately the more I worked on it the more it went away from the idea of "procedural animation". Here are a few screenshots and videos of the first attempt with explainations of what was learn't and what could be improved in the next iteration

Movement / Reaction to players movement

Good Bad
There is some serpantine like movement Reactions to change in position are quite sharp
Necks of each head stay well spaced Rotating messes with the "main body's" movement
Heads look in right direction of target Bodies collide with each other
Each body has force added to it's goal position, meaning it couldn't react to environment changes well

Attacking

Good Bad
Attacks have wind up and some environment reaction (getting stuck in the ground) Neck bodies seperate on attack which breaks the immersion.
Remaining bodies look good before attack Bodies after attack don't move
Heads are attacking at the same spot
No Randomisation in wind up position or landing position for heads

Coiling It was after implementing coiling where I realised I had strayed away from the "Procedural" in procedural animation, as I was now baking in mathematical formulas into certain maneuvers the snake would perform.

Snake 2nd Attempt

Learning a lot from my first attempt, I was ready to begin on my second iteration for this snake boss. I started from the basics and re-farmiliarised myself with all things Unity Joints. How they work, how chains can be setup, how forces can be applied to them to cause a realistic "snake-like movement" by tweaking spring values in unitys Configurable Joint component.

By moving away from the force approach for now, and trying to achieve a snake "chain of joints" that reacted to moving the head how I wanted first was the main priority. After some tweaking I managed to get the first serpentine-like movement from just manipulating the head. The hardest part about this was allowing the bodies to move with limited rotation whilst preventing them from getting too far from each other like in the first attempt.

Skinned I then skinned the chain of bodies to create a continous surface that more realistically resembled a snake.

Re-adding multiple heads and improved physics I then readded the ability for the snake to have multiple heads. As you can see the movement of the head now affects the rest of the system as well as the head itself to some degree. Basic sin wave forces were applied to the bodies as well to keep the 'S' shape when moving and stationary. This also allowed things like this to happen randomly to the player:

Interect shader In the previous iteration, the snake was able to be sliced and decapitated, the heads then regrew from where they were cut and I wanted to make this system look better this time round. I spent some time looking at shaders and came across some intersect shaders that I could adapt to support multiple hits by the players sword. The idea being once the snake had sustained enough hits (i.e. 3) then that head would meet the criteria to decapitate whilst also giving the player a visual indication that their attack landed.

Test on a sphere

On the snake itself

Procedural Animated tongue and rattlesnake-like tail I then spent some time perfecting some minute details for the snake such as random movement for the head, mouth, tongue and addition of a rattlesnake-like tail that uses joint physics to allow it to oscillate such like the real thing.

Current stage Since this stage, I have updated the graphics closer to what it will look like on release.

© 2022 Made by Jack Fisher