Loading page...Загружаем страницу...正在加载页面...
AtlasRepo

How I Cleaned Up Limn Engine's Global Variables (and Fixed Two Bugs Along the Way)

Description and use

Moving Limn Engine globals into a single namespace TCJSgameVariable eliminated collisions, fixed a tile corruption bug after restarts, and resolved invisible particles on non‑default scenes.

Problem

Limn Engine used six global variables that caused collisions with game scripts, leading to rendering failures and hidden bugs.

Outcome

The refactor eliminated global variable collisions, fixed tile corruption after restarts, and resolved invisible particles on non‑default scenes, making the engine safer for community games.

Workflow

  • Create TCJSgameVariable object and move globals into it
  • Update all internal references to use TCJSgameVariable properties
  • Fix TileMap constructor to avoid mutating caller’s map array
  • Correct ParticleSystem to add particles to the correct scene
  • Simplify sound system by removing broken clone-on-overlap path

Evidence

Six globals, all sitting directly in the window's scope. Any script loaded on the same page could read them, overwrite them, or shadow them by accident.

Source

We created TCJSgameVariable as the home for every internal engine value.

Source

Fix a bug in TileMap that corrupted the level data after restart.

Source

  • Record date: 2026-10-03T05:41:00.510Z