IDC | Interaction Design Collegium
Todays Topics
Development Tools Libraries Documentation Performance and optimization Short Ogre3D primer
Focus on Software Engineering
2
IDC | Interaction Design Collegium
Administrative Stuff
Check the webpage for updates Any new arrivals? Student Representatives The groups Group meetings
3
IDC | Interaction Design Collegium
Course Information (once more)
Examination in this course consists of a group project. The course has no written exam
A passing grade requires the following: An approved written suggestion for an individual extension of the
simulation engine A passing grade on your group's project report A passing grade on your group's project presentation A passing grade on your personal project report A verbal presentation of a course subject
The course is divided in two parts. One part is 2 points and represents each student's individual effort and the other is 3 points and represents the project group's collaborative effort. Possible grades are failure, 3, 4 and 5 at Chalmers or U, G and VG at Göteborgs Universitet. Grading is individual and is based on the above mentioned subjects as well as the project supervisor's judgement.
4
IDC | Interaction Design Collegium
Important dates (once more) Mon, 2 Nov 24.00
Extension suggestions should be handed in to project supervisors
Mon, 9 Nov Approval of extension suggestions
Week 2-7 Individual presentations of themes from project members
Mon, 11 Jan 24.00 Group reports and individual reports should be handed in
Exam week Project presentations
Failing to keep a deadline without a proper explanation in good time before the deadline will result in a failing grade!
5
IDC | Interaction Design Collegium
Course contents (once more)
Introduction to simulation engines and practical information Software engineering, architecture and design Multimedia and scenegraphs 3D graphics AI and network Physics Input and collision detections, misc. Project demos:
Project Deliveries
Extension suggestion, group project repot, individual report Demonstrations
Extension demonstration, project demonstration No written exam
6
IDC | Interaction Design Collegium
The project (repeated)
This course is based on the group project 5 students per group Individually
Responsible for their own theme Suggesting an extension to the simulation engine within their theme Implementing their extension Verbally present their theme and extension to the rest of their group Write an individual report and project diary
Groups Design and implement a tech demo that utilizes all of the extensions
that have been created by the group members Write a project report Verbally present the project to the rest of the class
7
IDC | Interaction Design Collegium
Form Groups (once more)
Form groups of 5 people (no exceptions unless absolutely necessary!)
Write down the name and email of everyone in your group Themes
Software Engineering 3D graphics Multimedia AI and network Physics (Misc)
First individual presentation next week!
8
IDC | Interaction Design Collegium
How to group-work and share with me All students are required a Google Account
concerned about your data? http://www.dataliberation.org/
Sharing Documents (Google Docs) The group report and any tech demo presentation must be created and shared by the
group head to me ([email protected]) and all group members The group head will create a folder named as follow simEngines-g# (ex. simEngines-g1)
and share it with me Inside the folder there will be two files named as follow simEngines-g#-GroupReport (ex.
simEngines-g6-GroupReport) and simEngines-g#-GroupPresentation (ex. simEngines-g2-GroupPresentation)
For individual reports, extension suggestions and presentation it is enough to create the documents and share them with me without creating a folder. Naming conventions are simEngines-g#-YourName-Report|Extension|Presentation (ex. simEngines-g7-TommasoPiazza-Report, simEngines-g7-TommasoPiazza-Extension, simEngines-g7-TommasoPiazza-Presentation)
Sharing Code (Google Code) http://code.google.com/hosting/createProject - Created by the group head invite all group members and me Version control system is SVN. License is up to you
9
IDC | Interaction Design Collegium
Development Tools Compilers
C++ (G++, Hp aC++, Intel C++ Compiler, Visual C++ ...) Debuggers
Find bugs (GDB, IDB,Visual Studio Debugger...) Profilers
Analyze performance (Valgrind, Google Perf-Tools, VTune, GlowCode ...) Source code management
Storage and version control (CVS, SVN, Mercurial...) UML-editors
Software design and code generation ( ArgoUML, Umbrello, StarUML ...) IDEs
MSVS, Eclipse, Netbeans, Code:Blocks, Xcode ...
10
IDC | Interaction Design Collegium
Compilers Microsoft Visual C++ Integrated in Microsoft Visual Studio 2008 Will be used in this course Downloadable through Academic Alliance
http://my.chl.chalmers.se/wiki/view/chl/MicrosoftAcademy/ http://msdn60.e-academy.com/elms/Storefront/Home.aspx?campus=dth_hsg
11
IDC | Interaction Design Collegium
Build Tools
Integrated in Visual Studio Alternatives Make CMake Jam SCons Ant (Java) Maven (Java)
12
IDC | Interaction Design Collegium
Source Code Management
SVN - Subversion Successor of CVS (Concurrent Version System) Cross platform Atomic commits (Interrupted commit operations
would otherwise cause repository inconsistency or corruption), biggest difference with CVS
Variety of access protocols Locally file:///path/ Remote WebDAV http://host/path or https://host/path SVN protocol svn://host/path or svn+ssh://host/path
13
IDC | Interaction Design Collegium
Subversion (1) Traceability and safety All changes are saved Each commit is a revision
Decentralization Multiple developers can work on the same code copy-modify-merge solution
Code from multiple developers is automatically unified
14
IDC | Interaction Design Collegium
Subversion (2)
Copyright © 2002, 2003, 2004 Ben Collins-Sussman, Brian W. Fitzpatrick, C. Michael Pilato, http://svnbook.red-bean.com/en/1.0/index.html
15
IDC | Interaction Design Collegium
Subversion (3)
Client/Server Central storage Multiple local checkouts
Workflow Update / Checkout (Solve conflicts) Change code Commit
16
IDC | Interaction Design Collegium
Subversion (4) Stand Alone Clients Command line version RapidSVN TortoiseSVN
Plugins for most IDEs Visual Studio
Visual SVN AnkhSVN
Eclipse Subclipse Subvervise
17
IDC | Interaction Design Collegium
Libraries Do not reinvent the wheel! Reuse code as much as
possible In the group project, you are
not expected to write all code yourself. You are allowed to use external libraries.
18
IDC | Interaction Design Collegium
OpenGL
Open Graphics Library Industry standard for 2D and 3D
graphics OpenGL was developed by Silicon
Graphics Inc. (SGI) in 1992, led the creation of the OpenGL architectural review board (OpenGL ARB)
On the 31st July, 2006 it was announced at SIGGRAPH that control of the OpenGL specification would be passed to the Khronos Group
20
IDC | Interaction Design Collegium
OpenGL (2)
OpenGL is multiplatform Embedded version OpenGL ES
“Glue”-layers for window handling GLX on Unix/Linux WGL on Windows CGL on Mac OS X
Programmable shaders with GLSL
21
IDC | Interaction Design Collegium
DirectX/Direct3D
Started in 1995 by Microsoft Collection of APIs for a lot of
different multimedia Feature rich and good performance Fast to adapt new technologies Good standard libraries Arguably more cumbersome than OpenGL Programmable shaders with HLSL
22
IDC | Interaction Design Collegium
XNA (XNA's Not Acronymed)
A set of tools with a managed runtime environment that facilitates computer games development
Write once, run on (almost) any Microsoft platform. Common language runtime
.NET based VM Very accessible for new developers XNA Game Studio Express
Windows & XBOX 360 C# (officially supported) Free
23
IDC | Interaction Design Collegium
Open SG
Open Source API for scenegraphs (collection of nodes in a tree describing a scene)
Realtime applications Mostly for VR However, the design is
interesting for game engines
24
IDC | Interaction Design Collegium
OpenAL
Open Source library for audio Has grown rapidly Multiplatform Primarily used on stationary computers Windows, Mac, Linux but available also for Xbox and Xbox 360 and
iPhone Used in: Battlefield 2, Unreal Tournament, Quake 4, etc.
26
IDC | Interaction Design Collegium
FMOD
Library for sound Multiplatform PC, Wii, Xbox, Xbox 360, Ps3, iPhone, etc.
Support for most audio formats Free for non-commercial use Batman: Arkham Asylum, Far Cry, Guitar Hero, LittleBigPlanet,
Call of Duty 4, Forza Motorsport, Starcraft 2 ....
27
IDC | Interaction Design Collegium
ODE
Open Source physics engine Multiplatform Mostly used in hobby productions but also a
few commercial Stalker, Call of Juarez, Bloodrayne 2
29
IDC | Interaction Design Collegium
Newton
Free physics engine Not open source but free to use Used in the Swedish independent game
Penumbra.
30
IDC | Interaction Design Collegium
PhysX
Industry standard physics engine
Nowadays, the binary SDK is free
Connects to physics hardware
Used in lots of next-gen titles Unreal 3 engine, Mass Effect,
GRAW, Mirror’s Edge...
31
IDC | Interaction Design Collegium
Havok
The other industry standard physics engine Commercially available, free for non
commercial use Has packages for physics driven character
behaviors and animation in addition to the physics engine.
Used in major titles Half-life 2, Halo 3, etc.
32
IDC | Interaction Design Collegium
Bullet 3D
Multiplatform (Playstation 3, XBox 360, Nintendo Wii, PC and iPhone) Open Source Modular extendible C++ design with hot-swap of most components Optimized back-ends with multi-threaded support for Playstation 3 Cell SPU, CUDA,
OpenCL and other platforms Features
Discrete and continuous collision detection (CCD)
Swept collision queries
Ray casting with custom collision filtering
Generic convex support (using GJK), capsule, cylinder, cone, sphere, box and non-convex triangle meshes.
Rigid body dynamics including constraint solvers, generic constraints, ragdolls, hinge, ball-socket
Support for constraint limits and motors
Soft body support including cloth, rope and deformable
Bullet is integrated into Blender 3D and provides a Maya Plugin Supports import and export into COLLADA 1.4 Physics format
Support for dynamic deformation of non-convex triangle meshes, by refitting the acceleration structures
Halo 3, Free realms, Trial HD...
33
IDC | Interaction Design Collegium
CEGUI
Open Source GUI system Object oriented architecture with interfaces and
events Integrated into Ogre3D LGPL, so free to use
35
IDC | Interaction Design Collegium
Microsoft Foundation Classes (MFC)
Graphical interface for Windows Based largely on inheritance and polymorphism Large amount of classes and arguably hard to
work with Succeeded by Windows Presentation
Foundation in .NET 3.0 designed to remove dependencies on the aging GDI built on DirectX clear separation between the user interface and the
programming logic
36
IDC | Interaction Design Collegium
GTK+
Multiplatform GUI toolkit Used primarily in Linux/Unix environments Nowadays available in Windows as well
Initially developed for The Gimp which is an Open Source image editor
Alternatives to GTK are Qt and Motif
37
IDC | Interaction Design Collegium
Scaleform
Commercially available Used in countless number of games Flash based Flash Videos Animated Textures Audio support ...
Editor for quickly building UIs Even full mini games
http://www.scaleform.com/
38
IDC | Interaction Design Collegium
Open TNL
Torque Network Layer Originally a part of the Torque engine Open Source version of TNL and is intended for
non-commercial use
40
IDC | Interaction Design Collegium
RakNet Free for non-commercial use Multiplatform Used by mayor game developers Extensively documented Features
Lobby system Object replication system Secure connections Robust communication layer RPC Voice Communication NAT PunchThrough
Video Tutorial of Features http://www.rakkarsoft.com/raknet/
manual/RakNetMajorFeatures.html
41
IDC | Interaction Design Collegium
Boost
General C++ library Contains lots of useful stuff Smart pointers Regex Threading Etc...
Practically a part of standard C++
43
IDC | Interaction Design Collegium
Performance and optimization
Optimization techniques and measuring performance could be a course of its own
Optimize with extreme prejudice Optimization is a time-consuming task Put your effort into optimizing the critical parts of
the code and leave the rest to the compiler
45
IDC | Interaction Design Collegium
Performance and optimization
High-level and inner loops Optimizing functions that are called just a few times
is meaningless Optimize inner loops Optimize high-level functionality. Switching
algorithms can boost performance a lot more than low-level optimizations
Use a profiler Identifies bottlenecks Often, bottlenecks are not where you would expect
them to be
46
IDC | Interaction Design Collegium
Performance and optimization
Beware of virtual functions Calling virtual functions in C++ requires looking up
function pointers in the virtual function table of a class
Do not use in inner loops Use assembly only when absolutely necessary Assembly is rarely portable Try tweaking your compiler first
Read Zen of Code Optimization by Michael Abrash for tips
47
IDC | Interaction Design Collegium
Documentation
Your role as a software engineer Engineers write documentation Reports Documentation for code and implementations
Extra important for a reusable simulation engine
Badly documented projects will automatically fail this course!
48
IDC | Interaction Design Collegium
Documenting a simulation engine
A simulation engine should be documented in at least the following ways Requirements
Functional and non-functional requirements on the engine or the extensions made to it. Functional requirements are the features that the engine is actually capable of, whereas non-functional ones describe its properties.
Functional requirements may be calculations, technical details, data manipulation and processing and other specific functionality that define what a system is supposed to accomplish.
Non-functional requirements (also known as quality requirements), impose constraints on the design or implementation (such as performance requirements, security, or reliability)
Analysis The conceptual model of your game engine, including the high-level concepts and
their associations.
Design Class and interaction diagrams
Implementation Api reference (source code documentation).
49
IDC | Interaction Design Collegium
Doxygen
Documentation system C/C++, Java, etc.
Inspired by Javadoc Generates both HTML and offline manuals
/** * This is a documentation string. * * @param i first parameter * @param j second parameter * @return description of return value. */int foo(int i, int j);
50
IDC | Interaction Design Collegium
Content Creation Tools
Code is our thing, but not necessarily everyone else's
Simulation engines, and the projects they are used with, require extremely functional content pipelines
51
IDC | Interaction Design Collegium
World Editors
Large difference between outdoor and indoor environments
Outdoor environments are mostly based on heightmaps
Objects often placed on heightmap in 2½D
52
IDC | Interaction Design Collegium
World Editors: Examples
Terragen Generates and renders fairly
impressive procedural terrain FreeWorld 3D
Terrain editor geared towards with game development with support for Ogre3D
CryEngine Sandbox The engine used in FarCry
has exceptional tools for working with outdoor scenes
53
IDC | Interaction Design Collegium
Level editors
Geared towards indoor scenery Nowadays, thin line between
level editors and outdoor scene editors
Commonly released along with the games they were built for
Similar to regular 3D modeling tools, but simplified
A science of its own, check the web for lots and lots of information
54
IDC | Interaction Design Collegium
Level Editors: Examples
Hammer Used with the Source engine
(Half-life) Radiant
Editor for the Quake3 and now Doom3 engine
UnrealEd Official editor for the Unreal
engine Sandbox
Official editor for the CryEngine
55
IDC | Interaction Design Collegium
3D modeling
3D Studio Max Most popular
Maya Popular with animatos
Lightwave 3D Powerful but not as common
Softimage Modern and flexible but not
as common Blender
Free and surprisingly able
56
IDC | Interaction Design Collegium
Integrate 3D modeling software
Programmers are rarely 3D artists as well Need to translate data from 3D modeling
application to simulation engine Often, special tools need to be written in native
APIs Alternatively rely on standard export formats FBX, Collada, Obj, 3ds, etc
57
IDC | Interaction Design Collegium
Example: Maya API
Maya Embedded Lanuage, MEL API for C/C++ access Fairly usable (in contrast to the Max SDK)
• 3D graphical manipulators• geometry shapes• dynamic fields• particle emitters• node and plug locking• custom model views• user defined transformations• motion capture servers• manipulators• any other type of custom node
• MEL commands• file translators (e.g. exporters for game engines, or third party renderers)• drawing in OpenGL• inverse-kinematic solvers• shaders, lights, textures hardware shaders• procedural animation• simulators (e.g. Maya Cloth was written entirely using the API)• user-defined deformations
58
IDC | Interaction Design Collegium
Ogre3D
Ogre is not a complete simulation engine It is primarily a renderer
“I realise this approach means that as of today, it’s not as fastto develop a game with OGRE than it is with another all-in-oneengine. [...] My philosophy is to build a flexible graphics componentwhich can be used in the maximum number of situations, and to makeit easy to integrate with other components - not to build an enginethat can be used to make a small number of game variants. [...]You’ll find it a lot harder to extend an engine which is designed tohandle only a small subset of scene types, with strongly integratedfeatures designed from a certain perspective. [...]”
66
IDC | Interaction Design Collegium
Ogre3D is not...
Commercial It is freely available for use even in commercial projects
Closed source Ogre3D is Open Source with full access to all underlying source code
Finished Open Source applications are never finished and undergo constant
improvements. Ogre3D has reached v1.0 though and is reasonably stable.
Bug-Free Connected to the previous item
A complete simulation engine Only provides 3D functionality and rudimentary input
Completely documented Be prepared to get your hands dirty! I mean it!
67
IDC | Interaction Design Collegium
Ogre3D contains
Windows, MacOS & Linux support Direct3D and OpenGL support Material and shader system with support for CG, HLSL and GLSL Texture and mesh loading Skeletal and morph animation Scene management with support for many different types of
scenes Shadow rendering Compositor system for post processing effects Particle systems Resource management Lots of other stuff...
68
IDC | Interaction Design Collegium
What completes the gaps?
Sound OpenAL, FMOD
Collision / Physics OpCode, Bullet,
PhysX, ODE, Newton AI
OpenSteer, FFLL
Network OpenTNL, ZoidCom, RakNet
GUI CEGUI, Flash
Scripting Lua, Python, GameMonkey,
Ruby
69
IDC | Interaction Design Collegium
Get started with Ogre3D
Install a compiler of your choice (for this course, preferably Visual Studio)
Plenty of tutorials, demos, help texts at www.ogre3d.org
Read the documentation (RTFM)
70
IDC | Interaction Design Collegium
Where to get help
Do not hesitate to ask, but I will not be able to assist in every possible case
Visit these places Official website http://www.ogre3d.org Forums http://www.ogre3d.org/phpBB2/ Wiki http://www.ogre3d.org/wiki IRC irc://freenode/ogre3d
71
IDC | Interaction Design Collegium
Conclusion
There is a lot to think about when it comes to simulation engines
These lectures will not cover specific or practical details. Find those on your own. Do not be afraid to ask questions though.
Please help each other with help in installing the SDKs to get started and so forth
72