Skip to content
SlashClone
Made by@gameforge

Level designer

@gameforge/level-designer

Design tile-grid game levels as plain JSON and check them with a validator: equal-width rows, known tiles, one start, an exit you can actually reach (keys and doors included), reachable coins, and a closed border. Writes a JSON report you can keep in CI.

SkillOtherv1.0.0 (latest)Tested
Activity
New: be the first to try it
  1. 1---
  2. 2name: level-designer
  3. 3description: Design tile-grid levels for 2D games (top-down, puzzle, roguelike, maze, Sokoban-style) as plain JSON, then prove each one is playable with a validator that checks bounds, tiles, a single start, a reachable exit through keys and doors, and reachable coins. Use when the user says "design some levels", "make level 3 harder", "is this level beatable?", "check my levels", or adds files to levels/.
  4. 4license: MIT
  5. 5---
  6. 6
  7. 7# Level designer
  8. 8
  9. 9Levels live in `levels/*.json`, one file per level. Every level Claude writes or edits is run through the validator before it is called done, so nobody ships a level with an exit behind a wall.
  10. 11## Level format
  11. 13```json
  12. 15 "name": "1-2 Key and door",
  13. 16 "tiles": [
  14. 17 "#######",
  15. 18 "#S..#E#",
  16. 19 "#.#.#D#",
  17. 20 "#K#...#",
  18. 21 "#######"
  19. 22 ]
  20. 24```
  21. 26| Tile | Meaning |
  22. 27| ---- | ------- |
  23. 28| `#` | wall |
  24. 29| `.` | floor |
  25. 30| `S` | start, exactly one |
  26. 31| `E` | exit, at least one |
  27. 32| `^` | spikes, blocks the path |
  28. 33| `C` | coin, should be reachable |
  29. 34| `K` | key, opens any door |
  30. 35| `D` | door, passable after a key |
  31. 37If the user's engine already has a format, map it to this one in a small converter, or ask before changing the legend. Extra JSON keys (enemies, music, par time) are fine; the validator ignores them.
  32. 39## Steps
  33. 411. **Ask for the brief** if missing: how many levels, grid size (default 12x9 for phone screens), which tiles the game supports, and the difficulty curve (default: teach, test, twist).
  34. 422. **Plan the set** in a short table before drawing: level name, the one new idea it teaches, size, target shortest path. One new idea per level.
  35. 433. **Draw each level** in `levels/NN-short-name.json`. Rules of thumb:
  36. 44 - Close the border with walls.
  37. 45 - Show the goal early: the player should see the exit or the key within the first few moves.
  38. 46 - Put a coin on the risky path and leave a safe path without it.
  39. 47 - Make the shortest path grow 20 to 40% per level, not double.
  40. 484. **Validate every level:**
  41. 50 ```bash
  42. 51 node scripts/validate-levels.mjs levels --report out/level-report.json
  43. 52 ```
  44. 54 Exit code 1 means at least one level has errors. Add `--exit-zero` only when the user wants a report without failing (for example in a draft folder).
  45. 555. **Fix and rerun** until there are no errors. Treat warnings as questions for the user (an unreachable coin may be a deliberate tease).
  46. 566. **Report** with the table below, using `shortest_path` from the report as the difficulty number.
  47. 58## Output
  48. 60```markdown
  49. 61| Level | Teaches | Size | Shortest path | Coins reachable | Status |
  50. 62| ----- | ------- | ---- | ------------- | --------------- | ------ |
  51. 63| 1-1 First steps | moving | 10x7 | 11 | 3/3 | ok |
  52. 64| 1-2 Key and door | keys open doors | 7x5 | 12 | 0/0 | ok |
  53. 65```
  54. 67Then one line on the curve: "Paths grow 11, 12, 16, 21. Level 1-2 may feel like a breather; want it longer?"
  55. 69## What the validator checks
  56. 71- Errors: invalid JSON, missing or ragged `tiles`, size outside 3 to 128, unknown tile, not exactly one `S`, no `E`, a door with no key, no exit reachable (breadth-first search over position and key state, four directions).
  57. 72- Warnings: open border tiles, unreachable coins or keys, an exit fewer than 3 steps away, a missing `name`.
  58. 74## Guardrails
  59. 76- Write only in `levels/` and `out/`. Ask before overwriting a level the user made by hand; propose the change as a diff first.
  60. 77- A level is not done until the validator passes it. Say so plainly if you could not make one pass.
  61. 78- The validator proves reachability, not fun. Suggest a playtest (the playtest-feedback kit helps) after big changes.