Download - GMNG 4312 –Game Engines
Uni
vers
ity
of H
oust
on –
Vi
ctor
ia
GMNG 4312 –Game Engines
Unit 01: Introduction
Alireza Tavakkoli, Ph.D.
1
University of H
ouston – Victoria
Objectives Learn about game development Game Engine Terminologies Game Genres Game Engine Survey
2
University of H
ouston – Victoria
Introduction A Long Time Ago
Games
70’s Toys Now $Million Biz!
Ubiquitous Game
Engines!
3
University of H
ouston – Victoria
A Game Engine?
So what is a Game Engine? Reusable Software Easy to manipulate Multi-platform
platform independence
Examples?
4
University of H
ouston – Victoria
Basic Game Engine Components Core Components
Rendering Engine Collision and Physics engine Animation System Audio System Game World Object Modeler Artificial Intelligence System Etc.
5
University of H
ouston – Victoria
What We Cover Overall Theories
Architecture of industrial grade engines Game development team organizations Major game engine sub-systems Genre-dependent vs. Genre-agnostic systems Game and Engine boundaries
Practical Systems Unreal OGRE Unity
Tools and Techniques Logical vs. Physical software architecture Revision systems and software development
environment6
University of H
ouston – Victoria
Typical Game Development Team
Team Structur
e
Engineers
Artists
Game Designe
rsProduce
rs
Other Staff
7
University of H
ouston – Victoria
Engineers Software design and implementation
Runtime Programmers Engine and Game Itself
Tools Programmers Offline tools
Example?
Sub-engine system Engineers AI/Rendering/Physics/etc. Gameplay
Scripting and gameplay programmers Lead Engineers
Technical Director (CD) and Chief Technology Officer (CTO)
8
University of H
ouston – Victoria
Artists “Content is king.”
Concept artists Technical artists
3D Modelers Texture artists Lighting artists
Animation Animators Motion Capture actors
Audio Sound designers Voice actors Composers
9
University of H
ouston – Victoria
Game Designers Design interactive portion of the player’s
experience. Gameplay
Senior (Macro-level) designers Overall feel of the game
Story chapter seq. goals and objectives Micro-level designers
Each level individually Geometry Keypoints and logistics Etc.
Writers (some can afford it!)10
University of H
ouston – Victoria
Producers and Other Staff Producers
Manage the scheduling and HR Liaisons for financing, legal, marketing, etc.
Other Staff IT Marketing Etc.
Publishers and Studios Marketing and manufacture of the game title.
11
University of H
ouston – Victoria
What is a Game? So what is a game?
General Terminology Monopoly, chess, sports, etc.
In Academia Game theory
In Digital 3D images in virtual worlds Even 2D older versions!
Raph Koster: ”A game is an interactive experience that provides
the player with an increasingly challenging sequence of patterns which he or she learns and eventually masters”.
12
University of H
ouston – Victoria
Video Games as Soft Real-Time Simulations Soft Real-Time Interactive Agent-based
Computer Simulation Imaginary worlds
Approximation and Simplification of Complex Mathematics SIMULATION!
Responsive Use human/player’s input and react to it
INTERACTIVE! One/more Opponents
Each object is potentially dynamic AGENT_BASED!
Deadlines Each action must happen at the time they are
supposed to! SOFT REAL-TIME!
Missed deadlines won’t be catastrophic! 13
University of H
ouston – Victoria
Mathematical Models and Game Loop
Analytical vs. Numerical Models Analytical
y(t) = ½ g t2+v0t+y0
Numerical y(t+Dt)=F(y(t),y’(t),y”(t))
Can anyone see the difference between these two models?
In Games Use Numerical models Each game state from its
previous state(s). Game Loop!
14
University of H
ouston – Victoria
What is a Game Engine Doom First Person Shooter 1st Game
Engine Separation between
core software component rendering, collision detection system
the art assets Models, objects, gameplay, etc.
Value? Reusability! Modability! Licensing!
Lines between game and engine is often blurry! 15
University of H
ouston – Victoria
What Differentiates Game Engine from Game Data-driven Architecture
No specific game rules No object specific rendering Extensible
Efficiency vs. Extensibility Trade-offs!
Optimization vs. generalization!
PacMan Hydro Thunder Engine
Quake III Unreal Probably Impossible
Just for 1 Game
Customize for Similar Games
Customize for Similar Game Genre
Customize for Any Game Genre
16
University of H
ouston – Victoria
Engine Difference Across Genres Similar in All Game Genre
User input 3D mesh rendering Powerful audio system Heads-Up Display (UHD), etc.
Example of a Soft Engine (UNREAL) First person shooter Unreal Tournament 3rd person shooter Gears of War Action-adventure Grimm Racing Game Speed Star
17
University of H
ouston – Victoria
Game Genres First Person Shooters (FPS)
Quake, Unreal Tournament, Half-Life, Counter-Strike, Call of Duty.
18
University of H
ouston – Victoria
Game Genres (continued) First Person Shooters (FPS)
Slow on-foot roaming Modern movements
On-foot Locomotion, driving, flying, etc. Small view level (potentially large)
Possibly vast outdoors as well Most technologically challenging!
Why? Immersion in virtual reality! Technologies:
Efficient 3D rendering Responsive camera control High fidelity animation Hand held weaponry Forgiving character collision models (floaty) High fidelity AI Small scale multiplayer
19
University of H
ouston – Victoria
Game Genres (continued) First Person Shooters (FPS)
Adapting to large scale maps Binary Space partitioning
20
University of H
ouston – Victoria
Game Genres (continued) Third Person Shooters (FPS)
Space Panic, Donkey Kong, Pitfall, Super Mario Brothers!
21
University of H
ouston – Victoria
Game Genres (continued) Third Person Shooters (FPS)
Can be 3D like Super Mario 64 and Galaxy!
22
University of H
ouston – Victoria
Game Genres (continued) Third Person Action/Adventure(FPA)
Ghost Recon, Gears of war, Uncharted: Drake’s Fortune
23
University of H
ouston – Victoria
Game Genres (continued) Third Person vs. First Person
More emphasis on character body, animation, locomotion
More fidelity in player character animation What about online multiplayer FSPs?
Third Person Technologies: Moving platforms and geometry Puzzles Follow camera Complex camera collision system
Never clip through background geometry and foreground objects
24
University of H
ouston – Victoria
Game Genres (continued) Fighting Games
Two player humanoids like Tekken, Soul Calibur, etc.
25
University of H
ouston – Victoria
Game Genres (continued) Fighting Games
Two player humanoids like Tekken, Soul Calibur, etc.
Technologies Fighting animations Accurate hit detection Complex user input systems Crowds; typically static backgrounds with semi-
random movements Close-up cameras:
Little or no world subdivision and occlusion culling However!
26
University of H
ouston – Victoria
Game Genres (continued) Fighting Games
State-of-the-art like Fight Night
Technologies Fighting animations Accurate hit detection Complex user input systems Crowds; typically static backgrounds with semi-
random movements Close-up cameras:
Little or no world subdivision and occlusion culling However!
27
University of H
ouston – Victoria
Game Genres (continued) Fighting Games
State-of-the-art like Fight Night
Technologies High definition character graphics
Realistic skin, hairs, subsurface scatter, sweat effects, etc.
High fidelity character animation Physics based cloth and hair simulation
28
University of H
ouston – Victoria
Game Genres (continued) Racing Games
Driving vehicles Race! Simulation Realistic experience!
Technologies
29
University of H
ouston – Victoria
Game Genres (continued) Racing Games
Driving vehicles Race! Simulation Realistic experience!
Technologies Tricks in rendering distant background! Breaking down tracks into 2D regions
Optimized for pathfinding, AI, etc. FPS or TPS cameras Efficient collision resolution for cameras in tight
spaces. Tunnels, etc.
30
University of H
ouston – Victoria
Game Genres (continued) Real-Time Strategy (RTS)
Dune II The first in this genre. Warcraft, Age of Empires, Command and Conquer!
31
University of H
ouston – Victoria
Game Genres (continued) Real-Time Strategy (RTS)
Dune II The first in this genre. Warcraft, Age of Empires, Command and Conquer!
Technologies Oblique cameras!
No viewer camera modification Various optimizations in rendering.
Grid-base world construction Simplified rendering
Relatively low-res units Height-field terrain maps
User terrain modifications Simple user interactions
32
University of H
ouston – Victoria
Game Genres (continued) Massively Multiplayer Online(MMO)
World of Warcraft, Star Wars Galaxies, etc. Huge number of simultaneous players!
33
University of H
ouston – Victoria
Game Genres (continued) Massively Multiplayer Online(MMO)
One persistent large map! A world larger than life (of its millions of logged users)
Subcategories Role-playing
(Dream Of Mirror Online) Real-time strategy
(Battle Forge) First Person Shooter
(Sudden Attack) and (Soldier Front)
34
University of H
ouston – Victoria
Game Genres (continued) Massively Multiplayer Online(MMO)
One persistent large map! A world larger than life (of its millions of logged users)
Technologies Massive battery of dedicated servers
Authorative state of the game User logging Inter-user chat VoIP User transactions and account management
User subscriptions Monthly charge Pay per play In game cost
What about graphics Fidelity?35
University of H
ouston – Victoria
Game Genres (continued) Other Genres?
Sports Role Playing Games God games Environment/Social Simulations Puzzles Non-electronic Web-based Serious games …….
36
University of H
ouston – Victoria
Game Engine Survey The Quake Family
First 3D FPS ? 3DW Doom Quake Quake 2 Quake 3
Quake Engine has been used for many games
Quake2 Sin FAKK 2 Medal of Honor
Valve’s Source Engine is based on Quake Tech.
Who wants to get the source code and play with it? You can run the game in MSVS and debug!
What does that mean? 37
University of H
ouston – Victoria
Game Engine Survey The Unreal Family
Epic Games Inc. Unreal Tournament! Unreal Engine 2 Unreal Tournament 2004
Highly modable Unreal Engine 3 The most powerful toolset in the
industry Rich Graphics UI, rendering, shading, animation,
cinematic systems! Game Logic Visual Programming Kismet
Use to build almost in any game genre!
Developers Network UDN Free Developer Kit UDK
38
University of H
ouston – Victoria
Game Engine Survey The Source Family
Valve Half-life
Microsoft XNA Game Studio Based on MS C# CLR Good for PC and Xbox
39
University of H
ouston – Victoria
Game Engine Survey Other Commercial Engines
C4 Engine by Terathon
SAGE (EA’s RTS engine)
40
University of H
ouston – Victoria
Game Engine Survey Open Source Engines
Freely available! Licensing:
GPL Free use not profit
LGPL Free use Commercialize
Many open source engines exist Some great, some awful!
OGRE 3D: 3D Rendering engine
Advanced lighting, shaders, interaction, animation, HUD system!
41
University of H
ouston – Victoria
Runtime Engine Architecture Runtime Engine Architecture.
Two components of a game engine Tool Suite Runtime Component
First let’s check the runtime component:
Layered Architecture! Like all software it is
based on a layered architecture.
42
University of H
ouston – Victoria
Runtime Engine Architecture Runtime Engine Architecture.
Two components of a game engine Tool Suite Runtime Component
First let’s check the runtime component:
Circular Dependency When lower layers depend
on upper layers: This is bad!
43
University of H
ouston – Victoria
Hardware The computer system or console
PC, Xbox, etc. What is a platform?
The hardware + The system software (OS, etc.) Most of the things we study are platform-agnostic
As long as you write in c++ you can compile and run on any platform!Not really
44
University of H
ouston – Victoria
Device Drivers The lowest-level software components
Either by OS or by the hardware vendor IO management Memory management Graphics management Really all hardware resources!
Why this is important? Shield hardware from the upper layers including the
OS! Details Variants Communication
45
University of H
ouston – Victoria
Device Drivers On PC this software controls the hardware
Running all the time. Time-sharing
Multi-tasking
On traditional consoles A thin library compiled into the game executable!
Owns the entire machine! On modern consoles
System resources are shared by the OS! Can interrupt the game execution to perform
housekeeping tasks!
46
University of H
ouston – Victoria
3rd Party SDKs and Middleware Software Development Kits
These tools are widely used to develop system-dependent functionalities. You don’t have to re-invent the wheel!
The functional interfaces provided by the SDKs Application Programming Interface (API)
Examples? OpenGL, DirectX, STL, etc.
47
University of H
ouston – Victoria
3rd Party SDKs and Middleware Data Structures and Algorithms
A game is an algorithm and all game components are structures – i.e. data structures. Standard Template Library (STL)
C++’s basic I/O algorithms and data structures STLport
48
University of H
ouston – Victoria
3rd Party SDKs and Middleware Data Structures and Algorithms
A game is an algorithm and all game components are structures – i.e. data structures. Boost
A powerful implementation of a bunch of algorithms and data structures www.boost.org
Cool huh
49
University of H
ouston – Victoria
3rd Party SDKs and Middleware Data Structures and Algorithms
A game is an algorithm and all game components are structures – i.e. data structures. Loki
a powerful generic programming template library!
50
University of H
ouston – Victoria
3rd Party SDKs and Middleware Data Structures and Algorithms
A game is an algorithm and all game components are structures – i.e. data structures.
To use or not to use template libraries? They are general purpose
Memory fragmentations for example! A good start to get up and running
Can work around the problems later!
It all comes down to the trade off between generality of your data structures and system specific performance!
51
University of H
ouston – Victoria
3rd Party SDKs and Middleware Graphics
Hardware Interface Library APIs Glide
For Voodoo graphics cars Popular before Hardware Transforms and Lighting
OpenGL A widely popular 3D graphics API
Based on C not CPP DirectX
Microsoft’s 3D Graphics API (primary rival of OpenGL)
Libgcm Low-level direct interface to playstation3
Edge Powerful and highly efficient rendering engine for
playstation352
University of H
ouston – Victoria
3rd Party SDKs and Middleware Collision and Physics
Hardware Interfaces for Collision Detection and Rigid Bodies Havok
A powerful industrial strength collision engine PhysX
NVIDIA’s powerful physics system Open Dynamics Engine (ODE)
A n open source physics package
An example of physics on hardware vs. software http://www.youtube.com/watch?v=Gys8zxuUxJw
53
University of H
ouston – Victoria
3rd Party SDKs and Middleware Animation
Examples of commercially available packages Granny
Robust 3D model and animation exporter for all major 3D Content Creation Tools (CCT)! http://www.youtube.com/watch?v=X1QaDn4OT5I
Havok Bridging the line between animation and physics!
Edge PS3 animation engine and redering tools.
54
University of H
ouston – Victoria
3rd Party SDKs and Middleware Animation
Examples of commercially available packages Granny
Robust 3D model and animation exporter for all major 3D Content Creation Tools (CCT)! http://www.youtube.com/watch?v=X1QaDn4OT5I
Havok Bridging the line between animation and physics!
http://www.youtube.com/watch?v=9WU4CSB_rDk Edge
PS3 animation engine and rendering tools.
55
University of H
ouston – Victoria
3rd Party SDKs and Middleware Artificial Intelligence (AI)
Until recently was dealt with in game Kynapse
Kynogon has an AI middleware called Kynapse Pathfinding, static/dynamic object avoidance,
vulnerability detection (probabilistic reasoning), etc. 10000 character crowd 3D Pathfinding
Biomechanical Character Models Endorphin and Euphoria
Character animation packagesEndorphin in 3DS MaxAnother example!
56
University of H
ouston – Victoria
Platform Independent Layer Games must run on more than one platform
Set on top of the lower level layers to shield the engine from the majority of the underlying platform. Wrapping
Common STL functions Operating System calls Foundational APIs
Leading to standardization of your game engine!
57
University of H
ouston – Victoria
Core Systems Useful software utilities for your game
engine! Assertions Memory management Math library Custom data structures I/O Etc.
58
University of H
ouston – Victoria
Resource Manager Provides a uniform access for interface to
different assets. Unreal’s packages
Static meshes, physics materials, skeletal meshes, textures, sound cues, etc.
OGRE 3D’s ResourceManager Class Provides interfaces to different object classes
59
University of H
ouston – Victoria
Core Engine
60
University of H
ouston – Victoria
Core Engine Rendering Engine
Main graphics engine Profiling and Debugging Tools
Performance optimization Collision and Physics
Physics system management Animation
Taking care of dynamic objects in the scene Human Interface Devices (HID)
Interaction Audio Networking Gameplay Foundation Systems
61
University of H
ouston – Victoria
Rendering Engine The most complex component
This is based on the design of the3D Graphics hardware.
A layered architecture Low-level renderer Scene graph/culling optimization Visual effects Front end
62
University of H
ouston – Victoria
Rendering Engine The low-level renderer
All of the raw rendering components of the engine. What is rendering?
Geometric primitives 2D Pixels Graphics device interface
Handles interface w/ the graphics API Message loop in windows
Keyboard poll, display poll, etc. Other render components
Draw primitive lists Camera to World matrix Near and far planes Perspective projection Materials and lights
63
University of H
ouston – Victoria
Rendering Engine Scene Graph/Culling Optimizations
Geometry may not be visible to the viewer! Need to limit the number of primitives submitted
to the low-level rendered. Simple small levels
Simple frustum cull More complex scenes
Spatial subdivision mechanisms are needed Quickly determine the potential visible set (PVS) of
objects Binary Space Partitioning (BSP), Quad-Tree, etc.
64
University of H
ouston – Victoria
Rendering Engine Visual Effects
Done independently and passed to low-level renderer Particle systems Decal systems
Done within the engine proper Light mapping Dynamic shadows
Buffer implementation (output buffer) Post effects
Full-screen anti-aliasing High dynamic range Color corrections, etc.
65
University of H
ouston – Victoria
Rendering Engine Front End
Heads-up display (HUD) In-game menus
Debugging tools In-game Graphics User Interface (GUI)
Usually done by drawing textures
Sometimes Billboards Always face the camera.
Full motion video (FMV)
Cinematic sequences: Director group of Matinee in UDK!
66
University of H
ouston – Victoria
Profiling and Debugging Tools Games are real-time systems
Need to profile the performance
Debug drawing
Memory management
Record and playback
67
University of H
ouston – Victoria
Collision and Physics Makes it so you could interact with the
“virtual” world Physics system or rigid-body dynamics
As we saw there are quite a few physics SKDs.
68
University of H
ouston – Victoria
Animation Engine Moving objects in the scene
Organic vs. semi(in)-organic Sprite/texture Rigid-body
Bridge between animation and physics (ragdoll) Skeletal
Bridge between animation and rendering Vertex
Referred to as skinning Morph
Facial expressions
69
University of H
ouston – Victoria
Human Interface Devices (HID) Human input
Keyboard Mouse Joypad Steering wheel Etc.
And of course output Screen Haptic output Sound
70
University of H
ouston – Victoria
Audio A wide range
Quake and unreal are very basic
Microsoft and EA have sophisticated audio engines
71
University of H
ouston – Victoria
Online/Multiplayer Networking Different genre
Single-screen multiplayer Split-screen multiplayer Networking multiplayer Massively multiplayer
Sometimes the core requirementsfor multiplayer are different thanthose of single player! Should be thought of from the beginning!
Most are done in a client-server architecture.
72
University of H
ouston – Victoria
Gameplay Foundation Systems Gameplay implementation
Native language vs. scripting This layer gaps the bridge between
gameplay code and low-level engine components. Game worlds and object models Event system Scripting system AI foundations
73
University of H
ouston – Victoria
Game Specific Subsystems As the name suggests
Anything that has to do with the game itself regardless of the lower level layers and implementations!
74
University of H
ouston – Victoria
Tools and Asset Pipeline Various tools and packages are in play to
create a game Digital Content Creation Tools
3D modeling: Maya , 3DS Max 2D image manipulation: Photoshop Audio: Sound Forge
Asset Conditioning Pipeline Convert the CCT file formats for use in game model
Efficient in-memory models Efficient run-time performance
Working with various game data 3D Models, Skeletal meshes, audio, particle systems Game world data and World Editor
75
University of H
ouston – Victoria
Tools and Asset Pipeline
76
University of H
ouston – Victoria
Approaches in Tool Architecture
77
University of H
ouston – Victoria
Approaches in Tool Architecture
78
University of H
ouston – Victoria
Approaches in Tool Architecture
79
University of H
ouston – Victoria
Questions? Game Engine Architecture
Chapter 1
80