Weekly Update – December 24, 2021

Happy Holidays everyone! With a few days off from work this week, I got a lot done! Many of the changes were visual, which always feels more productive. I primarily worked on combat game juice.

Combat game juice
  • Corpses. Slain enemies now leave corpses behind. This increases the player’s impact on the environment and will be used for a variety of mechanics including reanimating corpses, enemies reacting to corpses, and combat modifiers when fighting on a cell containing a corpse. I was pleasantly surprised to find that this feature didn’t require any code changes. It was implemented entirely in the Unity Editor using the custom trigger/effect framework developed earlier in this year.
  • Particle effect residue. Particle effects can now leave permanent residue, such as blood stains and bone fragments. Along with corpses, this is intended to increase the player’s feeling of leaving a mark on the environment. You can very clearly tell where battles took place and the size of those battles.
  • New walk and attack animations. After getting frustrated a couple of weeks ago by not being able to make a decent walk animation, I took some time to learn more about classic animation techniques. I applied the squash and stretch technique to walk and attack animations. I also added a slight pause to the beginning of attacks for anticipation. I got much better results this time around, due primarily to a more precise application of squash and stretch.
  • Replaced animation implementation. In researching Unity animation techniques I discovered Unity’s new 2D Animation package. This package provides a way to reuse animations with different sprites. Previously, I was using what I believe is the traditional methodology – for each animated game object prefab, create an animation override controller for the animation state machine, duplicate the animations referenced in the animation controller, and replace the sprites in the animations. This technique has major drawbacks: 1) it’s tedious 2) it generates a lot of redundancy. If I ever needed to change a common animation such as walking, I’d have to change every copy of the animation. The 2D Animation package provides a way to define an animation only once and swap out sprites based on the game object using the animation. This is done by adding a sprite library and sprite resolver component to each animated actor and configuring animations to reference the spriter renderer properties rather than the sprite directly.
  • Added a parent to all animated actor prefabs. This was suggested by /u/Notnasiul as a way to use relative positioning in animations and as a general good practice. It took around an hour to go through the existing actor prefabs, add a parent game object, and move the Sprite Renderer component to a child game object. And… it worked great!
  • Directional attack animations. With the capability to control relative game object position in the Unity animator, and trigger events in animations, I was able to remove the code that was previously responsible for this. This code was complicated. It updated the game object position on each Update() based on an easing function and managed time-based state changes for different points in the animation where events had to occur. I was glad to see it go.
  • Reconfigured my Unity Editor layout. Up until now I’ve been using the default Unity layout. This layout has been workable but not optimal. The project asset hierarchy panel isn’t large enough, the game object hierarchy panel is too large, and some tabs that need to be viewed concurrently (such as Animation and Scene) are by default in the same panel. I reorganized the panels to better suit the needs of this project. This is the end result.

Next week’s goal is to give level 1 the right amount of challenge. To do this, I’m going to tweak stats and drop frequencies for items and enemies. I want to finish the year with at least one good level. 🙂