Upload
others
View
5
Download
0
Embed Size (px)
Citation preview
Oct 28, 2008 Johan Peitz, [email protected] Interactive
Practical System Development(more or less)
Johan PeitzTechnical Director
Muskedunder Interactive
Also!Real life experiece!
Oct 28, 2008 Johan Peitz, [email protected] Interactive
Introduction
• Who is Johan Peitz?
• What is Muskedunder?
• Today’s Topics
Oct 28, 2008 Johan Peitz, [email protected] Interactive
Who is Johan Peitz?
• Background in computer science– Chalmers, 2004
• Free Lunch Design– independent game developer, Icy Tower
• Nokia Games Group– games for digital TV
• Saab Technologies– promotional games
• Interactive Institute– game design research, prototyping pervasive games
• Muskedunder Interactive– Flash game developer– Co-owner and Technical Director
Oct 28, 2008 Johan Peitz, [email protected] Interactive
What is Muskedunder?
• Premium Flash Content Developer
• 100% privately held
• Advergames for global brands– McDonald's, Pepsi, Paramount Pictures, Doritos, etc.
• Side venues include casual games, web development
Oct 28, 2008 Johan Peitz, [email protected] Interactive
Today’s Topics
• Development Tools
• Libraries
• Performance & Optimization
• Documentation
• Content Creation Tools
• Short Ogre 3D prime
• Flash Demonstrations
12/17/07 Simulation Engines 2007, Markus Larsson 9
Tools
Compilers C++
Debuggers Find bugs
Profilers Analyze performance
Source code management Storage and version control
UML-editors Software design and code generation
IDEs MSVC, Eclipse, Netbeans, Code:Blocks, and so on...
12/17/07 Simulation Engines 2007, Markus Larsson 10
Compilers
Popular compilers for C++ Microsoft Visual C++ GNU C++ compiler Intel C++ compiler
GNU C++ compiler Free Open Source Available on multiple platforms Support for many languages
C, C++, ObC, Fortran, Java, Ada, etc.
12/17/07 Simulation Engines 2007, Markus Larsson 11
Compilers
Microsoft Visual C++ Integrated in Microsoft Visual Studio Will be used in this course
Installed on lab computers Downloadable through Academic Alliance
http://my.chl.chalmers.se/wiki/view/chl/MicrosoftAcademy/
12/17/07 Simulation Engines 2007, Markus Larsson 12
Build tools
Integrated in Visual Studio Alternatives
Make CMake Jam SCons Ant (Java) Maven (Java)
12/17/07 Simulation Engines 2007, Markus Larsson 13
Concurrent version systems (CVS)
Access to files regardless of where you are Unreserved checkout Available on pretty much any platform
Available on the group accounts you will receive Used by many projects worldwide
Use CVS for your group projects! (Or something similar)
12/17/07 Simulation Engines 2007, Markus Larsson 14
CVS
Traceability and safety All changes are saved
Decentralization Multiple developers can work on the same code
Code from multiple developers is automatically unified
No atomic commits in CVS
12/17/07 Simulation Engines 2007, Markus Larsson 15
CVS
Client/Server Central storage Multiple local checkouts Workflow
Update / Checkout (Solve conflicts) Change code Commit
centralrepository
internet
12/17/07 Simulation Engines 2007, Markus Larsson 16
CVS
Already installed on most Unix/Linux systems Command line version WinCVS TortoiseCVS Plugins for most IDEs Alternatives
Subversion Sourcesafe Mercurial
Oct 28, 2008 Johan Peitz, [email protected] Interactive
Flash & Action Script 3
• Flash is old, but still immature
• Animation tool
• Regular programming language
• Powerful authoring tool
Oct 28, 2008 Johan Peitz, [email protected] Interactive
Compilers
• Flex Builder– Built in build tools
• Flash IDE
• Various freeware projects
Oct 28, 2008 Johan Peitz, [email protected] Interactive
Version Control
• Subversion– Ease of use for non programmers
– TortoiseSVN
– Regular commits
– Easy to deploy
• Daily backups
12/17/07 Simulation Engines 2007, Markus Larsson 17
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.
12/17/07 Simulation Engines 2007, Markus Larsson 18
OpenGL
Industry standard for 2D and 3D graphics Started 1992 by OpenGL Architecture Review
Board (now OpenGL Working Group) Latest version (Nov 2007) is 2.1
3.0 is on the way
12/17/07 Simulation Engines 2007, Markus Larsson 19
OpenGL
OpenGL is multiplatform “Glue”-layers for window handling
GLX on Unix/Linux WGL on Windows
Programmable shaders with GLSL
12/17/07 Simulation Engines 2007, Markus Larsson 20
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
12/17/07 Simulation Engines 2007, Markus Larsson 21
XNA
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# Free
12/17/07 Simulation Engines 2007, Markus Larsson 22
OpenAL
Open Source library for audio Relatively new, but has grown
rapidly Multiplatform Primarily used on stationary computers
Windows, Mac, Linux Used in:
Battlefield 2, Unreal Tournament, Quake 4, etc.
12/17/07 Simulation Engines 2007, Markus Larsson 23
FMOD
Library for sound Multiplatform
PC, all consoles, etc. Support for most audio formats Free for non-commercial use
12/17/07 Simulation Engines 2007, Markus Larsson 24
Open SG
Open Source API for scenegraphs
Realtime applications Mostly for VR
However, the design is interesting for game engines
12/17/07 Simulation Engines 2007, Markus Larsson 25
ODE
Open Source physics engine Multiplatform Mostly used in hobby productions but also a
few commercial Stalker, Call of Juarez, Bloodrayne 2
12/17/07 Simulation Engines 2007, Markus Larsson 26
Newton
Free physics engine Not open source but free to use Used in the Swedish
independent game Penumbra.
12/17/07 Simulation Engines 2007, Markus Larsson 27
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, etc.
12/17/07 Simulation Engines 2007, Markus Larsson 28
Havok
The other industry standard physics engine Not free or publicly accessible 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.
12/17/07 Simulation Engines 2007, Markus Larsson 29
CEGUI
Open Source GUI system Object oriented architecture
with interfaces and events Integrated into Ogre3D LGPL, so free to use
12/17/07 Simulation Engines 2007, Markus Larsson 30
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 Forms in .NET
A lot easier to work with Slightly less feature rich than MFC
12/17/07 Simulation Engines 2007, Markus Larsson 31
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
12/17/07 Simulation Engines 2007, Markus Larsson 32
Open TNL
Torque Network Layer Originally a part of the Torque engine Open Source version of TNL and is intended for
non-commercial use
12/17/07 Simulation Engines 2007, Markus Larsson 33
Boost
General C++ library Contains lots of useful stuff
Smart pointers Regex Threading Etc...
Practically a part of standard C++
Oct 28, 2008 Johan Peitz, [email protected] Interactive
Flash Features
• Most functionality built in– 2D graphics (not hardware accelerated)
– Basic sound playback
– Inverse Kinematic animation (FP10)
– Network support
– Webservices
Oct 28, 2008 Johan Peitz, [email protected] Interactive
Third Party Libraries
• Box 2D– Rigid body physics
• Papervision– 3D graphics
• Active community– Loads of utilities
Oct 28, 2008 Johan Peitz, [email protected] Interactive
Break
• Any questions before that?
• Any formalities from Staffan?
Off you go then.
12/17/07 Simulation Engines 2007, Markus Larsson 35
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
12/17/07 Simulation Engines 2007, Markus Larsson 36
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
12/17/07 Simulation Engines 2007, Markus Larsson 37
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
Oct 28, 2008 Johan Peitz, [email protected] Interactive
Performance & Optimization
• Graphics optimizing– Bitmaps vs Vector art
– anchor points
– Demo later!
• Code optimizing– Flash is slow as it is, concentrate on high level algorithms.
– Maintainable code over slightly faster code.
– Focus on reusability
12/17/07 Simulation Engines 2007, Markus Larsson 38
Documentation
Your role is 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!
12/17/07 Simulation Engines 2007, Markus Larsson 39
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.
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).
12/17/07 Simulation Engines 2007, Markus Larsson 40
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);
Oct 28, 2008 Johan Peitz, [email protected] Interactive
Documentation
• Architecture documentation – UML
• Class diagrams• Interaction diagrams when needed
• Code documentation– AS3doc, like javadoc– Code generation
• Challenges– Small projects = less need for extensive documentation– Reused projects = more need for extensive documentation
12/17/07 Simulation Engines 2007, Markus Larsson 41
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
12/17/07 Simulation Engines 2007, Markus Larsson 42
World Editors
Large difference between outdoor and indoor environments
Outdoor environments are mostly based on heightmaps
Objects often placed on heightmap in 2½D
12/17/07 Simulation Engines 2007, Markus Larsson 43
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
12/17/07 Simulation Engines 2007, Markus Larsson 44
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
12/17/07 Simulation Engines 2007, Markus Larsson 45
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
12/17/07 Simulation Engines 2007, Markus Larsson 46
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
12/17/07 Simulation Engines 2007, Markus Larsson 47
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
12/17/07 Simulation Engines 2007, Markus Larsson 48
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
Oct 28, 2008 Johan Peitz, [email protected] Interactive
Content Creation Tools
• Graphics– 2D graphics, textures
• Photoshop
– 3D models, UV-mapping• Maya + various plugins
• Low poly
– GUI, 2D game graphics• Flash Editor
Oct 28, 2008 Johan Peitz, [email protected] Interactive
Content Creation Tools, cont
• Other assets– In house built tools
– XML export
12/17/07 Simulation Engines 2007, Markus Larsson 50
Ogre showcase
12/17/07 Simulation Engines 2007, Markus Larsson 51
Ogre showcase
12/17/07 Simulation Engines 2007, Markus Larsson 52
Ogre showcase
12/17/07 Simulation Engines 2007, Markus Larsson 53
Ogre showcase
12/17/07 Simulation Engines 2007, Markus Larsson 54
Ogre showcase
12/17/07 Simulation Engines 2007, Markus Larsson 55
Ogre showcase
12/17/07 Simulation Engines 2007, Markus Larsson 56
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. [...]
12/17/07 Simulation Engines 2007, Markus Larsson 57
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!
12/17/07 Simulation Engines 2007, Markus Larsson 58
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...
12/17/07 Simulation Engines 2007, Markus Larsson 59
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
12/17/07 Simulation Engines 2007, Markus Larsson 60
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
RTFM
12/17/07 Simulation Engines 2007, Markus Larsson 61
Where to get help
Do not hesitate to ask your project supervisor, but we 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
Oct 28, 2008 Johan Peitz, [email protected] Interactive
Conclusion
• Simulation engines are complex– There is no right way to do it– Try to follow ’Best Practices’
• Analyze, Design, Test, Evaluate– Iterate, iterate, iterate
• If you get stuck, ask!– Internet is here to stay
• Don’t reinvent the wheel– Use libraries
• Don’t be afraid to try new things– Learning by doing
Ok, Let’s look at some Flash demos!
Oct 28, 2008 Johan Peitz, [email protected] Interactive
Thanks for listening!
Johan Peitz
www.muskedunder-i.com
And yes, we’re open to ”exjobb”! Not only Flash related, but preferably. Don’t hesitate to ask.