.claude/skills/formula-module/SKILL.md
FormulaModule reference — ScriptableObject-based cost/effect formulas for idle games including polynomial, exponential, and milestone curves. Use when designing upgrade costs, scaling formulas, or progression curves.
npx skillsauth add punkfuncgames/tetris-clone formula-moduleInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Package: com.punkfuncgames.formula | Define: PUNKFUNC_FORMULA
Location: Packages/com.punkfuncgames.formula/Runtime/PunkFuncGames.Formula/
Namespace: PunkFuncGames.Formula
abstract BigDouble Calculate(BigDouble level) — compute value at levelabstract string GetDescription() — human-readable formula descriptionabstract string GetFormulaType() — type nameFormula: Base + (Level * Multiplier) or Base + (Level ^ Multiplier) if UseLevelAsExponent
Fields:
SerializableBigDouble BaseValueSerializableBigDouble MultiplierValuebool UseLevelAsExponentUse cases: Linear stat growth, simple level scaling
Formula: Base * (Multiplier ^ Level)
Fields:
SerializableBigDouble Basedouble Multiplierbool CapAtMaxValue, SerializableBigDouble MaxValueReturns Base for level <= 0. Respects optional cap.
Use cases: Standard idle game cost curves (e.g., cost = 10 * 1.15^level)
Formula: Base * (DynamicMultiplier ^ Level) with soft cap
Dynamic multiplier increases at milestone intervals.
Fields:
SerializableBigDouble BaseValuedouble BaseMultiplier — starting multiplierint MilestoneInterval — levels between milestonesdouble MilestoneMultiplierBonus — bonus per milestonebool MultiplyInsteadOfAdd — multiply vs add milestone bonusbool EnableSoftCap, int SoftCapStartLevel, double SoftCapPowerMethods:
double GetEffectiveMultiplier(BigDouble level) — multiplier at given levelint GetMilestoneCount(BigDouble level) — number of milestones reachedNested: MilestoneConfig(int level, double multiplierOverride, string description) for custom overrides
Use cases: Progressive difficulty curves, prestige cost scaling, milestone-based progression
// Create formulas as ScriptableObjects in editor, reference in code:
[SerializeField] private FormulaBaseConfig _upgradeCostFormula;
[SerializeField] private FormulaBaseConfig _upgradeEffectFormula;
// In IUpgradeDefinition implementation:
public sealed class MineUpgrade : IUpgradeDefinition
{
private readonly FormulaBaseConfig _costFormula;
private readonly FormulaBaseConfig _effectFormula;
public string Id => "Mine";
public string CurrencyId => "Gold";
public int MaxLevel => 0;
public MineUpgrade(FormulaBaseConfig costFormula, FormulaBaseConfig effectFormula)
{
_costFormula = costFormula;
_effectFormula = effectFormula;
}
public BigDouble GetCost(int level) => _costFormula.Calculate(new BigDouble(level));
public BigDouble GetEffect(int level) => _effectFormula.Calculate(new BigDouble(level));
public bool IsUnlocked() => true;
}
| Upgrade Type | Formula | Base | Multiplier | |-------------|---------|------|-----------| | Cheap clicker | SimpleExponential | 10 | 1.07 | | Standard generator | SimpleExponential | 100 | 1.15 | | Expensive unlock | SimpleExponential | 10000 | 1.5 | | Linear stat bonus | SimplePolynomial | 1 | 0.5 | | Prestige cost | MilestoneExponential | 1e6 | 1.2 (milestone every 10) |
development
WalletModule reference — currency management with BigDouble support, reactive properties, caps, lifetime stats, and persistence. Use when working with currencies, wallets, or financial systems.
development
UnlockConditionModule reference — composable unlock conditions using ScriptableObjects with AND/OR/NOT logic, stat/currency/upgrade/prestige/gamestate/boolean checks, reactive service layer with progress tracking. Use when implementing unlock systems, gating, or progression requirements.
development
UndoModule reference — command pattern with undo/redo stacks, command merging, and reactive state. Use when implementing undo/redo, undoable actions, or command patterns.
tools
Unity UI Toolkit reference — UXML documents, USS styling, MVVM pattern (ViewModel + Presenter), custom VisualElements, responsive layout, animations, performance guidelines, and complete Figma-to-UI-Toolkit property mapping. Use when building or modifying UI with UI Toolkit, creating UXML/USS files, writing ViewModels or Presenters, designing screens/panels/components, or converting Figma designs to UI Toolkit.