아마존의 관리형 게임 플랫폼 활용하기: gamelift (deep dive) :: 구승모 솔루션즈...
TRANSCRIPT
Amazon GameLift Deep-Dive
멀티플레이어게임의배포/운영/확장을손쉽게
구승모Gaming SA
AGENDA
세션형 게임을 위한 GameLift
Lumberyard와의 관계
GameLift 파고들기
샘플 코드 데모
© 2016, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
잠시 생각해 봅시다…
© 2016, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
멀티 플레이어 게임의서버 확장(Scaling) 문제는 어렵습니다.
© 2016, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Amazon GameLift는 멀티 플레이어 게임의서버 확장/축소를 손쉽게 가능하게 합니다.
© 2016, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
일반적인 주간 서버 사용량 그래프
서버
사용
량
시간
© 2016, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
서버 확충 실패
서버
사용
량
시간
확보된 서버가 커버하는 부분
게임 못하는 플레이어들(대기열 발생만큼의 수익 감소)
© 2016, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
너무 많은 서버 선투자 비용
서버
사용
량
시간
미리 확보한 서버가 커버
낭비되는 비용
© 2016, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
GameLift의 탄력적 스케일링
서버
사용
량
시간
Wasted $
Auto-scaling을 통한비용 최적화가 가능
© 2016, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Amazon GameLift
• 세션형 멀티플레이어 게임 호스팅을 위한관리형 플랫폼
• 플레이어의 상황에 따라 자동으로스케일링(Scale In/Out)
• 전세계적으로 저 지연의(low-latency) 사용자경험 제공
• 중단(downtime)없는 게임 서버 업데이트지원
• 선 투자 비용 없이 사용한 만큼만 지불
3가지 형태의 멀티 플레이어 게임
SessionPersistentAsynchronous
© 2016, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
인기 있는 멀티플레이어 게임의 상당수는 세션형
Gametrics 지표 예
MMOG
Session-based
© 2016, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
설계 및 아키텍팅
프로토타입 제작을 통한 검증
라이브 서비스를 위한 안정화
환경 설정 및 통계 분석용 UI 구성
서비스 Launch
24/7 운영 책임 (coverage)
$
아래 기능 구현 및 작업에는 많은 시간이 소요됨
스케일링 기능에 대한 각종 디버깅 운영 비용 최적화$
© 2016, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
수분 내에 바로 시작 가능
서버 App
업로드
Fleet설정
Scale 정책적용
Play
1 2 3 4
© 2016, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
GameLift와 게임 엔진 Lumberyard와의관계는 대체 무엇입니까?
© 2016, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Lumberyard 구성
Lumberyard의 주요 구성 요소• CryEngine 3.8 기반
• Twitch 통합
• Double Helix Physics Engine
• GridMate
• 새롭게 적용된 네트워크 엔진
• 서버로 사용 가능
• 손쉽게 GameLift에 올려서 사용 가능
– (주의!) GameLift와 의존성 없음
Lumberyard 및 GridMate는 GameLift와 직접적인 의존성 없음
© 2016, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
GridMate?
그 전에 게임 루프 부터…
Inputs
Simulate
Render
Wait
States
events
State State State
Time
© 2016, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
GridMate의 Replica Framework
네트워크 상에서의 복제를 통한 객체간 동기화
Inputs
Simulate
Render
Wait
States
Inputs
Simulate
Render
Wait
States
Compare Compareexchange
© 2016, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
GridMate 좀 더 자세히
원격 복제를 지원하는 크로스플랫폼 네트워크 라이브러리
메시지 전송• 신뢰/비신뢰 모드의 전송 API
1
복제• 네트워크 상에서의 원격지 복제본(replicas) 지원
• 하나의 노드가 복제본을 소유하고 나머지 노드는
프록시(proxy)를 보는 구조
• 복제본은 데이터를 포함하고 RPC 수행 가능
2
세션 관리• 게임 세션(방)을 열고, 검색하고 참여할 수 있는 API
• 콘솔 게임기, 모바일 장치, PC와의 통합 지원
3
특징
• Killer Instinct를 포함한 더블 헬릭스의 다양한
게임에서 사용됨
• 다양한 플랫폼 지원: Windows, Xbox One, PS4,
Android and iOS
• 모듈화된 프레임워크로 타 플랫폼으로의 확장이 용이
• 복제본간 다양한 동기화 기능 제공
• RMI 사용시구버전과의 호환기능 제공
• 네트워크 테스트 및 시뮬레이션을 위한 RTT 변경,
패킷 손실 등의 다양한 기능 제공
© 2016, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
다시 원래 주제인 GameLift로…(Deep Dive)
© 2016, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Build
개발자가 작성한
서버 바이너리
GameLift로
Upload
빌드
© 2016, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Fleet
빌드가 배포된
상태
플레이어가
접속하는 대상
플릿
다수의 EC2
인스턴스
© 2016, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Fleet Overview
Game ServerProcesses
EC2 Instance EC2 Instance
Build
개발자 PlayersFleet
Game Server Processes
© 2016, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
게임 세션 1
Player slot 1
Player slot 2
Player slot 3
Player slot 4
Active
Active
게임 세션 2
Player slot 1
Player slot 2
Player slot 3
Player slot 4
Active
Active
Active
Active
게임 세션 N
Player slot 1
Player slot 2
Player slot 3
Player slot 4
Reserved
서버 프로세스 서버 프로세스 서버 프로세스
EC2 Instance EC2 Instance EC2 Instance
Build
개발자 Players
게임 세션 관리
게임 서버 프로세스 관리
© 2016, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
GameLift 사용법
AWS CLI
빌드 업로드
플릿 설정및 생성
게임클라이언트
접속
적합한게임 세션
검색
1 2 3 4
다양한 종류의 게임 세션 검색(매칭) 기능 제공(빈 방여부, 오래된 순서 정렬, 플레이어 상태 등)
© 2016, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
빌드 업로드
• 게임 서버 실행 파일 및 부속 폴더를 한군데 모아두고
• AWS CLI를 사용하여 GameLift에 업로드aws gamelift upload-build --name <빌드이름> --build-root <폴더> --operating-system <WINDOW_2012 또는 AMAZON_LINUX> --region <리전>
© 2016, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
플릿 설정
• EC2 인스턴스 타입 지정
• 실행 파일 이름, 명령 파라미터, 프로세스 수 지정
• 열어둘 포트, 프로토콜 종류, 허용 IP 대역 지정
• Auto-Scaling 정책 설정
© 2016, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
© 2016, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
© 2016, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
플릿 생성
• 상태변경 순서: Downloading Validating Activating Active• Active 상태가 되면 클라이언트로 부터 접속을 받을 수 있음
© 2016, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
GameLift API 상호작용
게임 서버
(배포된 빌드)
GameLift
서비스
게임 클라이언트
APPAWS SDKGameLift Client API(HTTPs req/res)
© 2016, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
© 2016, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
© 2016, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
GameLift Server SDK
• 게임 서버에 적용• C++ 전용
• Windows Server 및 Amazon Linux 지원
• https://aws.amazon.com/ko/gamelift/getting-started/
• [참고] GameLift Client API• 기존의 AWS SDK 그대로 사용
• 다양한 언어 사용 가능: C++, C#, Java, Python, …
• Unity3D 엔진 전용 SDK 곧 출시
• Xbox Live 및 PlayStation용 미들웨어 곧 출시
© 2016, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
GameLift Tips
• 게임 서버의 로그 및 메모리 덤프 파일• 플릿상에서 동작하는 게임 서버에 대한 디버깅에 용이
• How-to
• 빌드 업로드시 logs 하위 폴더를 같이 업로드
• 각종 Text 로그 및 Dump파일은 logs 폴더에 남기도록 구현
• AWS 관리 콘솔에서 logs폴더의 내용을 모두 받을 수 있음
© 2016, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
• 인증처리• 게임 클라이언트가 호출하는 GameLift API에 대한 인증
체계를 부여할 수 있음
• AWS IAM 적용 가능
• 구글 ID, 페이스북 ID등을 통한 Web Federation 지원
• OpenID Connect (OIDC) 및 SAML 2.0 호환
• Amazon Cognito 사용 가능
• 플릿 인스턴스에 커스텀 프로그램 설치• 게임서버 프로세스 실행 전에 의존성이 있는 프로그램 설치 가능
• Windows는 install.bat, Linux는 install.sh에 스크립팅
• 빌드 업로드시 같이 포함
© 2016, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
GameLift 운영
Web기반의 UI를 통한 운영• API로도 제어 가능
• 각종 성능 지표 모니터링
• 스케일링 상황 모니터링
• 게임 서버에서 발생하는 이벤트 확인
• 게임 세션 및 플레이어 세션 정보 확인
• ALIAS 기능을 통한 무중단 배포 가능
© 2016, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
스케일링 상태 시각화
© 2016, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
게임 세션 및 플레이어 세션 상태 확인
© 2016, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
별명(ALIAS) 기능을 이용한 무중단 배포
ALIAS• Fleet에 대한 별칭을 부여할 수 있는 기능: 일종의 링크
• 게임 클라이언트가 Fleet ID를 몰라도 Alias를 통해 접근 가능
Developer New Players
Build A Fleet A Alias Client
© 2016, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
새로운 업데이트 배포 과정
New Players
Build A Fleet A Alias Client
Developer
Fleet BBuild B
© 2016, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
ALIAS 변경을 통해 새로 업데이트된 플릿 지정
New Players
Build A Fleet A Client
Developer
Fleet BBuild B
Alias
© 2016, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
GameLift 어떠신가요?자, 그럼 바로 사용해 보세요.
© 2016, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
GameLift는 곧 9개 리전으로 확대 적용
지역간 Latency 최소화!
© 2016, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Free Tier 제공
무료로 테스트 해 볼 수 있음• c3.large 인스턴스 타입으로 125시간 무료
• https://console.aws.amazon.com/gamelift/
• 빠르게 테스트해볼 수 있는 샘플 게임 제공
• Amazon GameLift의 Sample Game 항목
• 물리 기반의 8인용 축구 게임
© 2016, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
DEMO(with Sample Code)
© 2016, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
데모 시나리오
GameLift FleetDummyClients(다수의 더미 플레이어 세션)
Player sessions
Viewer(Cocos2d-x client)
- DummyClients게임 세션을 만들고 다수의 플레이어를 투입더미 플레이어들은 주위를 정처 없이(?) 랜덤 로밍
- ViewerCocos2d-x로 만들어진 간단한 게임 클라이언트실제로 이 상황을 확인할 수 있는 프로그램으로 시각화용
https://github.com/zeliard/GameLift
© 2016, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Viewer플레이어
로밍하는더미 플레이어
© 2016, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
감사합니다