- Inari is an action-platformer game being made by an interdisciplinary team of 13+ from Columbia College Chicago as our senior capstone project.
- You play as a mythical kitsune ninja, fighting to rid Japan of evil spirits.
- I am on the project as the lead programmer, focusing on gameplay programming.
In order to fulfill the player fantasy of being a ninja, Inari needs to be able to run, jump, wall jump, dash, attack on the ground and in the air, and many other actions. With such a wide array of actions, I thought the State Pattern was an obvious choice for his character controller.
Using my experience from previous projects, I wrote Inari's character controller to be a Finite State Machine. Each state can then have its own initialization and update logic, which makes dynamic movement and combat interactions simple to create and easy to maintain.
When programming, I try especially hard to follow the Don't Repeat Yourself Principle. I used this principle to guide my state machine logic. Any logic that gets repeated in multiple states, I made into a separate method that can easily be called multiple times. This makes the state machine code more readable and maintainable - for me, and my fellow developers.
While working on a long-term project like this, I've learned a lot of lessons. If I was writing this code again, I would refactor to make each state its own class. That would allow me to use inheritance and avoid repeating myself even more, and make the code much more readable and maintainable.
Attack combos and cancels:
In order to achieve the fluid combat design we want for Inari, we decided to give him many attacks and combat actions. We allow the player to freely cancel the recovery of most actions into other actions. For example, you can cancel most of Inari's attacks into a dash.
Inari has strings of attacks that he can do by hitting the attack button repeatedly. He has a different set of attacks in the air or on the ground.
To achieve this in code, I created a small class to contain data about each of Inari's attacks, and what actions he can do after each.
I wanted to try my hand at doing VFX, particles, and shaders work with Inari. This gave us a more polished feel, as well as letting my use my programming skills to make something pretty. I learned the Unity particles system as well as VFX graph and Shader graph.
I had to write special code to make my shaders apply to each part of Inari's skeletal puppet sprites, but from that, I created a very reusable system to apply shader materials to all of any puppet.