Table Of ContentGame Programming Foundations
& Game Engine Architecture
Guillaume Bouyer, Adrien Allard
guillaume.bouyer@ensiie.fr
www.ensiie.fr/~bouyer/
bouyer@ensiie.fr
Objectives and schedule http://www.ensiie.fr/~bouyer/JIN
Office 111 @ ENSIIE
Understand the theoretical and technical components of game engines
•
Be aware of the technical problems and existing solutions that underpin the
•
development of a video game (among others to succeed as well as possible in the
project team)
Operate a high-level but relatively closed game engine (Unity). Being able to create
•
a project that looks like a game
Monday afternoon: Course Part. 1
•
(cid:1) Homework: Install Unity 4 or 5, read Unity course and finish introduction tutorial (from
•
ENSIIE-2A IRV)
Tuesday morning : Course Part. 1 + Tutorial Part. 1
•
(cid:1) Homework: Continue tutorial
•
Thursday: Course Part. 2 + Tutorial Part. 2
•
(cid:1) Homework: Finish tutorial
•
Friday: Adrien Allard, Amplitude Studios, Talk + Tutorial Part. 3
•
(cid:1) Homework: Finish tutorial
• 2
Main Reference
Game Engine Architecture, Jason Gregory
•
Published: June 15, 2009 by A K Peters/CRC Press
http://www.gameenginebook.com/
3
Outline
Part 1 Part 2
1. Introduction 7. Game World & Game Flow Management
Game, gameplay, game engine & game team 8. Tools for development and debug
Components of a game engine (runtime engine 9. Low and mid-level engine features
architecture)
Configuration
2. Gameplay, game world, game objects
Startup and shutdown
Gameworld
Memory management
Game objects & models
Containers
World editor
Strings
Assets & tools
File system
3. Real-time simulation
Resource manager : off-line & runtime
Game loop
10. Collisions & Rigid body dynamics
Time management
Physics in a game
4. Game objects management
Collision detection
Game Object Architectures and IDs Rigid body dynamics
Real-time object updating
5. Events system
6. Scripts
4
1. Introduction
5
Video Game?
A Theory of Fun for Game Design, Raph Koster: “An interactive experience that
•
provides the player with an increasingly challenging sequence of patterns which he
learns and eventually masters”
Game Engine Architecture, Jason Gregory: "Soft real-time interactive agent-based
•
computer simulations"
Simulation
•
Approximated and simplified mathematical (numerical) model of the game world
•
Game loop: during each iteration, various game systems (artificial intelligence, game logic, physics
•
simulations…) calculate or update their state for the next discrete time step
Rendering of the result by displaying graphics, sound, and possibly other outputs
•
Soft: missed "deadlines" (rendering, physics, audio…) are not catastrophic
•
Real-time: dynamic game world model
•
Agents: distinct entities or objects in interaction
•
Interactive: must respond to unpredictable human input
•
Artistic content designed to entertain players
•
6
Gameplay?
Interactive experience of the player(s)
•
"Game Mechanics"
•
Rules of interactions between the entities
•
Objectives, criteria for success and failure
•
Player character’s abilities
•
Number and types of non-player entities in the virtual
•
world
Overall flow of the gaming experience
•
More crucial to define a game more than its
•
technology
7
Game Engine?
Mid-1990s: some games architected with a separation between
•
Core software components (3D graphics rendering system, collision
•
detection system, or audio system)
Art assets, game worlds, and rules of play that made the gaming
•
experience
Ex: Doom (id Software)
•
=> Create new games with new contents & minimal changes
•
to reusable core software
=> Mod community
•
=> Engine licensing as a viable secondary revenue stream
•
8
Game Engine?
Software that is extensible and can be used as the foundation
•
for different games without major modification
Trade-off’s between generality and optimality
•
The more general-purpose a game engine or middleware component
•
=> the less optimal for running a particular game / particular platform
Assumptions about how the software will be used and/or about the
•
target hardware on which it will run
Sets of tools + runtime components
•
Data-driven architecture
•
9
Typical Game Team
Engineers (= programmers)
•
Runtime programmers: engine and game
•
Single engine system: rendering, AI, physics…
•
Low level: memory, network…
•
Gameplay (3C : Character-Controls-Camera)
•
Tools programmers: off-line tools for the team
•
=> Lead engineers (+ management), technical directors (high level),…
•
chief technical officer (for the entire studio)
Artists Produce visual and audio content
•
Concept artists, 3D modeler, Animators, Texture & lighting artists,
•
Actors (mocap, voice), Sound designers & composers…
=> Lead artists, art directors
•
10
Typical Game Team
Game designers Design the gameplay
•
Macro level
•
Story arc, overall sequence of levels, high-level objectives of the player
•
Individual levels or geographical areas within the game world
•
Static background geometry, enemies spawning, items placement, puzzle elements…
•
Technical level
•
Close with gameplay engineers and/or writing code (high-level scripting language)
•
=> Game director
•
Producers
•
Manage the schedule, the human resources, link between the dev. and the
•
business units…
Publishers
•
Marketing, manufacture and distribution (usually not handled by the studio)
•
11
Data-Driven Game Engine
Game team must efficiently produce very large
•
amounts of contents
Data-driven engine permits designers and artists to
•
Create content
•
Control, in whole or in part, the behavior of the game
•
Directly by data rather than exclusively by engineering
•
programming
Benefits and risks
•
Improved iteration times
•
Heavy cost to develop appropriate runtime code and
•
robust and usable tools
12
Engine Differences Across Genres
Particular technological requirements for each genre => Game engines have traditionally differed from
•
genre to genre
First-Person Shooters (FPS)
•
efficient rendering of large 3D virtual worlds (optimized for a particular type of environment)
•
responsive camera control/aiming mechanic
•
forgiving player character motion and collision model (“floaty”)
•
high-fidelity animations of the player’s virtual arms and weapons
•
wide range of hand-held weaponry and pickable items
•
high-fidelity animations and AI for the non-player characters (enemies and allies)
•
small-scale online multiplayer capabilities (ex. 64), “death match” gameplay mode…
•
Platformers and other Third-Person games
•
~FPS
•
emphasis is placed on the main character’s abilities and locomotion modes
•
high-fidelity full-body character animations for the player’s avatar
•
interesting locomotion modes: moving platforms, ladders, ropes…
•
puzzle-like environmental elements
•
third-person “follow camera” focused on the player character + complex camera collision system
•
13
Engine Differences Across Genres
Fighting games
•
typically 2 players
•
rich set of high-fidelity fighting character animations
•
high-definition character graphics (realistic skin, sweat effects…)
•
physics-based cloth and hair simulations
•
accurate hit detection
•
user input system capable of detecting complex button and joystick combinations
•
relatively static backgrounds (crowds)
•
Racing games
•
usually focus all graphic detail on the vehicles, track, and immediate surroundings
•
various “tricks” to optimize rendering (distant background elements…) and aid AI (path finding for
•
non-human-controlled vehicles…)
follow camera (3rd-person) or inside the cockpit (FPS)
•
realistic physics (tires, materials…) and audio
•
14
Engine Differences Across Genres
Real-Time Strategy (RTS)
•
typically oblique top-down camera, restrictions allow to optimize the rendering
•
grid-layout system to aid align units and buildings
•
units relatively low-res, to support large numbers on-screen
•
height-field terrain
•
user interaction: single-click and area-based selection of units, menus or toolbars containing
•
commands, equipment, unit types, building types…
Massively Multiplayer Online Games (MMOG)
•
powerful battery of servers to maintain the authoritative state of the game world, manage users
•
signing in and out of the game, provide inter-user chat or VoIP services…
central server to handle the billing and micro-transactions
•
graphics fidelity almost always lower than non-massively multiplayer counterparts, as a result of the
•
huge world sizes and extremely large numbers of users supported.
Technological overlap between genres, especially within the context of a single hardware
•
platform
More and more powerful hardware => differences between genres are decreasing
•
=> increasingly possible to reuse the same engine technology across disparate genres, and
even across disparate hardware platforms 15
Game Engine Examples
Quake Family (Id Software)
•
Castle Wolfenstein 3D (92), Doom, Quake I II III, Medal of Honor…
•
Unreal Family (Epic Games)
•
Unreal (98), Unreal Tournament 2004, Gears of War…
•
Source Engine (Valve)
•
Half-life 2, Team Fortress, Portal…
•
Microsoft’s XNA Game Studio
•
Unity 3D
•
Proprietary in-House Engines
•
Open Source Engines
•
Ogre 3D, Panda3D, Yake, Crystal Space, Torque, Irrlicht…
•
16
Runtime Engine Game-Specific Subsystems
Game-Specific Player Game Camera AI
Rendering Mechanics
Architecture
Gameplay Foundations
Front End
Game Game
Events Scripting
Objects Flow
Visual Effects
Skeletal Online
Audio
Scene-graph / Culling Animation Multiplayer
Optimizations
Human
Profiling & Collision &
Low-Level Renderer Interface
Debugging Physics
Devices
Resources Resources / Assets Manager
/ Assets
Core systems
Platform Independence Layer
3rd Party SDKs
OS
Drivers
Hardware
Runtime Engine Architecture
Target hardware
•
Drivers
•
Low-level software components provided by the OS or hardware vendor
•
Manage hardware resources and shield the operating system and upper engine layers
•
from the details of communicating with all the variants of hardware devices available
Operating System (OS)
•
PC
•
OS runs all the time
•
Orchestrates the execution of multiple programs, including the game
•
Pre-emptive multitasking: time-sliced approach to sharing the hardware
•
Console
•
Previously a thin library layer compiled into the game executable: game "owns" the machine
•
Now can interrupt the execution of the game, or take over certain system resources, in order to
•
display online messages, or to allow the player to pause the game and bring up the dashboard
18
Runtime Engine Architecture
Third-Party SDKs and Middleware
•
Data Structures and Algorithms
•
STL, STLport, Boost…
•
Memory allocation performance vs. convenience?
•
Graphics
•
OpenGL, DirectX, libgcm (PS3), Edge (Naughty Dog)…
•
Collision and Physics
•
Havok, PhysX, ODE, I-Collide, V-Collide, RAPID…
•
Character Animation
•
Granny, Havok Animation, Edge…
•
Artificial Intelligence
•
Kynapse…
•
Biomechanical Character Models
•
Endorphin and Euphoria
•
Platform Independence Layer
•
Wrap or replace the most commonly used standard C library functions, OS calls, and other foundational APIs
•
Shields the rest of the engine from the majority of knowledge of the underlying platform
•
19
Runtime Engine Architecture
Core Systems: useful software utilities
•
Assertions, unit testing…
•
Memory allocation
•
Math library, random number generator
•
Custom data structures and algorithms
•
Resource Manager
•
Interfaces for accessing game assets and other engine input data (3D model, texture, material, font,
•
skeleton, collision, map…)
Unified or suite of tools
•
Profiling and Debugging Tools
•
Profile performance and analyze memory in order to optimize
•
In-game debugging facilities
•
Record and play-back gameplay
•
Config, stats…
•
Commercial or custom
•
20
Description:Operate a high-level but relatively closed game engine (Unity). Being able to create Game Engine Architecture, Jason Gregory: "Soft real-time interactive agent-based computer simulations" .. ame_Rate_Management.pdf.