권성태, 설계 - 간접화의 이해, ndc2010
TRANSCRIPT
NDC 2010 / devCAT Studio / Nexon Corp.
- 설계 -
간접화의 이해devCAT 스튜디오 / GTR 팀
권성태
2010 Nexon Developers Conference Programming Session
2010.5.25
version.4 / censored
1
NDC 2010 / devCAT Studio / Nexon Corp.
Architecture - Understanding of Indirection
권성태게임 엔진/시스템 전반
리드 프로그래머허스키 익스프레스 TD
현 GTR팀
zelong, 2001~
2
NDC 2010 / devCAT Studio / Nexon Corp.
Architecture - Understanding of Indirection
설계
주로 클라이언트 설계 이야기
3
NDC 2010 / devCAT Studio / Nexon Corp.
Architecture - Understanding of Indirection
게임 개발이란 게...
여느 소프트웨어와 마찬가지로
4
NDC 2010 / devCAT Studio / Nexon Corp.
Architecture - Understanding of Indirection
지저분해질 수밖에 없나
변화하는 요구사항
프로토타입의 연속
5
NDC 2010 / devCAT Studio / Nexon Corp.
Architecture - Understanding of Indirection
천천히 개발하면 됩니다
...와 같은 이야기를 하려는 건 아닙니다.
6
NDC 2010 / devCAT Studio / Nexon Corp.
Architecture - Understanding of Indirection
결합도 줄이기Loose Coupling
변화를 설계하는 법
커플이 손을 잡고 싶은데못 잡고 있는 그림
7
NDC 2010 / devCAT Studio / Nexon Corp.
Architecture - Understanding of Indirection
결합도 줄이기 방법
메시지 버스
인터페이스 클래스
프록시, 브릿지, 플러그인 패턴
SOA
레이어드 아키텍처
컴포넌트 기반 아키텍처
8
NDC 2010 / devCAT Studio / Nexon Corp.
Architecture - Understanding of Indirection
간접화 층 추가
오늘 소개하려는 방법
레이어드 아키텍처의 일종
9
NDC 2010 / devCAT Studio / Nexon Corp.
Architecture - Understanding of Indirection
현실의 어려움
촉박한 마일스톤
좋은 건 알지만...
커져만 가는코드베이스
계층...추가해도될까요?
나의...코드는그렇게
무너졌다
계층을 추가하자고미소녀에게 제안,하지만 딱 잘라거절당하는장면
10
NDC 2010 / devCAT Studio / Nexon Corp.
Architecture - Understanding of Indirection
한 계층만 추가
이것만 실행해도 조금 더 행복
많은 걸 바라지 않습니다
11
NDC 2010 / devCAT Studio / Nexon Corp.
Architecture - Understanding of Indirection
AGENT Layer
Agent = Entity Delegate
Abstract Game Entity and Technique
12
NDC 2010 / devCAT Studio / Nexon Corp.
Architecture - Understanding of Indirection
Agent 계층 위치
게임플레이로직
AgentLayer
캐릭터월드액션세부구현
게임엔진
13
NDC 2010 / devCAT Studio / Nexon Corp.
Architecture - Understanding of Indirection
Agent 시스템 사용// 월드 생성AgentWorldPtr world = AgentSystem::CreateWorld(“Seoul”, DefaultCanvas);
// 플레이어AgentObjectPtr player = world->CreateAgent(“Citizen”, position);
// 펫AgentObjectPtr pet = world->CreateAgent(“Cat”, player->GetPosition());pet->Follow(player);
// 소지품AgentObjectPtr camera = world->CreateAgent(“LeicaM”, player->GetPosition());player->AttachTo(camera, “RightHand”);
게임 프로그래머는 이 정도만 알면게임 세계를 구축할 수 있다.
14
NDC 2010 / devCAT Studio / Nexon Corp.
Architecture - Understanding of Indirection
캐릭터는 원래 만든다?세부 구현된 캐릭터와는 별개의 오브젝트
1) 세부 구현의 변경 가능성을 열어두어야 한다.2) 변경점이 다른 영역에 영향을 주면 안 된다.
조종석에 공격/후퇴/폭격/정찰버튼만 만들 순 없다.
15
NDC 2010 / devCAT Studio / Nexon Corp.
Architecture - Understanding of Indirection
만능 오브젝트?AgentObject는 Proxy에 가깝다.
다양한 기능은 별도로 구현한다. (확장과 데이터 드리븐)
AgentObject
Human
Cat
Camera
User
extension
DATA
16
NDC 2010 / devCAT Studio / Nexon Corp.
Architecture - Understanding of Indirection
Agent 레이어의 핵심1) 추상화 모델을 중심으로 관리할 코드를 나눔.
2) 상위 모델 구현자가 쉽게 월드를 다룬다.
3) 하위 모델 구현자가 마음껏 기술과 설계를 적용.
인벤토리, 상점파티, 퀘스트 ...
캐릭터, 아이템지형과 프랍
AgentLayer
하위 구현/설계 변경플레이 구현
설계 변경거의 없음
17
NDC 2010 / devCAT Studio / Nexon Corp.
Architecture - Understanding of Indirection
간접화 계층 개발 난관
추상적인 인터페이스를 미리 준비하다 보면당장 써야할 기능을 구현 못함.
w
변신 기능이 그렇게어려워?
다른 객체 간 변신이 가능한추상화 모델을 새로 만들고
거기에 맞게 코드갈아엎고 있어요...
* 이런 게 과연 예산을 따는 근거가 되는가.
18
NDC 2010 / devCAT Studio / Nexon Corp.
Architecture - Understanding of Indirection
개발주기에 맞춰 개발
너무 빠르면 난감하다
19
NDC 2010 / devCAT Studio / Nexon Corp.
Architecture - Understanding of Indirection
초기: 하부 구현 노출프로토타이핑이 최우선
Human
Cat
World
PrototypeApp.
하부 구현도 매일같이 변화추상화 어차피 불가능한 시기
오버하지 말고 단순한 스파게티로 선방
20
NDC 2010 / devCAT Studio / Nexon Corp.
Architecture - Understanding of Indirection
게임 본체 제작이 시작본체를 조립하는 시기는 따로 있다.
Human
Cat
World
게임 서비스구현
주로 네트워크가 붙고 서비스가 구현되는 시기하부 구현도 안정화 되어 추상화 가능!
AgentLayer
스파게티가 아주 커지기 전에 빨리 격리
21
NDC 2010 / devCAT Studio / Nexon Corp.
Architecture - Understanding of Indirection
효과1) 그래픽/액션 등 하부 구현의 버그는 플레이 코드와 전혀 관계 없이 수정되었다.
2) 월드 구축하는 방법이 쉬워서 코드를 망칠 일도 없고 교육 비용도 적었다.
3) 게임 플레이와 관계 없이 신기술을 적용할 수 있었다.
4) 프로토타입 시절의 잔재를 천천히 제거할 수 있었다.
22
NDC 2010 / devCAT Studio / Nexon Corp.
Architecture - Understanding of Indirection
간접화의 힘
적절한 간접화는 개발 환경을 개선시킨다.
23
NDC 2010 / devCAT Studio / Nexon Corp.
Architecture - Understanding of Indirection
주의할 점
24
NDC 2010 / devCAT Studio / Nexon Corp.
Architecture - Understanding of Indirection
명확한 추상화 모델
간접 계층을 만든다고 능사가 아니다.
주의할 점 (1)
프로그래머가 이해하기 쉬운 모델이 필요때로는 직접 연결이 시스템을 단순하게 만든다
uuuu
u uu u
u
마음이깨끗해지는 음료
어른의 맛음료
* 그냥 콜라와 커피라고 해라...
25
NDC 2010 / devCAT Studio / Nexon Corp.
Architecture - Understanding of Indirection
적절한 개발 시기
억지로 추상화/간접화 하면 스파게티만 늘림
주의할 점 (2)
개발주기를 관찰하고 계층을 추가할 시기를 고른다.
“지금이다!” 그림
26
NDC 2010 / devCAT Studio / Nexon Corp.
Architecture - Understanding of Indirection
너무 일반화하지 말 것
모든 게임에 쓰일 추상화 모델을 만들지 말자.
주의할 점 (3)
단순하고 특수한 것이 일반적인 스파게티보단 낫다.
27
NDC 2010 / devCAT Studio / Nexon Corp.
Architecture - Understanding of Indirection
결론간접화는 복잡도를 줄이는 유용한 방법이다.
이해하기 쉬운 추상화 모델이 반드시 필요하다.
게임에는 명확한 간접화 계층이 있다.
상위플레이
AgentLayer
하위플레이
게임엔진
이 계층 분리는 개발 복잡도를 크게 낮춰준다.
28
NDC 2010 / devCAT Studio / Nexon Corp.
Architecture - Understanding of Indirection
끝고맙습니다.
29