Character Controller Using Layered FSM Model?

this post: How to Approach Designing a Complex Character Controller by user @TonyLi outlines a way to approach more complex character controllers by using what he references as Layered Finite State Machines. While I do understand the concepts he discusses(virtual controllers, FSM’s, interacting with an animator), I’m at a loss when it comes to designing a system that incorporates this layered system into the Unity component system.
I have tried a few approaches to this so far, which aren’t important enough to post the code, but I always run into issues. Does the community typically favor a layered system like this using inheritance chains between the layers or having the layers composed within each other?

In general, composition is favored over inheritance.

Layers let you separate concerns (e.g., separate the process of reading of input devices from the process of acting on input) and also separate levels of detail. Alex Champandard wrote a good article a few years back championing layered FSMs as a way to move beyond behavior trees. Unfortunately it was on his AIGameDev site, which he’s since shut down, and a quick search didn’t find any archived versions.

Layered FSMs are a good way to separate levels of logical detail. They’re essentially a simplification of hierarchical FSMs. They can be layered by priority, so for example a health FSM can be in the alive or dead state. The health FSM takes priority over a lower level FSM such as an high-level decision-making FSM (e.g., strategy), which in turn takes priority over an even lower level FSM (e.g., executing individual goals such as cover or patrol), which in turn takes priority over even lower level FSMs. Ultimately, at the bottom are your animation FSM(s), which can control your Mecanim FSM. The difference from a hierarchical FSM is that all of these FSMs run in parallel, with the higher level FSMs able to interrupt and redirect the layer below.

The nice thing about this is that each FSM can be very simple. The top-level health FSM might just have those two states: alive/dead. A very low level animation FSM might just worry about moving the legs, without caring about why it’s being told to move the legs in a certain way. So each FSM can focus only on its single responsibility. It also makes testing much easier because you can isolate and test individual FSMs for correct behavior.

Side note: The weak point of FSMs and behavior trees is that they can’t do planning. You must design all of their options at design time. They can’t make new strategies. If you need them to plan, look into planning systems such as hierarchical task network planners.