bg

Complexity of Critters

Dev Log #7

My hired artwork has shown me a number of areas I'd like to dial in. To this end I decided to prototype out enemy behaviors, skeleton rigging, inverse kinematics and animation to move some quick and dirty player and enemy rigs closer to their final assets.

I have a few issues with my first rig but integrating what I've got has taught me a lot for my next attempt.

First up I made a PSD of the character.
rabbit photoshop

Unity has a PSD import process so I save this file straight into the project where I add mesh geometry.
rabbit mesh

Then drop in some bones.
rabbit bones

Paint the bone influence weights onto the sprite meshes.
rabbit bone weights

And I've got a poseable character rig.

Editing each bone would be a nightmare. To make animating easier you next add inverse kinematic solvers which derive the position of a series of bones by trying to align with a target.

This is also how video games align characters feet with terrain. On the player character rig when I get to this stage I'll add in a bit of code that will automatically offset the IK feet targets to position them at the surface underfoot.

With all of the above finished it's not too difficult to jiggle the bones around until you've finished some convincing enough animations.

With animations ready to go all that remains is some behavior. The best practice seems to be creating visual behavior trees. These are visual tree state machines you can use to break down code into distinct units and transfer control through a tree of logic to make debugging and changing behavior simpler. Not easier mind you, hooo booy were these tricky for me to wrap my head around, just... simpler, in some ways. Much more complex in others.
rabbit behavior tree

In this rabbit routine I'm going through some checks, adding in some random chance, when spotting a predator the rabbit either freezes or retreats, then if the enemy has been successfully evaded returns to a wandering/eating routine.

And that's what it takes to make a pretty simple rabbit. I'll be ironing out some kinks and moving forward with enemies and a character rig. I'm both looking forward to and dreading the character rig. Hopefully I manage to get the IK solvers to get hands to align with held items and feet to adjust correctly to the ground. It sounds complex.

I've also worked out the basic electricity game loop enough to show off but I'll save that for another day.

Here's what debugging a rabbit looks like.

Next Star Over logo

© All Rights Reserved Next Star Over 2024