switchyard
state machine editor
As part of making cat.exe I built three separate, interrelated projects:
- Switchyard, a visual state machine editor inspired by owl-bt.
- Switchyard.CSharp, a C# runtime for the Switchyard-generated JSON state files that mimics the main application’s TypeScript eval engine.
- Switchyard.Generator, a C# source generator that emits typesafe state data from the Switchyard JSON file.
Switchyard itself is a visual state machine editor that allows users to author Finite State Machine graphs. For the cat game, I needed a way to declare different states the pet could be in, as well as trigger and loop animations based on input from the game.
Designing this all in code would have been onerous and messy, but instead having a visual way to compose states made it much faster. Switchyard supports subgraphs, event emission on state entry/exit, transition gates/state times, and more.
The goal with this is to get rid of as much boilerplate code as possible, and make sure that the code I wrote/write is all high-signal.

