DEV Community

Cover image for Praarabdha makes it more difficult gameplay.
Weird Codes
Weird Codes

Posted on • Originally published at weirdcodes.itch.io

Praarabdha makes it more difficult gameplay.

Devlog — commits 8fba4cc3 & 2cb9fee7

Date: 2026-08-14

Repo: weirdcodesofficial/MOKSHA — "An HTML5 browser game based on Sanatan Shastras and Karmic philosophy."

Primary languages: JavaScript (≈89%), CSS, HTML

View Video Clip here

Summary (high level)

  • Gameplay: praarabdha (accumulated karmic debt) now directly increases in-game speed (gati), making gameplay harder as praarabdha grows. The new formula is linear: 1 + this.praarabdha.
  • UI/UX: the "gatee" HUD now pulsing/glowing purple when praarabdha > 0; renderer draws a purple pulsing ring when praarabdha is active.
  • Internal: simplified praarabdha bookkeeping — older multiplicative snapshot logic removed in favor of a single penalty multiplier.
  • Risk: a naming inconsistency (typo) was introduced which can break initialization/reset behavior — needs quick fix.

Detailed changes by file / intent

src/engine.js

  • Removed older fields:
    • praarabdhaGatiModifier, _bhogGatiSnapshot
  • Added / used:
    • praarabdhaPenaltyMul (initialization) but code uses praarabdhaPenaltiMul (missing 'y') — naming inconsistency.
  • New penalty computation in main loop:
    • const praarabdhaPenaltiMul = 1 + this.praarabdha;
    • This multiplier scales:
    • samaya depletion
    • star and tunnel sparkle movement
    • maya movement speed
    • HUD warp display (gatee)
  • reset() updated to init the penalty variable.

src/karma.js

  • Death/rebirth handling simplified:
    • Instead of multiplying an accumulated gati modifier, it sets a penalty snapshot once:
    • if (prevPraarabdha === 0) { this.praarabdhaPenaltiMul = Math.max(0.01, this._currentGatiModifier); }
    • Ashuvha/shuvha karma reset and punarjanma increment remain.

src/render.js

  • Adds a purple pulsing ring / glow around gati indicator when praarabdha > 0.
  • Engine also sets gatee DOM color & text-shadow to purple when praarabdha active.

Behavioral / design notes & risks

  • Scaling change:
    • Previous implementation: exponential scaling with cap (approx. Math.pow(1.15, praarabdha) capped at ~3×).
    • New implementation: linear scaling 1 + praarabdha (no cap).
    • Risk: without a cap or sub-linear scaling, large praarabdha values can make gameplay unreasonably fast/hard.
    • Recommendation: consider adding a cap (e.g., Math.min( MAX_PENALTY, 1 + praarabdha * k )) or using sub-linear scaling (1 + Math.sqrt(praarabdha) * k).
  • Naming inconsistency (urgent):
    • Constructor/reset assigns this.praarabdhaPenaltyMul = 1.0; (with "y").
    • Later code and karma logic use this.praarabdhaPenaltiMul (missing "y") and local const praarabdhaPenaltiMul.
    • Consequence: the initial property may not be read by the runtime code, causing incorrect initialization or resets.
    • Action: unify the name across all files (praarabdhaPenaltyMul recommended) and update all references.

Quick checklist for testing & validation

  • Playtest with praarabdha values: 0, 1, 2, 5, 10:
    • Observe samaya depletion, star/sparkle movement, maya speed.
    • Verify the HUD "gatee" numeric value and purple glow behavior.
  • Boundary tests:
    • praarabdha = 0 → no purple glow, normal speeds.
    • praarabdha = 1..5 → check difficulty increase for fairness.
    • praarabdha ≥ 10 → confirm game remains playable; if not, add a cap.
  • Reset / rebirth flows:
    • Confirm penalty resets correctly on reset().
    • Confirm if (prevPraarabdha === 0) logic behaves as intended (is snapshot-only-on-first-praarabdha desired?).
  • Regression tests:
    • Smoke test render to ensure glow ring draws correctly and doesn't affect unrelated canvas state.
    • Unit/integration test for reset() ensure praarabdhaPenaltyMul === 1.0 after reset.

Suggested fixes / next steps

  1. Fix naming inconsistency
    • Choose one property name (suggestion: praarabdhaPenaltyMul) and replace all occurrences in:
      • src/engine.js
      • src/karma.js
      • any other files referencing the penalty
    • Add a small comment describing semantics and default.
  2. Re-evaluate scaling
    • Add a cap or softer curve, for example:
      • const praarabdhaPenalty = Math.min(MAX_PENALTY, 1 + this.praarabdha * K);
      • Or 1 + Math.sqrt(this.praarabdha) * K
    • Tune K and MAX_PENALTY by playtesting.
  3. Safety & tests
    • Add assertion or unit test: reset() sets penalty to 1.0.
    • Add a playtest checklist and short notes on acceptable difficulty boundaries.
  4. Optionally, propose a small PR:
    • Rename/cleanup property, add cap parameter, and include a short test or comments.

Changelog entry (short)

  • UX: praarabdha now increases game speed linearly, making gameplay harder with accumulated praarabdha.
  • UI: gati/gatee HUD now pulses purple while praarabdha is active.
  • Internal: simplified praarabdha bookkeeping (replaced multiplicative snapshot accumulation with single penalty multiplier).

Top comments (0)