Skip to content
Skillpedia
General coding6.6k Β· #13803

procedural-gen

What it does

This skill covers procedural generation for dungeons, terrain, and loot tables using noise and seeded random numbers. It is for game developers who want large amounts of content without hand-building every part.

When to use it

  • βœ“When you want to generate dungeons, rooms, or corridors automatically.
  • βœ“When you need terrain or heightmaps from noise functions.
  • βœ“When a world must be reproducible from a seed for debugging or sharing.

Skill link

https://github.com/gamedev-skills/awesome-gamedev-agent-skills/blob/main/skills/disciplines/procedural-gen/SKILL.md

Copy it and paste it into your AI (Claude, ChatGPT or Cursor), asking it to follow the instructions.

How to use

The easiest way: copy the message and paste it into your AI. It reads the skill and follows the instructions.

Ready-to-paste message

Use this skill to help me: https://github.com/gamedev-skills/awesome-gamedev-agent-skills/blob/main/skills/disciplines/procedural-gen/SKILL.md Read the SKILL.md file at that link and follow its instructions for my task.
Want your AI to find skills like this on its own?Install the free Skillpedia MCP: one line, and it searches 15,000+ skills before each task.Install in 1 minute β†’

Example of what to ask your AI

β€œI want my game to generate a new dungeon every run from a seed, so players can share the same dungeon.”

5 new skills a week. 1 minute to read.

How it works

The agent creates one seeded random number generator and passes it through the generation code. It then picks a technique suited to the content, such as noise for terrain or room carving for dungeons, and uses weighted tables for loot.

Technical content (original SKILL.md)

Original text by the author, straight from GitHub.

Procedural generation

Generate levels, terrain, and loot from compact rules and a seed. The throughline of good procgen is determinism: a single seed reproduces the same world, so bugs are repeatable and players can share seeds. This skill owns the core algorithms β€” noise, seeded RNG, dungeon layout, weighted tables; genres like roguelike and survival-crafting consume it.

When to use

  • Use to generate maps, dungeons, terrain heightmaps, item drops, or any content you do not want to author by hand.
  • Use when results must be reproducible from a seed (debugging, daily challenges, shareable worlds).
  • Use to pick weighted random outcomes (loot rarity, spawn tables).

When not to use: for the engine's tile API to paint the result, use godot-tilemap or unity-tilemap-2d. For routing AI through the generated map, use game-ai. For carefully hand-paced levels, use level-design β€” procgen and authored design are complementary, not interchangeable.

Core workflow

  1. Own your randomness. Create one seeded RNG instance and pass it everywhere. Never call the global/static random in generation code β€” it makes results irreproducible and order-dependent.
  2. Pick the technique for the content. Continuous terrain/heightmaps β†’ noise. Discrete rooms/corridors β†’ space partitioning or agent-based carving. Outcomes with rarities β†’ weighted tables.
  3. Generate into a plain data grid/array first, decoupled from rendering. Generation fills int[][] or a dict; a separate pass draws it.
  4. Validate before shipping the result to the player. Is every room reachable? Is the spawn safe? Is there a path to the exit? Reject or repair layouts that fail; do not hand the player a broken map.
  5. Tune with the seed fixed so each parameter change is visible in isolation, then sweep seeds to check the distribution, not just one lucky map.

Patterns

1. Seeded, deterministic RNG (the foundation)

import random
rng = random.Random(seed)        # a dedicated instance β€” NOT the global random.*
room_count = rng.randint(5, 12)  # same seed -> same sequence, every run
# RIGHT: thread `rng` through every function that makes a choice.
# WRONG: calling random.randint(...) (global state) β€” order-dependent, unseedable.

Engine equivalents: Godot 4.7 var rng := RandomNumberGenerator.new(); rng.seed = s (save rng.state to resume a sequence mid-way); Unity 6.3 new Unity.Mathematics.Random(seed) (a uint, must be non-zero) or new System.Random(seed). Avoid UnityEngine.Random.InitState for generation: it seeds the one global generator that every other script also draws from. Store the seed in the save file so a world can be regenerated.

2. Fractal (fBm) noise for heightmaps

# Sum several octaves: each higher octave has higher frequency, lower amplitude.
def fbm(noise, x, y, octaves=5, lacunarity=2.0, gain=0.5):
    total, amp, freq, norm = 0.0, 1.0, 1.0, 0.0
    for _ in range(octaves):
        total += amp * noise(x * freq, y * freq)   # noise() returns ~0..1
        norm  += amp                                # track total amplitude
        amp   *= gain                               # each octave contributes less
        freq  *= lacunarity                         # ...at a higher frequency
    return total / norm                             # normalize back into 0..1

# Redistribute to carve flat valleys / sharpen peaks: higher exp -> more lowland.
elevation = pow(fbm(noise, nx, ny), 2.2)

Use a real noise library (FastNoiseLite, opensimplex, Unity.Mathematics.noise, or Mathf.PerlinNoise) β€” do not implement gradient noise yourself. Seed elevation and moisture with different seeds so a biome lookup over both fields isn't perfectly correlated. Full biome lookup and island shaping are in references/noise.md.

3. Weighted loot table (rarity-correct selection)

# Roll proportional to weight: common drops far more often than legendary.
def weighted_pick(rng, table):           # table: list of (item, weight)
    total = sum(w for _, w in table)
    roll = rng.uniform(0, total)          # a point on the cumulative line
    upto = 0.0
    for item, w in table:
        upto += w
        if roll < upto:                   # first bucket the roll falls into
            return item
    return next(i for i, w in reversed(table) if w > 0)  # roll == total (float edge)

loot = weighted_pick(rng, [("common", 70), ("rare", 2
FAQ

Why not use the global random function?

The skill says a global random source makes results unrepeatable and depends on the order of calls.

Does it replace hand-made levels?

No. The skill says procedural and authored level design work best together.

What is wave function collapse?

It is one of the dungeon and tile generation techniques the skill covers.

Details

Original description by the author

Generate game content procedurally β€” seeded deterministic RNG, value/Perlin/ Simplex noise for terrain and heightmaps, grid dungeon generation (rooms + corridors, BSP, random walk, wave function collapse), and weighted loot/drop tables. Engine-neutral algorithms. Use when the user mentions procedural generation, perlin/simplex noise, random seed, dungeon generator, WFC, heightmap/terrain, or loot tables.

repo: gamedev-skills/awesome-gamedev-agent-skills

Popularity

GitHub stars
6.6k
Ranking position
#13803
License
Apache-2.0
Updated
10/28/2026

Is this skill useful?

0

Sign in to vote.

Comments

  • …

More skills from this repository

Similar skills