procedural-generation
Installation
SKILL.md
Procedural Generation
Seeded algorithms, noise functions, and constraint propagation define replayable content generation.
Available Scripts
wfc_level_generator.gd
Expert Wave Function Collapse implementation with tile adjacency rules.
NEVER Do in Procedural Generation
- NEVER forget to seed RNG —
randi()without seed = same dungeon every time. Useseed(hash(Time.get_ticks_msec()))OR expose seed for speedrunning. - NEVER use
randf()in_ready()for multiplayer — Each client calls_ready()at different times = desynced RNG = different dungeons. Use shared seed from server. - NEVER skip validation — Drunkard's walk dungeon with no exit? Playability fail. ALWAYS validate (e.g., A* from start to end) OR regenerate.
- NEVER use noise.get_noise_2d() every frame — Calling noise 10,000x/frame = lag. Pre-generate heightmap in
_ready(), cache in Array. - NEVER use BSP without minimum room size — Infinite splits = 1x1 rooms = crash. Set
min_size(e.g., 6x6) to prevent over-subdivision. - NEVER ignore WFC contradictions — Wave Function Collapse fails when no valid tiles remain. MUST detect contradiction, backtrack OR restart generation.
- NEVER block main thread for large generations — Generating 1000x1000 terrain in
_ready()= freeze. Use worker thread OR split across frames withawait.