The last month has been nothing but a constant crunch to polish and fix remaining issues. I never enjoy this part of the project no matter what it is I’m working on. But it does feel very satisfying when you see how many issues and fixes you’ve crossed off each day. I have a strong desire to refactor my code. I’m so glad I’m not working on a shared codebase. I’d feel embarrassed and ashamed to subject anyone to it. Crunches don’t yield the best code from me. But I put lots of comments to remind me to go back and do proper fixes later on. At least the bugs are resolved and my fixes do not affect performance.
This is sort of old stuff, I believe it was implemented all through the summer but I didn’t have time to mention it before. It’s one of those features that, once implemented, I regret not exploring earlier in development. I was working on adding a new enemy to the game and trying to figure out how to make this one different from the rest. It made me really look at the 6 enemies that were currently implemented and I realized apart from the attack animations, there was really nothing different about them. At least nothing from the point of view of the players. Sure their stats varied but it just made certain characters stronger or more aggressive. I realized adding a new character would just result in another clone so I decided to spend my time on trying to give the existing enemies more personality.
The result was adding the ability for characters to exist in different states. In code, I called these demeanors. And each state would have its own set of animations (idle, hit reaction, attacks). Enemies would transition to other states through a transitioning animation. These transitions are triggered either when their health has fallen below a specified value or when the player performs a specific counter after blocking all attacks. The coding requirements to implement this was fairly small but required a lot of small changes in many places. The animation requirements were huge in respect to my experience as an animator. I also wanted to create counter attacks that required specific opponent animations to play in sync. The animations alone probably took about 80% of the time. But I feel the end result was totally worth it.
In code, I assign each enemy type an alias. The first enemy to use these states was the Weasel. His default state is very calm and confident. He stands upright and keeps one hand behind his back. His second state is furious and he gets triggered into this state when his health drops a bit and you perform a counter code named “Forced Splits” as shown below.
The next enemy, Assassin, also has 2 states. His initial state is calm and a lot of his attacks will have him dropping a smoke bomb that replaces him with a piece of log and then he’ll reappear to try and hit you with sneak attacks. He has a very high chance of blocking all your normal free form attacks too. Once he’s weakened enough, you perform a counter where you grab the smoke bomb out of his hand and shove it in his mouth. The bomb explodes transitioning him into a weak state where he essentially becomes your punching bag.
The last enemy is the General. He’s the last enemy type you’ll encounter and has 3 states. He wears a gauntlet on his left arm that shoots lightning. These lightning attacks do massive damage and you can only dodge them, there is no counter. He transitions to his second state when you perform a counter that cause some damage to his gauntlet. This puts him into a furious state that changes all his attacks. He’s more aggressive in this state but is less likely to block. Another counter finally destroys his gauntlet puts him in a weakened state.
I’m really surprised by how well these changes went. The characters have more personality and it becomes a joy to watch as you break them down into their most vulnerable state. I wish I had time to implement states for the remaining characters and perhaps I will through updates. I will definitely explore this option for characters in future games.