Tomato's Guns

Role: Lead Engineer

On Tomato's Guns, our main focus was to learn as much as we could about creating scalable game projects. Although prototyping is important, it doesn't teach you to utilize the patterns and practices that keep a project clean as it expands in scope and scale.

 

Player Movement

For the game, I coded the player movement using a sophisticated state machine setup.

The problem with many character controllers is that they tend to get bloated with physics special cases and interactions. I decided to split this complexity up into several 'states' that are stored in a variety of classes. There is a state for being grounded, a state for being airborne, a state for wall-running, etc.

The master Character Controller now becomes a clean, concise 'hub' that simply controls transitions between states and delegates out behaviors to them. I can essentially quarantine complex controller code into states.

Best of all, this system made debugging a dream because I could diagnose exactly what state was the culprit to my problems; after that, solving the issue was usually a piece of cake.

Below you can see the initialization function for my master state machine and some examples of code from the grounded and wall-running movement states.

 
 

©2020 by Sheehan Ahmed.