Master Game Dev Verona, 2016
Game Engines
Marco Tarini
General info
Marco Tarini
Google for “marco tarini”, 1
stlink Follow “teaching”
(bottom)Follow “Master Computer game dev 2016”:
pagina del corso: materiale, lucidi, links.
Follow “contact”
(bottom)Mail, tel, etc…
This Course
this course
Possibili testi di rifemento (1/2)
Mathematics
for 3D Game Progr. and C.G.(3za ed) Eric Lengyel
Copre bene il lato + tecnico: 3D math, CG pipeline, geometry + transforms, raytracing, visibility, physic sims, semplice geom processing…
Game Engine Architecture
Jason Gregory
Abb. completo (con cenni di:
software tools, software eng., AI prog, CG prog, math, game design...)
Possibili testi di rifemento (2/2)
Game Coding Complete
(4ta ed) Mike McShaffry,David GrahamVisione pratica (attenzione a osolescenza) Accento su coding, software eng (es memory managment).
Introduction to
3D Game Programming
with DirectX 11 Frank Luna
Rendering / GPU (in pratica, copre il corso di CG)
Dev-Teams
Tecnici
Artisti
Game Dev
Task comuni affrontati Rendering
Real time transofrm + lighting
Phyisics
Newtonian physical simulations Collision detection + response
Networking
Sound rendering Input management Program structure
Loop di gestione degli eventi
reuse!
+Animations
scripted or computedGame Engine
Solutions to «common» tasks of a game-development Base:
Main applcation structure events. main loop, multithreads…
Math / geometry support
Modules to address core sub-tasks,
as…
Game Engine
GRAPHICS PHYSICS
GUI + INTERFACES SOUND
NETWORKING . . .
ARTIFICIAL INTELLIGENCE
ASSET MANAGEMENT SCRIPTING
Game Engine: modules
Renderer
Real time transofrm + lighting Models, materials … Physics engine
(soft real-time) newtonian physical simulations Collision detection + response
Networking
(LAN – es using UTP, or TPC) Sound mixer e “sound-renderer”
Unified management of HCI devices Assets management
Import
Memory management Artificial intelligence module
Solutions to common sub-tasks, e.g. routing Script interpreter
Supporting functions for: interaction with other modules, and math/geometry, … Ad-hoc languages, or generic (LUA, C#, JavaScript)
GUIs (e.g. HUDs)
Animations
scripted or computed
Other services provided by a Game Engine:
Deployment Multi-platform Integration with
GPU APIs GPU drivers GPU Localization support
(translation tools) Game-tools integration
Game Dev-Teams
Tecnici
Artisti
game engine game tools
sviluppano customizzano
integrano
Dev-Teams
Tecnici
Artisti
(aka contents)
3D data models textures materials shaders animations collision objects scenes etc audio
music sound fxs ambient sounds voice overs etc video
cut-scenes, intros, etc
2D art
screen splashes backgrounds GUI / HUD elements [ sprites & tile-sets ? ] fonts
etc text
dialogues trees messages translations etc etc:
scripts stats levels etc
game assets
Assets in
Game Development
game
game tools
digital artists
game
MOD assets
digression:
Game [MOD] Development
game
(public) game tools
game fans!
MOD
game assets
Game Tools
game
game engine game
tools
digital artists
game assets
Game Engine
GRAPHICS PHYSICS
GUI + INTERFACES SOUND
NETWORKING . . .
ARTIFICIAL INTELLIGENCE
ASSET MANAGEMENT SCRIPTING
Game Engine
GRAPHICS PHYSICS
GUI + INTERFACES SOUND
NETWORKING . . .
ARTIFICIAL INTELLIGENCE SCRIPTING
A S S E T S
ASSET MANAGEMENT
A S S E T S
Game assets!
(aka game contents)
3D data models textures materials shaders animations collision objects scenes etc audio
music sound fxs ambient sounds voice overs etc video
bakedcut-scenes, intros, etc
2D art
screen splashes backgrounds GUI / HUD elements [ sprites & tile-sets ? ] fonts
etc text
dialogues trees messages translations etc etc:
scripts stats levels etc
3D Models i.e. tri-meshes with:
per vertex attrib normals, color, AO, … LODs
“uv-mapping”
keyframes cyclic animations face-morphs, …
“skinning”
Materials
lighting model stats / flags textures
RGB maps normal maps alpha maps … shaders
vertex, fragments, …
game assets
Animations
blend shapes skeletal animations kinematic animations geometry caches skeletons (rigs)
Geometric proxies
hit-boxes bounding objects AI-meshes
Particle systems
Environments
3d scenes (scene-graph) skydomes
env. maps scene props
A Game Engine
GRAPHICS PHYSICS
GUI + INTERFACES SOUND
NETWORKING . . .
ARTIFICIAL INTELLIGENCE SCRIPTING
A S S E T S
ASSET MANAGEMENT
A S S E T S
An central asset,
bridging most modules:
The 3D SCENE structure
“scene graph”
Game engine programming:
basics
Can be:
a library,
an IDE (e.g. integrating several game tools) Various level of specializations
Genre specific, or generic 3D only / 2D only / both Dev Language: C++
efficiency, elegance, flexibility
Quanto è «hard wired»
una feature di un video game?
A che livello è implementata?
nell HARDWARE
(es. nella GPU)
nel GAME ENGINE
nel codicedel video-game
in uno script
(o cmq pilotabile da un asset)
meno Hard-Wired più Hard-Wired
TERMINOLOGICA
Chi la può modificare?
Il vendor dell’HW
(> platform dependence!)
il dev del Game Engine
i programmatori del video game
gli artisti (es. i level designer);
i modders
Quanto è «hard wired»
una feature di un video game?
Hard-wired
> efficienza
> scalabilità
> riutilizzo
Non-hard wired
> mantenibilità
> customizzabilità
> flessibilità
TERMINOLOGICA
Un concetto collegato
DESIGNED
Prodotto in fase di sviluppo del gioco
« è un asset »
« è scripted »
> qualità
(di solito) (è il prodotto di un artista)> controllo
per il game designer
(efficienza tempo
FORSE)
PROCEDURAL
Prodotto da un algoritmo in fase di esecuzione
« è una procedura »
« è computato dinamicam. »
> variabilità
legata a “replayability”
> flessibilità
(poss. di adattam a situaz.)
(efficienza spazio
RAM, DISK…)
NOTA TERMINOLOGICA
VS
Procedural generation nei games
Livelli procedurali Missioni procedurali Terreni procedurali AI procedurali Boss procedurali Scene procedurali Modellazione procedurale Tessiture procedurali
Animazioni procedurali (physics engine) Musica procedurale
Elite, Acornsoft, 1984 Left 4 dead, Valve, 2008
Minecraft, Mojang, 2009 Rescue the beagles, 16x16, 2008
Shadow Over Mordor, Monolith Prod., 2014 Rogue, Michael Toy et al, 1980
Un roguelike
«Baked» / «Pre-baked»
Baking:
lett: cuocere (al forno)
“Storing for good the result of a computation, for later use”
( the exact opposite of procedural )
Gain:
time (CPU / GPU )
almost total independence from computation complexity ! less compromises, more quality
Pay with:
space (e.g. on Disk ,Ram ,GPU Ram) loss of flexibility
(all the parameters of the computation become fixed)
note: several assets are baked-something (or have baked elements)
i.e. in the long term (otherwise, it’s caching)
often,
(refined versions of) the ones normally done in real time
«Baked» / «Pre-baked»
i.e. in the long term, in assets (otherwise, it’s caching)
often, (refined versions of) the ones normally done in real time
Storing for good the result of a computation, for later use
it: “cuocere (al forno)”
Gain:
• time (CPU /GPU load)
• almost total independence from computation complexity !
• less compromises, more quality
Pay with:
• space
(e.g. on Disk ,Ram ,GPU Ram)
• loss of flexibility (all the parameters of the computation become fixed) note: several assets are
baked-something or have baked elements
baking :
A Game Engine
GRAPHICS PHYSICS
GUI + INTERFACES SOUND
ARTIFICIAL INTELLIGENCE SCRIPTING
A S S E T S A S S E T S
event loop, timers, th
M A IN E N G IN E
NON-interactive programs
main() {
init();
do_my_beautiful_algorithm();
exit();
}
For interactive apps Event-Based programs
Like: Servers, Web apps, Games …
main() {
init();
while (true) { get_event() ; process_event();
}
{
} Eventloop
events of any kind, like:
• from input devices (mouse, keyboard, …)
• from window systems (reshape,windows exposed, ...)
• generated from the application itself (timers, subrouting over, …) (same thread, or different ones)
• a msg comes from network (a file finished loading) (finished uploading on GPU…)
For interactive apps Event-Based programs
Like: Servers, Web apps, Games …
main() {
init();
while (true) { get_event() ; process_event();
}
{
} Eventloop
Typically: execute the corresponding callback Callback: a function assigned
to react to a given event