depth-sorting-occlusion — Claude Code skill: how to install and use
Fixes sprite layering in isometric scenes so characters correctly render behind walls, trees, and multi-tile structures.
npx skills add 0xheycat/isometric-game-skills --skill depth-sorting-occlusion -a claude-codeWhat depth-sorting-occlusion does
This skill guides agents through depth sorting for isometric games. In isometric views, draw order controls depth directly using the anchor tile formula depth = row + col. The instructions tell the model to sort drawables by depth in ascending order before rendering, resolving identical keys by y and creation sequence.
For larger structures spanning multiple tiles, the algorithm assigns depth using the front-most occupied tile rather than the sprite center. Tall objects get split into stacked slices if needed. Static items avoid per-frame re-sorting because updating only on movement saves performance. A naive sort by raw screen y consistently breaks around large buildings.
What it helps with
- prevent sprites from rendering in front of objects they should be behind
- calculate isometric depth keys from anchor tile coordinates row + col
- handle occlusion and layering for multi-tile and tall sprites
- trigger draw order re-sorting strictly when objects move
Example prompts for the agent
- Characters are clipping in front of trees when walking behind them. Fix our isometric draw order.
- Implement depth sorting for multi-tile buildings using the front-most tile anchor.
- Check our isometric rendering pipeline to re-sort objects only on movement.
How to install depth-sorting-occlusion
1Skills CLI (Vercel)
npx skills add 0xheycat/isometric-game-skills --skill depth-sorting-occlusion -a claude-code2Manually: put the files in place
~/.claude/skills/depth-sorting-occlusion/SKILL.mdCopy the whole skill folder; for one project use .claude/skills/depth-sorting-occlusion/
1Skills CLI (Vercel)
npx skills add 0xheycat/isometric-game-skills --skill depth-sorting-occlusion -a codex2Manually: put the files in place
.agents/skills/depth-sorting-occlusion/SKILL.mdFor all projects use ~/.agents/skills/
1Skills CLI (Vercel)
npx skills add 0xheycat/isometric-game-skills --skill depth-sorting-occlusion -a cursor2Manually: put the files in place
.cursor/skills/depth-sorting-occlusion/SKILL.mdCursor also reads .agents/skills/ and .claude/skills/
1GitHub CLI
gh skill install 0xheycat/isometric-game-skills depth-sorting-occlusion2Manually: put the files in place
.github/skills/depth-sorting-occlusion/SKILL.md1Skills CLI (Vercel)
npx skills add 0xheycat/isometric-game-skills --skill depth-sorting-occlusion -a gemini-cli2Platform CLI
gemini skills install https://github.com/0xheycat/isometric-game-skills --path skills/depth-sorting-occlusionManually: put the files in place
.devin/skills/depth-sorting-occlusion/SKILL.mdThe legacy .windsurf/skills/ path still works
Skills CLI (Vercel)
npx skills add 0xheycat/isometric-game-skills --skill depth-sorting-occlusion -a opencodeClaude.ai
Zip the folder and upload it in Settings → Capabilities → Skills
Step by step, with commands for each platform: How to install skills in Claude Code: five ways
Questions about depth-sorting-occlusion
How do I install depth-sorting-occlusion in Claude Code?
Run npx skills add 0xheycat/isometric-game-skills --skill depth-sorting-occlusion -a claude-code.
What does depth-sorting-occlusion do?
It provides depth sorting rules and sorting key formulas (row + col) to resolve sprite occlusion bugs in isometric engines.
How does it handle multi-tile structures?
The skill directs the agent to base depth on the front-most occupied tile instead of the geometric center.
Source text
SKILL.md · MIT
--- name: depth-sorting-occlusion description: Use when sprites draw in the wrong order so characters appear in front of objects they should be behind in an isometric scene. license: MIT --- # Depth Sorting & Occlusion ## Overview In isometric, draw order IS depth. A character is behind a tree if its anchor tile sorts earlier. This skill gives the correct sort key and handles tall/multi-tile objects that break naive sorting. ## When to Use - Characters render in front of trees/walls they should be behind. - Tall or multi-tile objects sort incorrectly. - You added objects and the layering looks wrong. ## Process 1. Give every drawable a depth key based on its anchor tile: depth = row + col. 2. Sort all objects by depth ascending before drawing. 3. For ties, break by a secondary key (e.g. y, then creation order). 4. For multi-tile objects, sort by the FRONT-most occupied tile. 5. For very tall objects, consider splitting into stackable slices. 6. Re-sort only when objects move, not every frame if static. 7. Test the classic case: walk a character around all four sides of a tree. ```js objects.sort((a, b) => (a.row + a.col) - (b.row + b.col)); ``` ## Rationalizations (Stop Lying to Yourself) | Excuse | Reality | |---|---| | "Painter order by y is good enough" | Pure y fails for multi-tile and tall sprites. Use anchor row+col. | | "I will sort once at load" | Moving objects must re-sort. Sort on movement. | ## Red Flags - STOP if you catch yourself: - Sorting by raw y instead of anchor tile. - Multi-tile objects using their center instead of front tile. - Characters clipping through tall buildings. ## Verification You are NOT done until every box is checked: - [ ] Walking around all sides of an object always sorts correctly. - [ ] Multi-tile and tall objects occlude properly. - [ ] Sorting updates when objects move.
© 0xheycat · MIT · 0xheycat/isometric-game-skills