3D Game Programming 王銓彰 kevin.cwang@msa.hinet.net 1 課程大綱 Introduction to Game Development (3hr) Game System Analysis (3hr) The Game Main Loop (3hr) 3D Game Engine Training (TheFly3D) (6hr) Game Mathematics (3hr) Geometry for Games (3hr) Advanced Scene Management System (6hr) Terrain (3hr) Game AI (6hr) Game Physics (3hr) Game FX (3hr) Network Gaming (3hr) Introduction to MMOG (3hr) The Non-3D Parts (3hr) 2 課程要求 One Term Project The Students will divide into several teams Use TheFly3D Game Engine to code a 3D Real-time Strategy Game The Teacher will Provide Graphics Materials Two Examinations Homework will be closely coupled with the term project 3 王銓彰 目前 學歷 昱泉國際股份有限公司 技術顧問 數位內容學院 專任講師 / 顧問 資策會多媒體研究所 專案顧問 台灣大學土木工程學系畢業 資歷 97-03 96-96 93-96 90-93 89-90 昱泉國際股份有限公司 技術長 虛擬實境電腦動畫股份有限公司 研發經理 西基電腦動畫股份有限公司 研發經理 國家高速電腦中心 助理研究員 台灣大學土木工程學系 CAE Lab 研究助理 4 王銓彰 Game作品 昱泉國際 DragonFly 3D Game Engine – M2神甲奇兵, VRLobby, 天劍記 Lizard 3D Game Engine – 幻影特攻、笑傲江湖 I & II、神鵰俠侶 I & II、風雲、小李飛刀、笑傲江 湖網路版、怪獸總動員、聖劍大陸、笑傲外傳 西基電腦動畫 Ultimate Fighter – 1st Realtime 3D fighting game in Taiwan 5 王銓彰 專長 (Expertise) 3D Computer Graphics Geometric Modeling Numerical Methods Character Animation Photo-realistic Rendering Real-time Shading Volume Rendering 6 王銓彰 應用領域 (Applications) 即時3D遊戲開發 (Real-time 3D Game Development) 電腦動畫 (Computer Animation) 虛擬實境 (Virtual Reality) 電腦輔助設計 (Computer-aided Design) 科學視算 (Scientific Visualization) 7 Introduction To Game Development 8 Introduction to Game Dev Game Platform Game Types Game Team Game Development Pipeline Game Software System Tools 9 Game Platform PC Single player Match Makings MMOG (Massive Multi-player Online Game) Web-based Games Console Sony PS2 MS Xbox Nintedo GameCube Arcade Mobile GBA Hand-held 10 Game Development on PC Designed for Office Application Not for Entertainment A Virtual Memory System Unlimited memory using But Video Memory is Limited PCI/AGP might be a Challenge Open Architecture Compatibility Test is Important Development is Easy to Setup 11 Game Development on Console Specific Hardware Designed for Games Single User / Single Process OS In General no Hard Disk Drive (??) Closed System Very Native Coding Way Limited Resources Proprietary SDK Hardware related features Memory One Console runs, the others do! 12 Game Types RPG (Role playing games) AVG (Adventure games) RTS (Real-time strategy games) FPS (First-person shooting games) MMORPG SLG (???, 戰棋) Simulation Sports Puzzle games Table games 13 Game Team組成 開發團隊 製作人 執行製作人 企劃團隊 程式團隊 美術團隊 行銷業務團隊 測試團隊 遊戲審議委員會 14 遊戲製作人 (Producer) Team Leader (always) 資源管理 (Resource Management) 行政管理 (Administration) 向上負責 (Upward Management) 專案管理 (Project Management) 15 遊戲執行製作人 專案管理執行 (Project Management) Daily 運作 House Keeping Not full-time job position 16 遊戲企劃 故事設計 (Story Telling) 腳本設計 (Scripting) 玩法設計 (Game Play Design) 關卡設計 (Level Design) 遊戲調適 (Game Tuning) 數值設定 (Numerical Setup) AI 設計 (Game AI) 音效設定 (Sound FX Setup) 場景設定 (Scene Setup) 17 遊戲美術 場景 (Terrain) 人物 (Character) 建模 (Models) 材質 (Textures) 動作 (Motion / Animation) 特效 (FX) User Interface 18 遊戲程式 遊戲程式 (Game Program) 遊戲開發工具 (Game Tools) Level Editor Scene Editor FX Editor Script Editor 遊戲Data Exporters from 3D Software 3dsMax / Maya / Softimage Game Engine Development Online Game Server Development 19 遊戲開發流程 Basic Procedures for Game Development Idea Proposal Concept Approval Production Prototype 發想 (Idea) 提案 (Proposal) 製作 (Production) 整合 (Integration) 測試 (Testing) 除錯 (Debug) 調適 (Tuning) Integration Pre-alpha Testing Debug Alpha Tuning Beta Final > Concept Approval > 雛形 (Prototype) > Pre-alpha > Alpha > Beta 20 遊戲發想 (Concept Design) 遊戲類型 (Game Types) 遊戲世界觀 (Game World) 故事 (Story) 遊戲特色 (Features) 遊戲玩法 (Game Play) 遊戲定位 (Game Product Positioning) Target player Marketing segmentation / positioning 風險評估 (Risk) SWOT (Strength/Weakness/Opportunity/Threat) 21 遊戲提案 (Proposal) 系統分析 (System Analysis) GDD 撰寫 (Game Design Document) MDD 撰寫 (Media Design Document) TDD 撰寫 (Technical Design Document) 遊戲專案建立 (Game Project) Schedule Milestones / Check points Risk management 測試計畫書 團隊建立 (Team Building) 22 遊戲開發 (Production) 美術量產製作 Modeling Textures Animation Motion FX 程式開發 (Coding) 企劃數值設定 … 量產 ! 23 遊戲整合 (Integration) 關卡串聯 (Level Integration) 數值調整 (Number Tuning) 音效置入 (Audio) 完成所有美術 程式與美術結合 Focus Group (User Study) Release some playable levels for focus group 24 遊戲測試 (Testing) Alpha 測試 除錯 (Debug) Beta 測試 數值微調 Game play 微調 對線上遊戲而言 (MMOG) 封閉測試 (Closed Beta) 開放測試 (Open Beta) 極限測試 (Critical Testing) 線上遊戲才有 25 Bug Bug 分級 (Bug Classification) A Bug B Bug C Bug S Bug Principles Bug 分級從嚴 Tester vs Debugger Bug Bug Classification Bug Dispatch Debug N ? Verify Y FAQ 26 Game Software System Game NPC System Virtual Agent Trading System Fighting System FX System Terrain Character Dynamics Sound FX Collision 3D Scene Mngmt 3D Graphics API 2D Sprite Game AI Story Gamepad 2D API Hardware Script System UI Audio Network Input Device OS API Game Play Layer Engine Layer System Layer 27 System Layer - APIs 3D Graphics API 2D API DirectX 9.0 SDK - DirectMedia Win32 GDI Input Device DirectX 9.0 SDK – Direct3D OpenGL 2.0 DirectX 9.0 SDK – DirectInput Audio DirectX 9.0 SDK – DirectSound / Direct3DSound / DirectMedia OpenAL 28 System Layer - APIs OS API Win32 SDK MFC Network DirectX 9.0 SDK – DirectPlay Socket library 29 Engine Layer 3D Scene Management System Scene Graph Shaders 2D Sprite System Audio System Gamepad Hotkey Mouse Timers Network DDK Interface 30 Engine Layer Terrain Advanced Scene Management – Space Partition BSP Tree Octree Character System Motion Blending Techniques Dynamics Collision Detection SoundFX User Interface 31 Game Play Modula NPC (Non-playable Characters) Game AI Path Finding Finite State Machine … Avatar Combat System FX System Script System Trading System Number System … 32 Game Dev Tools Visual C/C++ .net 2003 Visual C/C++ 6.0+ SP5 DirectX Current 9.0c NuMega BoundsChecker Intel vTune 3D Tools 3dsMax/Maya/Softimage In-house Tools 33 Game System Analysis 34 What Will We Talk Here Idea about System Analysis (SA) Mind mapping Case Study - Our Term Project 35 Why SA ? (1/2) For 程式結構 Analysis To Identify 工作量 Programs/tools under development For 資源 management Program modulus Tools Man month How many programmers ? Development tools ? Specific tools ? For Job Dependency Analysis 36 Why SA ? (2/2) To make 技術可行性 Analysis Pre-processor for R&D ? Technical design document Project management Bridge from Game Design to Programming 37 Something about SA No Standard Procedures It’s Not a Theory, Just Something Must Be Done! You Can Have Your Own Method UML Mind mapping (心智圖法) This is the one we will use for this course … 38 The SA Steps I Used Brainstorming Integration Dependency Analysis Create the Project Write the Technical Design Document (TDD) 39 SA – Brainstorming Based on the Game Design to Put Everything As Many As You Could Use Mind mapping Including Game system Program modulus Camera / PC control / NPC AI / UI / FX /… Tools Combat / Village / Puzzle / … Level editor / Scene editor / … Entities in games Characters / vehicle / terrain / audio / … 40 SA – Integration Confirm the Resource Limitation Technical Implement Possibility Put All Related Items Together Man Month Analysis How many ? Who ? Jobs/System Identification 41 SA – Dependency Analysis Sort the Jobs By dependency By programmers Prototype for scheduling 42 SA – Create the Project Scheduling Job Assignment Resource Allocation Check points Milestones Risk Management Policy 43 SA – Write the TDD Specification Resources Design in details Implement Methods (工法) Algorithms The Project Output in Each Milestone SOP (optional) 44 Mind Mapping 心智圖法 A Radiant Thinking Tool Applications 讀書心得 Proposal 上課筆記 遊記 System Analysis … Reference Program Visio MindManager Tony Buzan, Barry Buzan, “The Mind Map Book: How to Use Radiant Thinking to Maximize Your Brain's Untapped Potential” 45 46 47 Mind Mapping Demo Use MindManager X5 pro Developed By MindJet 48 Term Project System Analysis 49 Game Design (1/3) Real-time Strategy War Game Mission-based Levels Mouse-driven Controls Player vs Computer State-based AI Group Movement 50 Game Design (2/3) PC – Controlled by Player “Blue Team” AI Move Attack Standby Anti-attack NPC – Controlled by Computer “Red Team” - Enemy Triggered by time table AI Move Standby Anti-attack Attack 51 Game Design (3/3) Game AI Finite state machine Path finding Steering behavior 3D A* Flocks / Schools / Herds http://www.red3d.com/cwr/boids/ AI Game Programming Wisdom, Charles River Media (1 & 2) 52 System Analysis Run MindManager.exe 53