The post explains how the developer, Mark Brown, architected a scalable system for handling over 120 “perks” in his vocabulary roguelike, Word Play. The core thesis is that a modular inheritance‑based design in Unity can replace unwieldy if‑chains and enable easy addition, testing, and debugging of a large number of passive modifiers. Brown first describes the game’s three perk categories—gifts, upgrades, and modifiers—and focuses on score‑modifying perks such as “double score if the word starts and ends with the same letter.” He outlines the initial naïve approach of hard‑coding each perk as a conditional in a single script, noting its brittleness and maintenance problems.
To solve this, Brown introduces an abstract base class (ModifierClass) with virtual methods like OnWordScored. Each specific perk inherits from this base and overrides the relevant method, returning a modified score or –1 to indicate no effect. The main scoring script then iterates over the player’s owned modifiers, calling OnWordScored on each. This loop replaces the long chain of if‑statements and preserves execution order based on the modifier list. The same pattern extends to other game events (e.g., OnUpgradeUsed), demonstrating the system’s flexibility across gameplay mechanics.
The methodology relies on Unity’s component model and object‑oriented inheritance, allowing each perk to be a lightweight script that can be edited in the inspector. The result is a clean, maintainable architecture that supports more than 150 perks while keeping code modular and testable. The post concludes by highlighting the broader applicability of this pattern to other game systems, such as enemies or weapons.