Skip to main content
skill CX Codex

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.

Install into Claude Code · Skills CLI (Vercel) All methods and platforms ↓
npx skills add 0xheycat/isometric-game-skills --skill depth-sorting-occlusion -a claude-code
Open on GitHub

What 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-code

2Manually: put the files in place

~/.claude/skills/depth-sorting-occlusion/SKILL.md

Copy the whole skill folder; for one project use .claude/skills/depth-sorting-occlusion/

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

Similar skills

All skills for Game dev and 3D: Unity, Unreal, Godot, Blender →

From the same set21

isometric-character-sprites A skill that walks the agent through generating one isometric character in eight facing directions with a shared feet-anchor, so walking frames do not slide or sort wrong. CX Codex +1 ★ 41repo stars isometric-building-sprites Generates isometric building sprites locked to a specific tile footprint. Keeps depth sorting intact so characters walk around buildings naturally. CX Codex +1 ★ 41repo stars isometric-art-direction Set visual rules for an isometric project before generating assets. The skill helps keep tiles, sprites, and buildings consistent across prompts. CX Codex +1 ★ 41repo stars godot4-isometric-tilemap Sets up 2:1 isometric rendering in Godot 4 with TileMapLayer and Y-sort, so draw order and picking stop fighting you. CX Codex +1 ★ 41repo stars comfyui-lowvram-setup This skill configures ComfyUI for SDXL isometric asset generation with limited VRAM. Use it when setting up a 12GB RTX 3060 or keeping a tile set consistent. CX Codex +1 ★ 41repo stars canvas2d-isometric-renderer Builds the draw loop for an isometric tilemap on Canvas 2D: ground tiles first, depth-sorted sprites after. CX Codex +1 ★ 41repo stars canvas-performance-optimization Helps eliminate frame drops in isometric Canvas games by culling off-screen tiles, batching draw calls, and removing render-loop allocations. CX Codex +1 ★ 41repo stars camera-pan-zoom-controls Skill for isometric cameras: drag-to-pan, scroll-to-zoom toward the cursor, and clamp to map bounds. Keeps tiles pixel-aligned, no shimmer. CX Codex +1 ★ 41repo stars

Project sponsors

Companies that keep this analytics open
Gold sponsor

Impressions, clicks and code copies — open statistics. We keep the numbers public for the same reason NeBlask itself is public. Become a sponsor