Tower Defense Power Grid (relays, light beam, night)
/mechanic-tower-defense-power-grid
A GameSkill original: towers fire only while linked to the power source through relays, a fixed capacity is shared in a stable order so new towers never black out old ones, selling recomputes and reports a brownout, a movable light beam adds damage and slow, and at night towers need light to see far.
- License
- MIT
- By
- By GameSkill
Tested by GameSkill
39/39 checks passed on Canvas 2D in Chrome 156 headless (2026-10-28): trigger, a runnable example, a screenshot and self-check, one job per skill, and English + Chinese docs. Trigger checks match prompts against skill descriptions; they are not a live agent run.
Test reportGameSkill's tested copy
Written and tested by GameSkill for gameskill.dev. The ZIP holds the whole skill: SKILL.md and its Chinese version, scripts, a runnable example, tests, the self-check list and our test report.
A GameSkill original, released under MIT. The ZIP keeps LICENSE and CREDITS.md, which lists the workflow inspiration, the CC0 test assets and the third-party libraries with their licenses.

Self-check
- 卖掉中继后,下游的塔立刻停火,并提示断电 / Selling a relay stops the towers behind it at once and shows a brownout
- 新建的塔不会让已有的塔断电 / Building a new tower never switches off an existing one
- 塔不会把电转发给别的塔 / Towers never pass power on
- 光束的增伤和减速用同一个范围判断 / The beam's damage bonus and slow use the same in-spot test
- 夜里画面上看不见的敌人,塔也打不到 / At night, enemies you cannot see are enemies no tower can shoot
- npm test 和 npm run test:browser 都通过 / npm test and npm run test:browser pass
Install
Tell your AI
Install the skill from https://gameskill.dev/skills/mechanic-tower-defense-power-grid/install.md
GameSkill's tested copy
mkdir -p .claude/skills
curl -fsSL https://gameskill.dev/dl/skills/mechanic-tower-defense-power-grid.zip -o /tmp/gameskill-mechanic-tower-defense-power-grid.zip
unzip -oq /tmp/gameskill-mechanic-tower-defense-power-grid.zip -d .claude/skills
rm /tmp/gameskill-mechanic-tower-defense-power-grid.zipWhat you get
- Harbor Lamp: a 16x9 Canvas 2D board with a lighthouse, relays, three tower types, tap and keyboard controls
- src/logic.js: link ranges, BFS from the source, stable capacity allocation, recompute with lost and gained lists
- A light beam that moves at a capped speed and gives +25% damage and 15% slow inside its spot
- Night sight: 70% of tower range unless the enemy is lit by the beam, the source or a powered relay
- 14 Node tests (including whole-wave fights) and an 11-check headless Chrome test
Good fit
- Tower defense games with power, energy, pylons or relays
- Night waves, lighting and spotlight mechanics
- Fixing towers that switch on and off when unrelated things are built
Not for
- Paths, wave design and targeting modes on their own (see tower-defense)
- Electrical simulation with voltage, losses or flow
Try this prompt
Add a power grid to my tower defense: towers need to be connected to the generator through pylons, power is limited, and selling a pylon should cut the towers behind it.About this skill
A GameSkill original, written and tested for gameskill.dev under MIT. The demo, Harbor Lamp: a lighthouse powers towers through relays on a 16×9 board, with a steerable beam for night waves. All rules are in src/logic.js (no DOM).
Agent steps
- Nodes, not towers: one list;
connected,hops,poweredare rewritten only byrecompute(grid). - Recompute on every change and return
lost/gainedfor a brownout pop-up. - Towers never relay; only the source and relays transmit.
- Stable allocation: priority, then build order, then hops. A new tower never blacks out an old one.
- Show the cause: live and dead cables, link-range rings, ⚡! (over capacity) vs ⚡✕ (no link).
- Beam as a moving spot with a capped speed; damage bonus and slow use the same
inBeamtest. - Night sight in one function shared by targeting and rendering; powered relays are lamps too.
- Prove it with fights: the same wave with and without the relay, at night with and without the beam.
Common errors it fixes
- Towers flickering because allocation depends on distance or array order.
- Towers still firing after their relay was sold.
- Night rules that hide enemies on screen but not from targeting.
Credits
Design ideas from Last Beacon by stackloomdev (MIT). Code, layout and text are ours.
Requirements
- Any engine: the rules are plain JavaScript and port line by line
- Node.js 20+ to run the tests; Chrome for the browser check
Topics
FAQ
Based on Last Beacon by stackloomdev (MIT). Ideas only: GameSkill wrote the code and text; CREDITS.md in the ZIP lists every source.
Works well with
Skills the author points to as related or as the better fit for neighbouring tasks.
Tower Defense
Build a tower defense: enemies pathing along lanes, wave spawning, towers that auto-target and fire, an economy, and lives.
Bevy Tower Defense
Bevy genre router for tower defense.
Game Feel & Juice
Add juice to actions: screen shake, hit-stop, eased motion, squash and stretch, knockback and layered audio-visual feedback.
Similar skills
open-game-skills
An MIT pack of about 190 SKILL.md agent skills for game design: combat feel, camera, traversal, world, validation, 2D/Spine and art pipeline, with a dispatcher and adapters for Three.js, PixiJS, Phaser, Cocos, Godot, Unity and Unreal.
Kart Drift Boost (tiers, windows, ramps)
A GameSkill original: arcade kart drift-boost rules that reward skill. Drifts charge three tiers, release opens a 0.85 s window you must press in, counter-steer adds a CUT bonus, ramps give one air and one landing boost, boosts take the maximum instead of stacking, and walls cancel everything pending.
One-button Flight (fair tap-to-flap)
A GameSkill original: the rules of a one-button flight game that is never unfair. Flaps set speed instead of adding it, a fixed-step simulation plays the same at 30 and 144 fps, the hitbox forgives grazes, and a seeded gap generator stays inside the reachable band, checked by an autopilot.
Procedural Low-Poly Buildings (kit, validator, views)
A GameSkill original: build stylised low-poly buildings in code from a small spec, then prove them: plot and height limits, a triangle budget per tier, closed outward meshes, supported parts, level roofs and side-only taper measured from silhouettes, plus front, side, top and 3/4 renders checked against the geometry.