77 game-dev skills for AI coding agents — Godot, Unity, Unreal, Phaser, PixiJS, three.js, Bevy, pygame, LÖVE, Roblox. Portable SKILL.md Agent Skills (the format Anthropic launched as Claude Skills), with a router that loads the right skill for your engine and task. Runs in Claude Code, Cursor, Kiro, Codex, Copilot, Gemini CLI and more.
Python agent-skillsai-agentsantigravityawesome-listclaude-codeclinecodexcursorgame-devgame-developmentgamedevgemini-cligithub-copilotgodotkirooh-my-piskillsunityunrealwindsurf
fix(roguelike): stop the energy scheduler starving actors, correct the cave automaton, describe symmetric shadowcasting accurately
Kiro Crewcb4b314f1da1
diff --git a/skills/genres/roguelike/SKILL.md b/skills/genres/roguelike/SKILL.mdindex ce96ff1..2f9b305 100644--- a/skills/genres/roguelike/SKILL.md+++ b/skills/genres/roguelike/SKILL.md@@ -77,18 +77,23 @@ dungeon = generate_dungeon(rng, depth) # same seed + depth => same dungeon### 2. Energy-based turn scheduler (speeds differ)```python-# Pseudocode. Each actor gains energy each tick and acts when it has enough.+# Pseudocode. Actors gain energy each tick and act when they have enough.# Faster actors gain more per tick, so they act more often — no fixed "player then enemies".TURN_COST = 100def next_actor(actors):while True:- for a in actors: # stable order avoids ties favoring one side- a.energy += a.speed # e.g. speed 100 = normal, 150 = hasted+ for a in actors: # 1) serve anyone already ready, in a stable orderif a.energy >= TURN_COST:- a.energy -= TURN_COST- return a # this actor takes exactly one action now+ a.energy -= TURN_COST # (or the cost of the action they choose)+ return a # this actor takes exactly one action now+ for a in actors: # 2) nobody is ready: advance time for everyone at once+ a.energy += a.speed # e.g. speed 100 = normal, 150 = hasted, 50 = slowed```+Grant energy to everyone in a separate pass. Adding it inside the same loop that returns the+first ready actor starves every actor after it: with two speed-100 actors, the first one acts+every time and the second never does.+### 3. Field of view + explored memory```python@@ -99,15 +104,19 @@ for cell in visible:# Render: visible -> lit; explored-but-not-visible -> dim; never-seen -> hidden.```-Use a proven FOV algorithm (recursive shadowcasting or symmetric shadowcasting). Do not-roll a naive raycast-per-cell — it produces asymmetric, "blinking" vision. See refs.+Use symmetric shadowcasting (refs §3): if you can see a monster, it can see you. Classic+recursive shadowcasting is fast but not symmetric, and a naive raycast per cell gives blind+spots and "blinking" vision. If a library is available, use its symmetric mode (python-tcod's+`compute_fov` takes `FOV_SYMMETRIC_SHADOWCAST` as its algorithm).## Pitfalls / failure modes- **Disconnected dungeons** → rooms the player can't reach. Always run a connectivity/flood-fillpass and carve corridors until every walkable cell is reachable.- **Naive FOV** → vision that flickers or is asymmetric (you see them, they don't see you).- Use shadowcasting; test symmetry.+ Use symmetric shadowcasting and test symmetry (refs §3).+- **One actor never gets a turn** → energy granted inside the "find who is ready" loop+ (Pattern 2). Advance energy for all actors in its own pass.- **Real-time loop pretending to be turn-based** → input races and double-moves. Resolve onediscrete turn at a time; queue input.- **Flat difficulty** → no descent pressure. Scale monsters/loot by depth and keep resources scarce.diff --git a/skills/genres/roguelike/references/generation-fov-loot.md b/skills/genres/roguelike/references/generation-fov-loot.mdindex b7d79c1..af90a71 100644--- a/skills/genres/roguelike/references/generation-fov-loot.md+++ b/skills/genres/roguelike/references/generation-fov-loot.md@@ -31,15 +31,22 @@ sibling rooms as you unwind the recursion. Produces evenly distributed, non-over### Cellular automata (organic caves)```python-# Random fill, then smooth: a cell becomes wall if most neighbors are walls.+# Random fill, then smooth with the "4-5 rule": a cell is wall in the next map if 5 or more of+# the 9 cells in its 3x3 block (itself included) are walls. Same thing: a wall stays a wall with+# 4+ wall neighbours; a floor becomes wall with 5+.fill_random(map, wall_chance=0.45, rng=rng)-for _ in range(4, 6): # 4–6 smoothing passes+for _ in range(5): # 4–5 passes is typical+ new_map = copy(map) # read the old map, write a new onefor cell in map:- walls = count_wall_neighbors(map, cell) # 8-neighborhood- map[cell] = WALL if walls >= 5 else FLOOR+ walls = count_walls_3x3(map, cell) # out-of-bounds cells count as walls (solid border)+ new_map[cell] = WALL if walls >= 5 else FLOOR+ map = new_map# Then keep only the largest connected floor region (discard isolated pockets).```+Updating the map in place while scanning it makes earlier cells influence later ones in the same+pass, which smears caves in the scan direction. Always write to a second buffer.+### Drunkard's walk (cheap, winding)Start at a point and random-walk, carving floor, until a target floor percentage is reached.@@ -60,26 +67,44 @@ For caves, the common shortcut is to keep only the single largest region and dis## 3. Field of view — symmetric shadowcasting-Properties you want: **symmetric** (if A sees B, B sees A), no blind spots, no flicker as the-player moves. Recursive shadowcasting scans the eight octants around the origin, tracking a-"shadow" of slopes blocked by walls:+Properties you want: **symmetric** (if floor tile A sees floor tile B, B sees A), no blind+corners, and walls that light up as you walk along them. Classic recursive shadowcasting (eight+octants, tiles shown if they touch the visible slope range) is fast but breaks symmetry.+*Symmetric shadowcasting* (Albert Ford, 2021) fixes it with one rule: a **floor** tile is+visible only if its **centre** lies inside the visible slope range; a **wall** tile is visible+if any part of it does.-```-for each of 8 octants:- scan rows outward from the origin up to radius R- track the visible slope range [start_slope, end_slope]- when a wall is hit, recurse into the narrower slope range beyond it,- and continue the current row with the reduced range-mark a cell visible if it lies within the current slope range and within R+```python+# Pseudocode. Scan each of the 4 quadrants (N, E, S, W) row by row, moving away from the origin.+# Slopes are col/depth; keep them as exact fractions (rationals), not floats, so the edge+# tests do not wobble. (depth, col) is mapped to (x, y) per quadrant by a small transform.+def scan(quadrant, depth, start, end): # first call: depth=1, start=-1, end=+1+ prev_wall = None+ for col in range(round_half_up(depth * start), round_half_down(depth * end) + 1):+ wall = is_wall(quadrant, depth, col)+ centre_inside = depth * start <= col <= depth * end+ if wall or centre_inside:+ mark_visible(quadrant, depth, col)+ if prev_wall is True and not wall: # leaving a wall: narrow the start+ start = Fraction(2 * col - 1, 2 * depth)+ if prev_wall is False and wall: # hitting a wall: scan the gap before it+ scan(quadrant, depth + 1, start, Fraction(2 * col - 1, 2 * depth))+ prev_wall = wall+ if prev_wall is False: # row ended on floor: continue outward+ scan(quadrant, depth + 1, start, end)```-Implementation notes:-- Transform each octant into a common coordinate frame so one routine handles all eight.-- Use a circular radius check (`dx*dx + dy*dy <= R*R`) for a round light, not a square.-- Cache `explored` separately; render explored-but-not-visible cells dimmed.+`round_half_up(x)` is `floor(x + 1/2)` and `round_half_down(x)` is `ceil(x - 1/2)`. The origin+tile is always visible and treated as not blocking. Stop recursing at the map edge or at your+light radius, and use a circular check (`dx*dx + dy*dy <= R*R`) for a round light rather than a+square one.++Test it: on random maps, compute FOV from every floor tile and assert that whenever A sees B,+B sees A. This version passes that test; classic recursive shadowcasting does not.-A symmetric variant ("symmetric shadowcasting") is simpler to reason about and avoids-single-cell asymmetries; prefer it if you implement from scratch.+Implementation notes:+- Keep `explored` separately; render explored-but-not-visible cells dimmed.+- Recompute only when the viewer moves or a door/wall changes, not every frame.## 4. Weighted, depth-scaled loot and spawn tables