Everyone of us has played a game in his or her life at least once.
But how do they work? What makes them tick and how are they working behind the hood? What kind of tools and techniques does a software developer have to develop games? What are things to expect and what kind of advanced techniques are there to make games look nice?
Peter tries to answer the above questions using a solid dose of theory mixed with some playful practical examples.
2. 2
19/01/15
Peter Vrenken
TS Midden Financial Services
Game Development
Personal introduction
• Name: Peter Vrenken
• By day: Microsoft .NET ‘Frontend’ developer
• At night: Geek, philosopher & game developer
Introduction Development basics Advanced techniques Game engines---
3. 3
19/01/15
Peter Vrenken
TS Midden Financial Services
Game Development
Introduction Development basics Advanced techniques Game engines---
4. 4
19/01/15
Peter Vrenken
TS Midden Financial Services
Game Development
Structure
• Let’s start with the basics.
• Advanced tips ‘n tricks.
• Game engines.
Introduction Development basics Advanced techniques Game engines---
5. 5
19/01/15
Peter Vrenken
TS Midden Financial Services
Game Development
Case study
Introduction Development basics Advanced techniques Game engines---
6. 6
19/01/15
Peter Vrenken
TS Midden Financial Services
Game development approach
• User Interface API.
• Low level graphics / audio API’s.
• High level API wrappers / libraries.
• Fully fledged game engines.
Game Development
Introduction Development basics Advanced techniques Game engines---
7. 7
19/01/15
Peter Vrenken
TS Midden Financial Services
User Interface API
• Windows Forms
• WPF
• Java AWT
Game Development
Introduction Development basics Advanced techniques Game engines---
8. 8
19/01/15
Peter Vrenken
TS Midden Financial Services
Low level graphics / audio API’s
Game Development
Introduction Development basics Advanced techniques Game engines---
9. 9
19/01/15
Peter Vrenken
TS Midden Financial Services
High level API wrappers / libraries
Game Development
Introduction Development basics Advanced techniques Game engines---
10. 10
19/01/15
Peter Vrenken
TS Midden Financial Services
Fully fledged game engines
Game Development
Introduction Development basics Advanced techniques Game engines---
11. 11
19/01/15
Peter Vrenken
TS Midden Financial Services
Game loops
Nothing new: All applications run at least one kind of loop.
Game Development
Introduction Development basics Advanced techniques Game engines---
12. 12
19/01/15
Peter Vrenken
TS Midden Financial Services
Sprites & textures
…
Game Development
Introduction Development basics Advanced techniques Game engines---
13. 13
19/01/15
Peter Vrenken
TS Midden Financial Services
Sprites & textures
Game Development
Introduction Development basics Advanced techniques Game engines---
14. 14
19/01/15
Peter Vrenken
TS Midden Financial Services
Coordinate spaces
Game Development
Model / world space Camera (view) / screen space
Introduction Development basics Advanced techniques Game engines---
15. 15
19/01/15
Peter Vrenken
TS Midden Financial Services
Timing
• Always use time to
calculate movement
• Fixed time steps
• Variable time steps
Game Development
Introduction Development basics Advanced techniques Game engines---
16. 16
19/01/15
Peter Vrenken
TS Midden Financial Services
(Inbe)Tweening / Interpolation
Give the game “Elegance” by make movement subtle.
Game Development
Introduction Development basics Advanced techniques Game engines---
17. 17
19/01/15
Peter Vrenken
TS Midden Financial Services
Game Development
Particle engines
• Basic recipe: use lots of sprites
to create illusions.
• Often used to create
more advanced visual effects.
Introduction Development basics Advanced techniques Game engines---
18. 18
19/01/15
Peter Vrenken
TS Midden Financial Services
Physic engines
•Basic recipe: Simulate the laws of physics.
•Uses 2D/3D objects build from vertices, edges and faces.
•Gives the game “Body”.
Game Development
Introduction Development basics Advanced techniques Game engines---
19. 19
19/01/15
Peter Vrenken
TS Midden Financial Services
Performance
• Primary problem: Games and garbage collection don’t mix.
• Basic rule #1: “Profile before optimizing”.
• Basic rule #2: Recycle and reuse.
• Basic rule #3: “OO is not the holy grail”.
• Basic rule #4: Optimize your resources.
Game Development
Introduction Development basics Advanced techniques Game engines---
20. 20
19/01/15
Peter Vrenken
TS Midden Financial Services
Take care of your garbage!
Game Development
Introduction Development basics Advanced techniques Game engines---
21. 21
19/01/15
Peter Vrenken
TS Midden Financial Services
Profile before optimizing
Game Development
Introduction Development basics Advanced techniques Game engines---
22. 22
19/01/15
Peter Vrenken
TS Midden Financial Services
Recycle and reuse
•Object pooling.
•Object caching.
Game Development
Introduction Development basics Advanced techniques Game engines---
23. 23
19/01/15
Peter Vrenken
TS Midden Financial Services
OO is not the holy grail
•Structs behave different when GC-ed.
•Don’t create copies: Process structs using ref and out parameters.
•Don’t use properties: They are methods and alter the stack.
•Flatten complex methods and objects.
Game Development
Introduction Development basics Advanced techniques Game engines---
24. 24
19/01/15
Peter Vrenken
TS Midden Financial Services
Optimize your resources
• Use matching quality resources.
• Use spritesheets / atlases.
Game Development
Introduction Development basics Advanced techniques Game engines---
25. 25
19/01/15
Peter Vrenken
TS Midden Financial Services
Behavior trees
Elegant way to model
AI behavior.
• Sequences
• Selections
• Conditions
• Actions
Game Development
Introduction Development basics Advanced techniques Game engines---
26. 26
19/01/15
Peter Vrenken
TS Midden Financial Services
Entity (Component) Systems
• Basic recipe: Don’t store any logic in your “objects”.
• Reason: Performance and flexibility.
Game Development
Introduction Development basics Advanced techniques Game engines---
27. 27
19/01/15
Peter Vrenken
TS Midden Financial Services
Entity (Component) Systems
Game Development
Introduction Development basics Advanced techniques Game engines---
28. 28
19/01/15
Peter Vrenken
TS Midden Financial Services
Entity (Component) Systems
Game Development
Introduction Development basics Advanced techniques Game engines---
29. 29
19/01/15
Peter Vrenken
TS Midden Financial Services
Game development
Game Engines
Provides everything needed for a running start.
For example: Unity 3D
• Advanced IDE: Everything needed combined in one tool.
• Standardized: Lots of textures/models/scripts/effects/plugins.
• Cross platform!
Introduction Development basics Advanced techniques Game engines---
32. 32
19/01/15
Peter Vrenken
TS Midden Financial Services
Game development
“If Pac-Man had affected us as kids,
we'd all be running around in dark
rooms, munching pills and listening
to repetitive electronic music.”
- Marcus Brigstocke
Introduction Development basics Advanced techniques Game engines---
Notas do Editor
Welcome
Numbers of people in the audience.
Audible?
Did some years developing .NET applications.
WPF/MVVM/XAML
Scars Windows Mobile/Phone/8
Current job:
Atos Global: Incident Management suite with Office 2013 looks
Build in WPF.
Gamification Competence: Virtual Reality projects and PoC’s
Did some math:
- Boulder Dash was one of the first games I ever played.
First release of Boulder dash: 1984:
http://en.wikipedia.org/wiki/Boulder_Dash
Throughout the years I tried to develop some games.
But why?
Games are a good practice to teach yourself new skills.
They provide direct feedback.
They are fun.
There is no direct revenue model attached (most of the time).
Doel:
Quick overview of the basics.
Give a taste of the advanced methods available for game development.
Game engines.
Scope:
Primary .NET but not limited to.
Own work
XNA / Unity.
End of introduction.
Why: Remake the past.
Time was ripe.
Available for voor Windows 8 & Windows Phone
Lots of experiences.
Quick to start with.
No good fit for developing games.
Long learning curve.
Need lots of work before anything fancy shows up.
Full flexibility.
WebGL:
http://learningwebgl.com/
Quick to start with.
Simpler API’s to develop games with.
Lot’s of goodies to get you up and running.
Libraries:
http://examples.phaser.io/
http://impactjs.com/
http://html5quintus.com/
http://www.monogame.net/
http://www.senchalabs.org/philogl/
Quick to start with.
Everything available.
May be overwhelming.
Can be expensive.
List of game engines:
http://en.wikipedia.org/wiki/List_of_game_engines
Demo 01 – Game loop
Message loop
Demo 02 - Textures
Composition.
Movement.
Fez
PNG / Jpeg
Also other formats
Per pixel transparency
Translate
Transform
Rotate
Order is important!
Concept is used in both 2D and 3D games.
End of developer basics
- No static assignments: position.x += 3;
- No Thread.Sleep();
- Fixed vs Variable time steps.
http://gamedev.stackexchange.com/questions/1589/fixed-time-step-vs-variable-time-step
http://gafferongames.com/game-physics/fix-your-timestep/
Demo 05 - Tweening
Lineaire movements are often not good.
Better is to use interpolation: lineair, cubic, quadratic, elastic.
Lerp function:
http://en.wikipedia.org/wiki/Lerp_(computing)
Tweening samples:
http://svejkgames.com/blog/post/how-to-use-tweens-in-phaser-framework/
http://jsfiddle.net/xhinking/t9X6f/ (progressbar)
http://jsfiddle.net/heygrady/BLMLu/light/
http://jsfiddle.net/heygrady/j5tHC/light/
TweenJS
http://www.createjs.com/#!/TweenJS
http://www.createjs.com/#!/TweenJS/demos
WPF Easing function gallery
http://samples.msdn.microsoft.com/Silverlight/SampleBrowser/index.htm#/?sref=easing_functions_gallery
http://easings.net/
Overview of easing functions.
Demo 06 - Particle engine
What: Effects like:
Fire
Explosions
Clouds
Shinings.
How:
Lots of sprites (2D or 3D) that behave according to the preconfigured settings.
Emitters
Modifiers
Often settings or modifiers like: gravity, speed rotation.
Mercury particle engine.
C:\Users\Peter\SkyDrive\Documenten\2014\Peter\06-03 - Game Development\02 - Particle engine\mercury-particle-engine-develop
Problem:
Games should not jitter, pause or slow down.
Profilers:
Ant profiler
Jetbrains ?.
Recycle & reuse:
ObjectPools.
Cache objects and change their properties.
Performance sources:https://web.archive.org/web/20111107065643/http://www.sgtconker.com/2011/05/high-end-performance-optimizations-on-the-xbox-360-and-windows-phone-7/
OO not the holy grail:
Structs behave different when GC-ed.
Don’t create copies: Process information using ref and out parameters.
Don’t use properties: They are methods and push data on the stack.
Flatten complex objects
Performance sources:https://web.archive.org/web/20111107065643/http://www.sgtconker.com/2011/05/high-end-performance-optimizations-on-the-xbox-360-and-windows-phone-7/
Spritesheets:needed to reduce texture switches. From RAM to VRAM.
- Textures with a power of two are a good thing.
- Balance between texture size and image quality.
Best way to model behavior.
Relatie met Update loop.
Behavior tree sources:
http://en.wikipedia.org/wiki/Entity_component_system
http://entity-systems.wikidot.com/
http://www.ashframework.org/
http://gamadu.com/artemis/
http://alecmce.com/library/why-use-entity-systems-for-game-engineering
Example: player & enemies in Boulder World.
Example: Duke nukem rocket.
Entity Component Systems sources:
http://en.wikipedia.org/wiki/Entity_component_system
http://entity-systems.wikidot.com/
http://www.ashframework.org/
http://gamadu.com/artemis/
http://alecmce.com/library/why-use-entity-systems-for-game-engineering
Entity Component Systems sources:
http://en.wikipedia.org/wiki/Entity_component_system
http://entity-systems.wikidot.com/
http://www.ashframework.org/
http://gamadu.com/artemis/
http://alecmce.com/library/why-use-entity-systems-for-game-engineering
Demo 08 - Entity Systems
End of advanced techniques.
Entity Component Systems sources:
http://en.wikipedia.org/wiki/Entity_component_system
http://entity-systems.wikidot.com/
http://www.ashframework.org/
http://gamadu.com/artemis/
http://alecmce.com/library/why-use-entity-systems-for-game-engineering