Stéphane GOBRON

HES-SO – HE-Arc v.2014 Game technologies Game Engines

Content Game engines (GE) . Game engines (GE) definition and purpose

. Roll-your-own GE - GE dev. design - GE APIs

. Mostly-ready GE

. Point-and-click GE

Today’s main keywords Game engines definition and purpose

. Definition . GE purpose . One exception not to use a GE . GE includes . Game development . APIs and SDKs . List of GE . Types of GE

Engines are powerful Interaction

 Explain how your GE help Game engines D&P

From… …with… Definition

. (GE)

. Def: System designed for video games dev.

. Most are designed for consoles

or PCs …to:

/ http://masseffect.bioware.com Game engines D&P

GE purpose

Here is the question you must ask yourself:

Why pay… . …six programmers… . …for a year… . …to an engine...

…when you can… . …buy 90% of the features… . …from a proven technology… . …for less money… . …and have it NOW ?! E.g. of ref: Jason Gregory. Game Engine Architecture. AK Peters. ISBN 978-1-56881-413-1. Game engines D&P

One exception Study hard, really, really hard…! « My 11 yo son likes very much video games and he can draw very well. How can he learn to develop his own GE?»

Or

«Is it possible not to use GE of any kind and to start from scratch?»

Well … I dont’ think so

. The exception been… …learning how hard it is Game engines D&P

GE includes multiple engines Libs - Sound . Two main engines - Scripting - Animation - Rendering engine, for - Artificial intelligence 2D and/or 3D graphics - Networking including music and - Streaming sound effects - Memory management - Threading - Physics engine - Localization support - Scene graph

. And many libraries! Game engines D&P

Game development Game ecology in game development . Games are complex Game Recycling is surviving bricks . Recycling code!

. By reusing/adapting GE to create dif. games  reusable components

http://www.gamecareerguide.com/features/529/what_is_a_game_.php . GE Game can An architecture complexity be engines sorted in D&P that layers

Game specific Subsystème Driver & hardware layers Operating Syste 3 Platform independence layer Core systems Resources: game assets Low level rendering optimizations Scene /graph culling Visual effets Front end rendering Game rd party SDKs spec . m mechanics Player layer debugging Profiling & animation Skeletal Gameplay e.g. e.g. cameras Game e.g. foundations 3D model3D and animation resources e.g. OpenGL, OpenGL, Boost++ network network ( curves and and libcurves surface physics Collision & multi Online e.g. Win8 e.g. - player UDP/TCP) A.I. device interface Human Audio Game engines D&P - full architecture, part I Game engines D&P - full architecture, part II Game engines D&P

APIs and SDKs API

. Application Programming Interface  software interfaces  e.g. DirectX, OpenGL

. Software Development Kit  collection of libraries

Unreal . Most GE have both Engine SDK concept Game engines D&P

List of GE

. Quite a lot indeed  See Wiki

. Development or pluggings  Most are in /C++ (80%)… At least 65

http://en.wikipedia.org/wiki/List_of_game_engines Game engines D&P

Roll-your-own? Types of GE

. Many different types

. Many levels of programming expertise

. Three categories OpenGL - Roll-your-own GE low level

- Mostly-ready GE mid level

-Point-and-click GE

high level Unreal engine Re/use powerful tools? Roll-your-own GE Low level game engine development

. Advantage / disadvantage . Usefull prerequested . A. Game engine design The realm of “do it yourself” Event base prog […] . B. APIs DirectX, Open GL […]

Roll-your-own sushi… In 3D! Interaction

 Find some advantages of the roll-your- own GE Roll-your-own GE

Advantage / disadvantage

. Plus  Master everything If not…  No software cost  Can reach very low level

. Minus Require to know/master  Must master all aspects involved in - game engine design your game - CG fundamentals  experienced programmer  “impossible” for big size game development Roll-your-own GE

Usefull prerequested

. Math  Linear algebra  Matrices  Dif. equations

. CS  Master a C like language  Real-time algorithm  Computer graphics 

AI - 3d  System & networks -  Multimedia

 unbelievable

HW & device -

763746452

-

i

-

these

- drawn . Design/art -

 2D & 3D drawing skills

actually

-

are -

. Useful option gizmodo.com/wow drawings  Liking coffee http:// Roll-your-own GE a. GE development design

. The realm of “do it yourself” . Even-based prog . User and system events . Event capture . Callback abstraction . Event management . Real-time loop . Lag and latency . Multi-tasks

Game development is not that easy… Roll-your-own GE a. GE dev. design

The realm of “do it yourself”

. Do it yourself, but not - yourself

from scratch!!! -

it

-

do

- great . Experienced - programmer only

. Potential to achieve  …specific… 

 …but efficient… 

try.html

-

to -

 …renderings www.modernisticmama.com/2012/08/4

http:// games . Going deep into “Mom! I made my own Angry Shaders and HW birds game!”

. Even artistic rendering Roll-your-own GE a. GE dev. design

Even-based prog

. Event driven programming  System behavior Initialize triggered by events User Does Something or . Event sources Timer Goes Off  1. User  2. System

System Updates Roll-your-own GE a. GE dev. design

1. User events Multi-player FPS manage large amount . The OS handles events of user events  Hardware interruptions  Send to event queue  Available to program

. Application decides how to use events

. APIs can manage events for the program Roll-your-own GE a. GE dev. design

2. System events

. From system  timer events

. Application requests notification  at future time

. Possible semantic:  guarantee arrival before the date fixed  after arrival but as soon as possible  at the precise moment

. App. not interrupted System must often manage a lot of event types  must fetch events Roll-your-own GE a. GE dev. design

Event capture while ( true ) if ( e = checkEvent() ) . Waiting for switch ( e.type ) … the active events do more work…

. "windowing systems" Looking for event provide a function- blocking wait events e = nextEvent(); switch ( e.type ) . Wait / block { case ENUM_1: . Coupling with timers break; case ENUM_2: break; … … default: … Event effects } Roll-your-own GE a. GE dev. design

Callback abstraction

. Applications register defining treatments to be associated with each event

. Correspondence table: Events - Callback

. Widely used in GUI "When this button is clicked, call this method” Degree of abstraction . Some systems offer methods "catch-all" Roll-your-own GE a. GE dev. design

Real-time loop

. Game “heart”

. Pace: #of executions /s

. called "frame rate” while ( true )

. fps 1. process events  “frames per second” 2. update game world 3. render . Not to be mixed with First Person Shooter! Roll-your-own GE a. GE dev. design

Latency computation Lag and latency

. Latency: time between Process input user action and Frame Event displayed result time Update state time . High latency : Render  loss of causality  loss of control Process input  death of gameplay!!! Lag Frame Update state . Variance in latency time  User can adapt to 2 Render lagmax  Constant latency fr Not to variable latency Process input 1.5  Up to 300ms? lag  Frame average fr . Feeling of being drunk time … Roll-your-own GE a. GE dev. design

Multi-tasks

. Important: reduce latency between action and consequences at user’s level  loop input / rendering must be optimum

 latency between actions and conse- quences can be larger

 time between action and reaction

 time to change animation sequence Latency can kills game play in action game => break in presence “BIP” issue Roll-your-own GE b. APIs

. DirectX . OpenGL  GLSL . Comparing both APIs . Hardware management . Coordinate systems . Shaders

Some choices are difficult Interaction

 Who . Knows OpenGL . Developped with Direct-X

 Difference? Roll-your-own GE b. APIs

Direct X

. API: Microsoft «Direct3D»

. Lower layer of XNA - see next section

. Language: C / C++

. C# version => XNA

. Major components - DirectDraw - 2D Graphics - Direct3D - 3D Graphics - DirectSound - 2D Sound - DirectSound3D - 3D Sound http://www.d-silence.com/feature.php?id=254&pn=1 - DirectMusic – Music - DirectPlay - Network/Multiplayer - DirectInput - Input Devices Roll-your-own GE b. APIs

OpenGL

. Open and «free» OpenGL . Cross-platform Rendering Pipeline . Language: C The blue boxes are . OpenGL extensions programmable shader and methods: stages  Documented  But patented!!

. E.g. Mesa 3D

Learning OpenGL?

http://nehe.gamedev.net/ www.opengl.org/wiki/Rendering_Pipeline_Overview https:// Roll-your-own GE b. APIs

WebGL

HTML5 + OpenGL

. Any browser . Any platform . Any OS . No compilation . No plugins . Free

. Difficulties  HTML + JS + CSS + OpenGL Shader M. Gutierrez Gobron,S. , Language  Experienced

programmers pratique la par WebGL Roll-your-own GE b. APIs

Comparing both APIs

. Both render 2D and 3D computer graphics

. Direct3D designed to Direct3D OpenGL virtualize 3D hardware interfaces Platform Cross-platform . OpenGL designed to Mobile OpenGL for Embedded Direct3D Mobile be a 3D hardware- Platforms Systems, OpenGL ES accelerated rendering Open or system License Proprietary trademark Roll-your-own GE b. APIs

Comparing both APIs

Hardware management

. Direct3D: developer must manage hardware resources  Easy implementation  Allow flexibility to allocate resources

. OpenGL manage hardware for you  . Especially if using GLSL Roll-your-own GE b. APIs

Comparing both APIs

Coordinate system

. OpenGL  Right-handed 3D coord. system

. Direct3D  Left-handed 3D coord. system OpenGL Direct3D – DirectX  right-handed  left-handed Cartesian Cartesian system system  Scientists preference  Art-Designers preference Roll-your-own GE b. APIs

Shaders Direct3D pipeline Shaders Diffuse texture

Two possibilities . GLSL: OpenGL Shading Language Normal map . HLSL: High-Level Shading Language Global illuminat. At least 3 types types . Vertex shaders . Geometry shaders Ambient occlusion . Fragment shaders

Attention! . Very powerful Complete Shader . Valid for advanced programmer http://content.gpwiki.org/index.php/D3DBook :The_Direct3D_10_Pipeline Mostly-ready GE Mid-level game engine development

. Advantage / disadvantage . Product examples XNA OGRE Genesis3D Unreal idTech CryEngine

Getting higher does not make things easy Mostly-ready GE

Advantage / disadvantage Kwari

. Plus  Master rendering, input, GUI, physics  Some GE are free  Can reach low level architecture  Being only a good programmer  Middle or big size game development OK

. Minus  Can be expensive  Knowledge about game engine design  Must master CG fundamentals Crytek's Crysis Mostly-ready GE

Product examples

Microsoft XNA . XNA's Not Acronymed . Also called Next-Generation Architecture

. IDE: MS Visual Studio

. Applications:  Windows-based PCs  consoles  …at least

http://hrdownload.com/download- . Language: C# microsoft-xna-game-studio-2454.html Mostly-ready GE

Product examples

OGRE . open source! http://www.ogre3d.org/

. Supposed to be simple  Reputation tends to say the opposite!

. Applications:  Windows, and Mac OSX support

. Language  Visual C++ for windows  gcc 3+ on Linux & Mac

Version C#: MOgre Mostly-ready GE

Product examples

Genesis3D http://www.genesis3d.com/ . open source!

. Applications:  Renderer, one of the earliest to use skeletal animation

. Language: C

http://www.make-video-games.com/genesis3d/genesis3d-lesson1a Mostly-ready GE

Product examples

Torque http://www.garagegames.com/products/torque-3d

. Torque2D or 3D

. 3D: Low priced, $179

. Full source solution  Open for $100

. Applications:  PC, Mac, Xbox 360, Wii, Demo and the web http://www.garagegames.com/products/download/385

. Language: Torque Documentation ! http://docs.garagegames.com/torque-3d/official/ Mostly-ready GE

Product examples

Unreal – EpicGame . High priced  http://www.unrealengine.com/

. Applications: http://fr.wikipedia.org/wiki/UnrealEngine#UnrealEngine_4  Mainly fps games http://www.youtube.com/watch?v=rFqNh-hxme8&feature=related

. Unreal Development http://www.youtube.com/watch?v=ttx9 Kit: UDK 59sUORY&feature=fvst /!\ violant scenes . Code source dev: UnrealScript http://www.youtube.com/watch?v=_GzCEVxatb0

. Long list of game developped with it http://www.youtube.com/watch?v=h5XahF-3DWo Mostly-ready GE

Product examples http://en.wikipedia.org/wiki/Id_Tech_5 . high priced 

. : « 3 engine»

. Applications:  E.g. Doom!  Mac OS X, Microsoft Windows, Linux, PlayStation 3, Xbox 360

. Language: C++

http://www.youtube.com/watch?v=oLg3oNC35K0 Mostly-ready GE

http://www.crytek.com/ Product examples

CryENGINE – Crytec . high priced 

. But free SDK since http://fr.wikipedia.org/wiki/Cry 2011!  Engine_3

. specifications  Global illumination!!  HRD lighting!! http://www.youtube.com/watch?v=ZqNHJ-ekMR4&NR=1&feature=fvwp  Advanced Shaders!!

. Language: compatible

DirectX 11.0

http://www.youtube.co m/watch?v=r5nB9u4jjy4 Mostly-ready GE

Best rendered image

CryENGINE

. Example of very realistic rendering Point-and-click GE High level game engine development

. Advantage / disadvantage . Product examples GameMaker Torque game builder

Getting higher changes the nature of issues Point-and-click GE

Advantage / disadvantage

. Plus  Don’t need to be a programmer  Good for big size game development

. Minus  Expensive  Don’t master low level  Knowledge about game engine design  Must master CG fundamentals  Useless for small project Point-and-click GE

http://www.youtube.com/watch?v=CvhTZxx9U0w&NR=1 Product examples

GameMaker

. Currently v8.1

http://www.telecharger- . Language: Delphi tout.com/logiciels/audio_video_images/185179- game-maker-v81-and-books.html . No need to be an expert in C++ or Java

. Easy drag and drop

http://www.youtube.com/watch?v=2fSrUWqnFls How to make a Mario game Point-and-click GE

Product examples http://docs.garagegames.com/tgb/official/ Torque Game Builder

. Torque3D extension

. GarageGames studio

Torque interface 2D app.

Iso perspective app. 3D app. Point-and-click GE

Product examples

Unity3D http://unity3d.com/unity/download/

. 3D and physics engine

. C# script editor

. API compatibility: DirectX, OpenGL, Wii

. Plug and play real- time 3D on Web!!

http://www.youtube.com/watch?v=rjTg7iA82ao Many Unity tutorials! Adviced assignment . Think about which is the best your game: • EG level? Low / mid / high? • Select one product/e.g. from that category • Download and test it Skyline Skyline GE Impact GE

http://www.chi- ad.com/Skyline/SDN/skyl ine-news/page/2

http://msdn.microsoft.com/en-us/hh552479.aspx