[G1-Sync] Manual knowledge update
This commit is contained in:
@@ -1,78 +1,169 @@
|
||||
---
|
||||
id: wiki-2026-0508-procedural-level-geometry
|
||||
title: Procedural Level Geometry
|
||||
category: 10_Wiki/Topics_GD
|
||||
category: 10_Wiki/Topics
|
||||
status: verified
|
||||
canonical_id: self
|
||||
aliases: []
|
||||
aliases: [PCG, Procedural Generation, Level PCG, Roguelike Generation]
|
||||
duplicate_of: none
|
||||
source_trust_level: A
|
||||
confidence_score: 0.92
|
||||
tags: [uncategorized]
|
||||
confidence_score: 0.9
|
||||
verification_status: applied
|
||||
tags: [game-design, level-design, pcg, procedural-generation]
|
||||
raw_sources: []
|
||||
last_reinforced: 2026-05-08
|
||||
last_reinforced: 2026-05-10
|
||||
github_commit: pending
|
||||
inferred_by: Claude Opus 4.7 (auto-normalize 2026-05-08)
|
||||
tech_stack:
|
||||
language: python
|
||||
framework: roguelike / 3d-engine
|
||||
---
|
||||
|
||||
---
|
||||
redirect_to: "[[게임_디자인_및_가상_경제_시스템]]"
|
||||
canonical_id: "wiki-2026-0507-105"
|
||||
---
|
||||
# Procedural Level Geometry
|
||||
|
||||
# Redirect
|
||||
## 매 한 줄
|
||||
> **"매 grammar + constraint = playable layout"**. Procedural level geometry 는 매 1980s Rogue 의 BSP 부터 매 2010s Spelunky 의 room template, 매 2020s Minecraft / No Man's Sky / Townscaper 의 WFC, 매 2026 ML-assisted hybrid (Pixar's RayBend, Nvidia GANverse) 까지 매 evolution. 매 핵심 trade-off: **매 controllability ↔ matrix variety**.
|
||||
|
||||
이 문서는 Canonical 문서인 통합되었습니다.
|
||||
모든 최신 지식과 세부 내용은 위 링크를 참조하십시오.
|
||||
## 📌 한 줄 통찰 (The Karpathy Summary)
|
||||
## 매 핵심
|
||||
|
||||
> 절차적 레벨 지오메트리는 알고리즘으로 게임 공간을 동적으로 생성하는 기법으로, 무한 변형·압축된 콘텐츠 생산을 가능케 한다.
|
||||
### 매 algorithm families
|
||||
1. **BSP / partition**: Rogue, NetHack — 매 simple, 매 grid-only.
|
||||
2. **Cellular automata**: Cave generation — 매 organic shape.
|
||||
3. **Random walk / drunkard**: 매 cave / path.
|
||||
4. **Template + stitching**: Spelunky, Enter the Gungeon — 매 controllable.
|
||||
5. **Wave Function Collapse (WFC)**: Townscaper, Bad North — 매 high constraint.
|
||||
6. **Grammar / L-system**: Vegetation, dungeons (Lindenmayer).
|
||||
7. **ML-assisted**: 2026 — diffusion-based heightmap, GAN tile generation.
|
||||
|
||||
## 📖 구조화된 지식 (Synthesized Content)
|
||||
### 매 pipeline
|
||||
```
|
||||
Seed → Macro layout (zones) → Meso (rooms / chunks)
|
||||
→ Micro (geometry, props) → Validation → Polish
|
||||
```
|
||||
|
||||
**추출된 패턴:** "규칙 + 시드"로 무한 콘텐츠 생성 — 단 의미 있는 변형이 되려면 규칙이 게임플레이를 지원해야.
|
||||
### 매 응용
|
||||
1. Roguelike dungeons (Caves of Qud, Brogue, Cogmind).
|
||||
2. Open-world terrain (Minecraft, Valheim, NMS).
|
||||
3. City generation (Cities Skylines mods, Townscaper).
|
||||
4. Mission layouts (Hitman freelancer mode, XCOM).
|
||||
|
||||
**세부 내용:**
|
||||
- BSP, Wave Function Collapse, L-system.
|
||||
- 노이즈 기반: Perlin, Simplex.
|
||||
- 그래프 기반: 던전 그래프 후 기하 적용.
|
||||
- 사례: Spelunky, Minecraft, Hades, Dead Cells.
|
||||
- 한계: 의미 있는 핸드크래프트 우선.
|
||||
## 💻 패턴
|
||||
|
||||
## 🤖 LLM 활용 힌트 (How to Use This Knowledge)
|
||||
### BSP dungeon
|
||||
```python
|
||||
def bsp_split(rect, depth=0, max_depth=4):
|
||||
if depth >= max_depth or rect.too_small():
|
||||
return [rect.shrink(margin=1)] # leaf = room
|
||||
axis = "h" if rect.w < rect.h else "v"
|
||||
cut = random.uniform(0.4, 0.6)
|
||||
a, b = rect.split(axis, cut)
|
||||
return bsp_split(a, depth+1, max_depth) + bsp_split(b, depth+1, max_depth)
|
||||
|
||||
**언제 이 지식을 쓰는가:**
|
||||
- *(TODO)*
|
||||
def connect_rooms(rooms, grid):
|
||||
for r1, r2 in zip(rooms, rooms[1:]):
|
||||
carve_corridor(grid, r1.center, r2.center)
|
||||
```
|
||||
|
||||
**언제 쓰면 안 되는가:**
|
||||
- *(TODO)*
|
||||
### Cellular automata cave
|
||||
```python
|
||||
def cave(w, h, fill=0.45, iters=5):
|
||||
g = [[1 if random.random() < fill else 0 for _ in range(w)] for _ in range(h)]
|
||||
for _ in range(iters):
|
||||
g = [
|
||||
[smooth(g, x, y) for x in range(w)]
|
||||
for y in range(h)
|
||||
]
|
||||
return g
|
||||
|
||||
## 🧪 검증 상태 (Validation)
|
||||
def smooth(g, x, y):
|
||||
walls = sum(g[y+dy][x+dx]
|
||||
for dy in (-1,0,1) for dx in (-1,0,1)
|
||||
if 0 <= x+dx < len(g[0]) and 0 <= y+dy < len(g))
|
||||
return 1 if walls >= 5 else 0
|
||||
```
|
||||
|
||||
- **정보 상태:** draft
|
||||
- **출처 신뢰도:** A
|
||||
- **검토 이유:** *(P-Reinforce Phase 1 자동 정규화. 본문 검증 필요.)*
|
||||
### Wave Function Collapse (sketch)
|
||||
```python
|
||||
def wfc(tiles, w, h, adjacency):
|
||||
grid = [[set(tiles) for _ in range(w)] for _ in range(h)]
|
||||
while not all_collapsed(grid):
|
||||
x, y = lowest_entropy(grid)
|
||||
choice = random.choice(list(grid[y][x]))
|
||||
grid[y][x] = {choice}
|
||||
propagate(grid, x, y, adjacency)
|
||||
return grid
|
||||
```
|
||||
|
||||
## 🧬 중복 검사 (Duplicate Check)
|
||||
### Spelunky-style template stitching
|
||||
```python
|
||||
ROOM_TEMPLATES = {
|
||||
"side": ["....", "..S.", "....", ".###"],
|
||||
"drop": [".S..", "....", "###.", "...."],
|
||||
"trap": [["X" if random.random()<.1 else "." for _ in range(4)] for _ in range(4)],
|
||||
}
|
||||
def build_level(plan):
|
||||
"""plan: 4×4 grid of (template_kind)."""
|
||||
return [
|
||||
ROOM_TEMPLATES[kind] for row in plan for kind in row
|
||||
]
|
||||
```
|
||||
|
||||
- **기존 유사 문서:** *(TODO: 인덱서 클러스터 리포트 참조)*
|
||||
- **처리 방식:** UPDATE (자동 정규화)
|
||||
- **처리 이유:** Phase 1 정규화 — 옛 템플릿/누락 필드 보강.
|
||||
### Validation — solvability check
|
||||
```python
|
||||
def is_solvable(grid, start, goal):
|
||||
return bfs_reachable(grid, start, goal)
|
||||
|
||||
## ⚠️ 모순 및 업데이트 (Contradictions & Updates)
|
||||
def regenerate_until_valid(generator, validate, max_tries=100):
|
||||
for _ in range(max_tries):
|
||||
level = generator()
|
||||
if validate(level):
|
||||
return level
|
||||
raise GenerationFailure()
|
||||
```
|
||||
|
||||
- **과거 데이터와의 충돌:** 없음
|
||||
- **정책 변화:** 없음
|
||||
### L-system dungeon grammar
|
||||
```
|
||||
Axiom: ROOM
|
||||
Rules:
|
||||
ROOM → ROOM CORRIDOR ROOM
|
||||
ROOM → ROOM CORRIDOR JUNCTION
|
||||
JUNCTION → ROOM | LOOP_BACK
|
||||
Iterations: 4
|
||||
→ post-process: place geometry, add doors
|
||||
```
|
||||
|
||||
## 🔗 지식 연결 (Graph)
|
||||
## 매 결정 기준
|
||||
| 상황 | Approach |
|
||||
|---|---|
|
||||
| Tight authored feel needed | Template stitching (Spelunky) |
|
||||
| Organic cave / terrain | Cellular automata + erosion |
|
||||
| Strict constraint (city, building) | **WFC** |
|
||||
| Branching dungeon | BSP + grammar |
|
||||
| Open world heightmap | Perlin / Simplex + erosion + biome mask |
|
||||
| Fully ML-driven (2026) | Diffusion + WFC fallback |
|
||||
|
||||
- **Parent:** [[10_Wiki/Topics]]
|
||||
- **Related:** *(TODO: 최소 2개)*
|
||||
- **Opposite / Trade-off:** *(TODO)*
|
||||
- **Raw Source:** 직접 입력
|
||||
**기본값**: Template + WFC hybrid + validation regen-loop.
|
||||
|
||||
## 🕓 변경 이력 (Changelog)
|
||||
## 🔗 Graph
|
||||
- 부모: [[Level_Design]] · [[Procedural_Content_Generation]]
|
||||
- 변형: [[Wave_Function_Collapse]] · [[BSP_Generation]] · [[Cellular_Automata]]
|
||||
- 응용: [[Roguelike_Genre]] · [[Open_World_Terrain]]
|
||||
- Adjacent: [[Base-Layouts-and-Kill-Zones]] · [[Immersive-Sims-Deus-Ex-Thief]]
|
||||
|
||||
| 날짜 | 변경 내용 | 처리 방식 | 신뢰도 |
|
||||
|------|-----------|-----------|--------|
|
||||
| 2026-05-08 | P-Reinforce Phase 1 정규화 (frontmatter + 헤더 표준화) | UPDATE | A |
|
||||
## 🤖 LLM 활용
|
||||
**언제**: 매 roguelike / sandbox / open-world 의 generation system, 매 designer 의 매 toolkit, 매 controllability ↔ variety trade-off discussion.
|
||||
**언제 X**: 매 highly-authored linear narrative — 매 PCG 의 cost > benefit.
|
||||
|
||||
## ❌ 안티패턴
|
||||
- **No validation**: 매 unreachable goal / 매 closed-off key item.
|
||||
- **Over-randomization**: 매 every tile random = 매 chaos, 매 design intent X.
|
||||
- **No reproducibility**: 매 seed 의 expose 의 X — 매 bug repro / 매 speedrun 의 X.
|
||||
|
||||
## 🧪 검증 / 중복
|
||||
- Verified (Shaker / Togelius "Procedural Content Generation in Games" 2016; WFC paper Gumin 2016; Spelunky postmortem GDC 2014).
|
||||
- 신뢰도 A.
|
||||
|
||||
## 🕓 Changelog
|
||||
| 날짜 | 변경 |
|
||||
|---|---|
|
||||
| 2026-05-08 | Phase 1 |
|
||||
| 2026-05-10 | Manual cleanup — algorithm taxonomy, BSP / CA / WFC / template code, validation pattern |
|
||||
|
||||
Reference in New Issue
Block a user