You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Map Size: mapLength (경로 방향), mapWidth (수직 방향)
Lane:
├── laneCount: 레인 수 (1~5)
├── laneWidth: 레인 폭 (월드 유닛)
├── laneCurve: 곡선도 (0=직선, 1=최대)
├── waypointCount: 경로당 웨이포인트 수
└── direction: LeftToRight / RightToLeft / BottomToTop / TopToBottom
endpointRadius: 시작/끝 보호 반경
Module Pool / Strategy / Placement: Arena와 동일
주의: Scatter는 Arena 전용 (Lane에서 사용 시 무시됨)
5. DungeonMapSettings
Map Size: mapWidth, mapHeight
BSP:
├── minRoomSize: 방 최소 크기 (셀 단위)
├── maxRoomSize: 방 최대 크기
├── bspDepth: 분할 깊이 (3~6, 높을수록 방 많음)
└── roomPadding: 리프 대비 방 크기 비율 (0.4~0.9)
Corridor:
├── corridorWidth: 복도 폭 (셀 단위)
└── extraCorridorRate: 추가 루프 비율 (0~0.5)
coreRadius: 방 중앙 보호 반경
Module Pool / Strategy / Placement: Arena와 동일
주의: Scatter는 Arena 전용. Dungeon은 Cluster 사용 권장
6. 씬 설정
빈 GameObject 생성 → ProceduralMapManager 컴포넌트 추가
Settings 필드에 위에서 만든 SO 드래그
Inspector에서 Generate / Random / Clear 버튼 사용
또는 메뉴: NetcodeFramework > Procedural > Generate Map Preview
7. 카테고리별 용도
Category
용도
경로 체크
벽 충돌
Ground
바닥 타일
-
-
Wall
외벽 (Arena/Lane) / 방 경계 (Dungeon)
안 함
-
Obstacle
내부 장애물
함
함
Cover
엄폐물
함
함
Hazard
위험 지역
함
함
Decoration
장식
함
함
8. Generator 직접 사용 (Manager 없이)
// NetcodeFramework Manager 없이도 Generator를 직접 사용 가능varsettings=ScriptableObject.CreateInstance<ArenaMapSettings>();// ... Inspector에서 설정하거나 코드로 설정 ...vargenerator=newArenaMapGenerator(settings,transform);generator.Generate(12345);// 맵 데이터 읽기varmodules=generator.GetPlacedModules();varzone=generator.GetZoneAt(worldPosition);boolcanPlace=generator.IsPlaceableAt(worldPosition);
9. 런타임 쿼리 API
// 배치된 모듈 목록IReadOnlyList<PlacedModule>modules=generator.GetPlacedModules();// 각 모듈의 정보foreach(varminmodules){m.Instance;// GameObjectm.Data;// MapModuleData SOm.WorldBounds;// 월드 바운드m.Zone;// MapZone (Center/Inner/Middle/Edge/Corner)}// 위치 쿼리MapZonezone=generator.GetZoneAt(position);// 이 위치의 Zoneboolinside=generator.IsInsideBounds(position);// 맵 내부인지boolplaceable=generator.IsPlaceableAt(position);// 배치 가능한지
10. 새 토폴로지 추가 방법
Data/MyMapSettings.cs — MapGeneratorSettings 상속
Generators/MyMapGenerator.cs — IMapGenerator 구현
ProceduralMapManager.cs — switch에 분기 추가
(선택) Zones/MyZoneProvider.cs — IZoneProvider 구현
11. 새 배치 전략 추가 방법
Strategies/MyStrategy.cs — IObstacleStrategy 구현
Data/MapShape.cs — ObstaclePlacementStrategy enum에 값 추가
MapGeneratorHelper.GetActiveStrategies() — 분기 추가
12. 경로 검증 API
// 두 지점 간 경로 확인boolconnected=PathValidator.IsPathConnected(posA,posB);// 맵 전체 4방향 검증boolvalid=PathValidator.Validate(settings,parent);
// 저장: 시드만 저장하면 동일 맵 재현 가능intsavedSeed=generator.CurrentSeed;PlayerPrefs.SetInt("MapSeed",savedSeed);// 로드: 같은 시드 + 같은 설정 → 100% 동일 맵generator.Generate(PlayerPrefs.GetInt("MapSeed"));
15. 의존성
필수: com.unity.ai.navigation (NavMesh)
필수: NetcodeFramework (EventBus, MonoSingleton)
선택: Manager 없이 Generator 직접 new() 시 MonoSingleton 불필요
16. 런타임 모듈 배치/제거
// 배치 가능 확인boolcanPlace=generator.CanPlaceModule(position,moduleData);// 배치PlacedModule?result=generator.PlaceModuleAt(position,moduleData);if(result.HasValue)Debug.Log($"배치 성공: {result.Value.Instance.name}");// 제거boolremoved=generator.RemoveModuleAt(position);
17. 전체 API 요약
API
용도
Generate(seed)
맵 생성
Clear()
맵 제거
IsGenerated
생성 여부
CurrentSeed
현재 시드
CellSize
셀 크기
GetSettings()
설정 SO
GetPlacedModules()
배치된 모듈 목록
GroundTileCount
Ground 타일 수
IsInsideBounds(pos)
맵 범위 내
IsPlaceableAt(pos)
배치 가능 여부
GetZoneAt(pos)
Zone 조회
CanPlaceModule(pos, data)
모듈 배치 가능
PlaceModuleAt(pos, data)
런타임 배치
RemoveModuleAt(pos)
런타임 제거
About
Procedural Map Generator System - 6 topologies (Arena/Lane/Dungeon/OpenField/GridBoard/Track)