본문으로 건너뛰기
Skillpedia
일반 코딩6.6k · #13803

procedural-gen

하는 일

노이즈와 시드 난수를 이용한 던전, 지형, 전리품 테이블의 절차적 생성을 다룹니다. 모든 부분을 손으로 만들지 않고도 많은 콘텐츠를 원하는 게임 개발자를 위한 스킬입니다.

사용하는 경우

  • ✓던전, 방, 통로를 자동으로 생성하고 싶을 때.
  • ✓노이즈 함수로 지형이나 높이 맵이 필요할 때.
  • ✓디버깅이나 공유를 위해 시드로 세계를 똑같이 재현해야 할 때.

스킬 링크

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

복사해서 AI(Claude, ChatGPT, Cursor)에 붙여넣고 지침을 따르도록 요청하세요.

사용 방법

가장 쉬운 방법입니다. 메시지를 복사해 AI에 붙여넣으세요. AI가 스킬을 읽고 지침을 따릅니다.

바로 붙여넣을 수 있는 메시지

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.
AI가 이런 스킬을 알아서 찾아 쓰길 원하시나요?무료 Skillpedia MCP를 설치하세요. 한 줄이면 작업마다 스킬 15,000+개 중에서 검색합니다.1분 만에 설치 →

AI에게 요청하는 예시

“게임이 실행할 때마다 시드에서 새 던전을 생성해서, 플레이어들이 같은 던전을 공유할 수 있게 해 주세요.”

매주 새 스킬 5개. 읽는 데 1분.

작동 방식

에이전트는 시드가 있는 난수 생성기 하나를 만들고, 그것을 생성 코드 전체에 전달합니다. 그다음 콘텐츠에 맞는 기법을 고르는데, 지형에는 노이즈를, 던전에는 방 조각을, 전리품에는 가중치 테이블을 씁니다.

기술 내용 (원본 SKILL.md)

작성자의 영어 원문을 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
자주 묻는 질문

전역 난수 함수를 쓰면 안 되나요?

전역 난수 원천은 결과를 반복할 수 없게 만들고, 호출 순서에 따라 달라진다고 스킬은 설명합니다.

손으로 만든 레벨을 대체하나요?

아니요. 스킬은 절차적 설계와 직접 만든 레벨 설계가 함께할 때 가장 잘 작동한다고 설명합니다.

웨이브 함수 붕괴란 무엇인가요?

스킬이 다루는 던전과 타일 생성 기법 중 하나입니다.

상세 정보

작성자의 원본 설명

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

인기도

GitHub 스타
6.6k
순위
#13803
라이선스
Apache-2.0
업데이트
2026. 10. 28.

이 스킬이 유용한가요?

0

로그인 투표하려면 로그인하세요.

댓글

  • …

이 저장소의 다른 스킬

비슷한 스킬