procedural-gen
Fungsinya
Skill ini mencakup generasi prosedural untuk dungeon, medan, dan tabel loot menggunakan noise dan angka acak berbiji. Skill ini ditujukan untuk pengembang game yang menginginkan konten dalam jumlah besar tanpa membangun setiap bagian dengan tangan.
Kapan dipakai
- โSaat Anda ingin membuat dungeon, ruangan, atau koridor secara otomatis.
- โSaat Anda memerlukan medan atau heightmap dari fungsi noise.
- โSaat dunia harus dapat direproduksi dari sebuah biji untuk debugging atau dibagikan.
Link skill
https://github.com/gamedev-skills/awesome-gamedev-agent-skills/blob/main/skills/disciplines/procedural-gen/SKILL.mdSalin lalu tempelkan ke AI Anda (Claude, ChatGPT, atau Cursor) dan minta AI mengikuti instruksinya.
Cara pakai
Cara paling mudah: salin pesan ini dan tempelkan ke AI Anda. AI akan membaca skill dan mengikuti instruksinya.
Pesan siap tempel
Untuk Claude Code, Codex, atau Cursor: jalankan di folder proyek, lalu skill langsung terpasang.
Unduh SKILL.md lalu taruh di folder skill agen Anda.
Contoh permintaan ke AI
โSaya ingin game saya membuat dungeon baru setiap kali bermain dari sebuah biji, agar pemain dapat berbagi dungeon yang sama.โ
5 skill baru setiap minggu. 1 menit baca.
Cara kerjanya
Agent membuat satu generator angka acak berbiji dan meneruskannya melalui kode generasi. Setelah itu agent memilih teknik yang sesuai dengan kontennya, seperti noise untuk medan atau pemahatan ruangan untuk dungeon, dan memakai tabel berbobot untuk loot.
Konten teknis (SKILL.md asli)
Teks asli dari pembuat, dalam bahasa Inggris, langsung dari 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
- 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.
- Pick the technique for the content. Continuous terrain/heightmaps โ noise. Discrete rooms/corridors โ space partitioning or agent-based carving. Outcomes with rarities โ weighted tables.
- Generate into a plain data grid/array first, decoupled from rendering.
Generation fills
int[][]or a dict; a separate pass draws it. - 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.
- 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
Pertanyaan umum
Mengapa tidak memakai fungsi acak global?
Skill menyebutkan bahwa sumber acak global membuat hasil tidak dapat diulang dan bergantung pada urutan pemanggilan.
Apakah ini menggantikan level buatan tangan?
Tidak. Skill menyebutkan bahwa desain level prosedural dan buatan tangan bekerja paling baik bersama-sama.
Apa itu wave function collapse?
Itu adalah salah satu teknik generasi dungeon dan tile yang dicakup skill ini.
Detail
Deskripsi asli dari pembuat
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.
Popularitas
- Bintang GitHub
- 6.6k
- Peringkat
- #13803
- Lisensi
- Apache-2.0
- Diperbarui
- 28/10/2026
Komentar
- โฆ
Skill lain dari repositori ini
router
6.6kMembantu agent Anda memilih skill pengembangan game yang tepat untuk setiap permintaan dengan mendeteksi engine Anda dan jenis tugas yang Anda perlukan.
ai-behavior-trees-utility-ai
6.6kMembantu agent Anda membangun behavior tree dan sistem utility AI untuk musuh dan karakter game yang memilih aksi berdasarkan prioritas dan skor.
audio-design
6.6kMengajari agent Anda cara mixing audio game: bus, volume dalam desibel, ducking di bawah dialog, musik adaptif, dan variasi efek suara.
camera-systems
6.6kMembantu agent Anda membangun kamera game yang mengikuti dengan halus, tetap berada di dalam level, dan dapat mengorbit atau melihat sekeliling dalam 3D.
Skill serupa
diffs
394kMemungkinkan agent Anda menghasilkan diff perubahan yang nyata dan dapat dibagikan sebagai tautan viewer atau file gambar, bukan ringkasan yang ditulis manual.
coding-agent
394kMembantu agent Anda menyerahkan pekerjaan pemrograman besar ke Codex, Claude Code, atau OpenCode di latar belakang, lalu memeriksa kemajuannya.
gh-issues
394kMembantu agent Anda menemukan issue GitHub, memilih yang dikerjakan, dan membuka pull request perbaikan, termasuk tindak lanjut komentar tinjauan.