NokiMo
Megan Fox
Megan Fox

patreon


Switch Systems 101

So, Switches! No, not the Nintendo kind, I mean the light switch kind. They're cool! You take a humble, core system, like a Switch: https://pastebin.com/7gymtXak

... and throw just a little zazzle on there. Like maybe a depression switch. No, not the feeling. I mean the sort of switch you step on to depress, or the sort that clicks in when pressed: https://pastebin.com/YKfr4jfg

Now, you have a thing that can influence other things in generic fashion. What things, you might ask? I call those Logic. Say, a Damage Floor Logic that toggles off and on: https://pastebin.com/zf1fz6jV

If you looked closely at DepressionSwitch, you'll note it has no means of changing its state. That's by design. To CHANGE a Switch's state, you need what I call a Twiddler: https://pastebin.com/PMMNEgXD

Twiddlers are simple by design, and meant to be overridden to do more interesting things. Say, a twiddler that toggles things when you hit it: https://pastebin.com/GGRNkEg9

 ... though I mean, you could also make a Switch that toggles itself over time:  https://pastebin.com/Q12ULU2E - but that's kind of bad form. You'll find if you keep that logic in Twiddlers, it's more flexible. Like here's a Twiddler that auto-resets a switch after a timer expires. That COULD have been a TimedSwitch, but this way, I can point it at any sort of switch (depression, toggle, who knows): https://pastebin.com/KuucGuhk

Hopefully at this point, the gears are turning for you. By separating switches, twiddlers, and logic, the system just kind of... explodes, outward. It becomes really easy to make, say, a depression switch that clicks when you stand on it, OR, one that you punch to depress. Same code, just swap the twiddler. Want a depression switch that you can only punch on, but can't punch off (because you just punched it into the wall, why would punching it even harder do anything but push it further in)? Just set the twiddler to only be capable of going off to on. Tada!

This simple system is what powered almost everything in Hot Tin Roof. It's why we were able to do a bunch of puzzles that used consistent elements, but linked them up in different ways. You can add in NOT/AND/OR/XOR gates for your switch "signals", childed off switch, to merge switches into complex logic networks. You can create sequence systems that just toggle a line of switches off to on, one at a time, to make series challenges. It's super flexible.

Flexible enough, in fact, that I just yanked it out of Hot Tin Roof, and now it powers Spartan Fist too! Hooray! Though I admit, the Twiddlers were a refinement I added this time. Before, we just had Switches and Logics, which is why things like AutoSwitch exist. Trust me, though - you want Twiddlers as a separate concept. We're already discovering how much better that ends up working.

So, have fun!


Related Creators