Posts

Classcade : A Pattern for Modular Controllers in Unity

Modular code with well-defined singular responsibilities is A Good Thing, and far better minds than mine are a Google search away to tell you why. However, in some situations, avoiding a monolothic block of code or a spaghetti of dependencies is a challenge.  For me, player-character control logic (PCL) always presents an architectural headache, especially in an evolving project. PCL seems to demand an awkward tangle of states and layers that all have a finger or two in each other's pies, and edge-cases abound. Modularity can seem like wasted effort, as everything ends up so project-specific that little can be reused. Rather than continue to try to force it into ill-fitting 'good' code patterns, I decided to embrace the need for PCL code to be aware of other systems and refocus. My new goals were: A super lightweight framework to nudge me in the right direction at all times Genuine modularity with arm's-length interactions, substitution, inheritance, ideally via interfa...

#1 The Flow System

The Flow System An object-oriented coding schema for game logic in memory-managed systems. Monologue (n): A long, tedious speech given by one person. This is the first in a series of monologues about various game-related coding tricks and techniques that I've blundered across over the past few years. They're intended to be thought-provoking rather than authoritative, and if you find any of them novel I expect a diligent enough search will yield articles more thorough and informative. Code snippets are not written in any particular language and are intended to illustrate, not compile. I'm starting with the Flow system, an embarrassingly simple idea that managed to elude me for over thirty years. As you already know, programming is the process of breaking a problem down until each piece can be solved with a line of code. But the fault-lines along which the problem of making a game naturally breaks down rarely correspond with the conceptual states as experienced by th...