4. 01
C++ 언어 기반 게임 완성게임 소스 코딩
Game Engine Source Coding Release Game
개요
Intro
콘솔창 출력의 게임 엔진
WindowConsole 2D GameEngine | Jo Dong Hyun
5. 01
엔진 개발
소스 코딩 게임 개발
Game Engine
Source Coding Release Game
디테일한 구성
Base : C++
Reference : WinAPI Console
Format : Lib
Engine Style : Unity 3D
Base : C++
Method : Main()
Format : cpp
Genre : Realtime Shooting
PlayTime : 10 min
Format : WindowConsole
Intro
WindowConsole 2D GameEngine | Jo Dong Hyun
6. C++ Engine
02
cmd를 이용한 엔진 개발
엔진의 C++ 코드 작성
Engine Detail
FlowUML Detail
WindowConsole 2D GameEngine | Jo Dong Hyun
7. UML 구성
FlowUML
Application
- cmptList: Component[]
+ GetComponent()
GameMain
- objList : Vector<GameObject*>
+ InputObj : void
+ ObjFind : GameObject*
+ Run : void
GameObject
Component
UI_Panel
Times
- deltaTime
- timeScale
Vector2
- x, y: int
Rect
- Right, Top, Left, Bottom: int
Input
+ GetAxis(): int
Resource
+ Init()
+ Release()
UI_Text
UI_Button
Collider
- rect: Rect
Animator
- sprite: char***[]
- color: char***[]
- aniTime: float[]
ConsoleRenderer
- sprite: char***
- size: Vector2
- pivot: Vector2
- sprite: char***
- size: Vector2
+ OnClick(): void
- sprite: char***
- size: Vector2
- sprite: char***
- size: Vector2
- color: int**
+ Create(): void
+ Draw(): void
Buffer
- position : Vector2
Scene
+ Instantiate : GameObject*
- gameOject : GameObject*
- Vector : Vector2
- Layer : int
+ SetActive: void
gameObject
GetComponent()
+ Start : void
+ Update : void
+ OnEnable: void
+ OnDisable: void
+ Start : void
+ Update : void
- size: Vector2
+ ResetBuff: void
+ PrintBuff: void
- buff: char***
- size: Vector2
- position: Vector2
엔진의 핵심
게임이 업데이트되는 곳
게임의 구성 요소들
Scene은 GameObject들로 구성
게임을 이루는 시스템적 요소들
입출력, 시간, 벡터 등
윈도우콘솔 출력버퍼
더블버퍼링
각종 기능들
GameObject에 붙혀서 사용
C++ Engine
02
Detail
WindowConsole 2D GameEngine | Jo Dong Hyun
8. 게임오브젝트들 설정
컴포넌트들 설정
장면(Scene) 설정 엔진 작동(Run)
버퍼(Buffer) 설정
Scene
Buffer
main()
SceneGameObject
Component
Component
Component
Buffer
엔진의 작동 과정
FlowUML
Run
C++ Engine
02
Detail
GameMain
WindowConsole 2D GameEngine | Jo Dong Hyun
10. GameMain의 흐름
UML
Title Scene
End Of Game
Tutorial Scene
Play Scene
START
END
Run()
LoadScene()
EOG
Instantiate() : 게임오브젝트 생성
SetBuffer() : 버퍼 생성
AddScene() : 씬 추가 및 설정
실행 간격 : FPS
Init() : 오브젝트 초기화
반복 업데이트 : Update()
씬 불러오기 : LoadScene()
C++ Engine
02
GameMain
Flow Detail
WindowConsole 2D GameEngine | Jo Dong Hyun
11. 출력 공간(버퍼)를 설정
main() 함수 코딩
Flow DetailUML
main()
Scene 설정
SortingLayer, Input 등 시스템 설정
GameMain: Update() 실행
C++ Engine
02
WindowConsole 2D GameEngine | Jo Dong Hyun
13. 게임오브젝트의 구성
FlowUML
GameObject.cpp
기본값 설정
저장된 Component 리스트
Component 추가/관리
GameObject 켜기/끄기
오브젝트 회전
Variable
Method
Vector2 position
bool isActive
int angle
int LengthX
int LengthY
Component*[] componentList
Resource*[] resourceList
Init()
AddComponent()
GetComponent()
SetActive()
GetActive()
Rotation()
Release()
컴포넌트를 추가
Component 기본값 설정
C++ Engine Detail
02
WindowConsole 2D GameEngine | Jo Dong Hyun
15. 컴퍼넌트(스크립트)의 구성
FlowUML
Component(Script)
인스턴스화
컴포넌트 가져오기
오브젝트 회전
GameObject 호출
초기화
업데이트(반복)
오브젝트 활성화 / 비활성화
메모리 해제
Variable
Virtual Method
Method
bool isActive
Instantiate()
Instantiate()
Start()
Update()
OnEnable()
OnDisable()
GetCompoent()
Rotation()
Release()
bool isRenderer
bool isUI
GameObject* gameObject
Virtual 함수
Component의 멤버함수
GameObject의 멤버함수
C++ Engine Detail
02
WindowConsole 2D GameEngine | Jo Dong Hyun
16. 화면(cmd) 출력담당
UI 등 기타 컴퍼넌트들
충돌판정 체크 애니메이션 설정
디폴트 컴퍼넌트들
FlowUML
ConsoleRenerer
UI_Panel
UI_Text
UI_Button
. . .
Collider Animator
C++ Engine Detail
02
WindowConsole 2D GameEngine | Jo Dong Hyun
17. 2차원 위치 / 좌표값 아스키 문자 이미지 시간에 관한 설정
시스템적인 요소들
FlowUML
Vector2 / Rect Resource Time
키보드 입력
Input
C++ Engine Detail
02
WindowConsole 2D GameEngine | Jo Dong Hyun
18. 03
Shooting Game
Cmd를 이용한 엔진 개발
엔진구조를 사용, 실시간(초당2프레임)으로 입력과 출력을 처리하는 윷놀이 게임
ProtoType
Text Buffer
Image Buffer
WindowConsole 2D GameEngine | Jo Dong Hyun
20. Shooting Game
03
Scene 구성
Start: Tutroial로 이동
Title Scene Tutorial Scene Play Scene
Load: Play로 이동
5가지 스탭을 통한 연습
보스를 격파하면 클리어
적의 공격에 맞서서 보스까지 진행
WindowConsole 2D GameEngine | Jo Dong Hyun