What is Muskedunder?

Transcription

What is Muskedunder?
Practical System Development
(more or less)
Real
Johan Peitz
Technical Director
Also
!
life e
x
perie
ce!
Muskedunder Interactive
Oct 28, 2008
Johan Peitz, [email protected]
Muskedunder Interactive
Introduction
• Who is Johan Peitz?
• What is Muskedunder?
• Today’s Topics
Oct 28, 2008
Johan Peitz, [email protected]
Muskedunder 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]
Muskedunder 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]
Muskedunder Interactive
Today’s Topics
•
•
•
•
•
•
•
Development Tools
Libraries
Performance & Optimization
Documentation
Content Creation Tools
Short Ogre 3D prime
Flash Demonstrations
Oct 28, 2008
Johan Peitz, [email protected]
Muskedunder Interactive
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
9
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

12/17/07
C, C++, ObC, Fortran, Java, Ada, etc.
Simulation Engines 2007, Markus Larsson
10
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
11
Build tools


Integrated in Visual Studio
Alternatives






12/17/07
Make
CMake
Jam
SCons
Ant (Java)
Maven (Java)
Simulation Engines 2007, Markus Larsson
12
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!

12/17/07
(Or something similar)
Simulation Engines 2007, Markus Larsson
13
CVS

Traceability and safety


Decentralization



All changes are saved
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
14
CVS




Client/Server
Central storage
Multiple local checkouts
Workflow




Update / Checkout
(Solve conflicts)
Change code
Commit
internet
central
repository
12/17/07
Simulation Engines 2007, Markus Larsson
15
CVS






Already installed on most Unix/Linux systems
Command line version
WinCVS
TortoiseCVS
Plugins for most IDEs
Alternatives



12/17/07
Subversion
Sourcesafe
Mercurial
Simulation Engines 2007, Markus Larsson
16
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]
Muskedunder Interactive
Compilers
• Flex Builder
– Built in build tools
• Flash IDE
• Various freeware projects
Oct 28, 2008
Johan Peitz, [email protected]
Muskedunder Interactive
Version Control
• Subversion
–
–
–
–
Ease of use for non programmers
TortoiseSVN
Regular commits
Easy to deploy
• Daily backups
Oct 28, 2008
Johan Peitz, [email protected]
Muskedunder Interactive
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
17
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

12/17/07
3.0 is on the way
Simulation Engines 2007, Markus Larsson
18
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
19
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
20
XNA


Write once, run on (almost) any Microsoft
platform.
Common language runtime



.NET based VM
Very accessible for new developers
XNA Game Studio Express



12/17/07
Windows & XBOX 360
C#
Free
Simulation Engines 2007, Markus Larsson
21
OpenAL




Open Source library for audio
Relatively new, but has grown
rapidly
Multiplatform
Primarily used on stationary computers


Windows, Mac, Linux
Used in:

12/17/07
Battlefield 2, Unreal Tournament, Quake 4, etc.
Simulation Engines 2007, Markus Larsson
22
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
23
Open SG



Open Source API for
scenegraphs
Realtime applications
Mostly for VR

12/17/07
However, the design is
interesting for game
engines
Simulation Engines 2007, Markus Larsson
24
ODE



Open Source physics engine
Multiplatform
Mostly used in hobby productions but also a
few commercial

12/17/07
Stalker, Call of Juarez, Bloodrayne 2
Simulation Engines 2007, Markus Larsson
25
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
26
PhysX




Industry standard physics
engine
Nowadays, the binary SDK is
free
Connects to physics
hardware
Used in lots of next-gen titles

12/17/07
Unreal 3 engine, Mass Effect,
GRAW, etc.
Simulation Engines 2007, Markus Larsson
27
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

12/17/07
Half-life 2, Halo 3, etc.
Simulation Engines 2007, Markus Larsson
28
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
29
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


12/17/07
A lot easier to work with
Slightly less feature rich than MFC
Simulation Engines 2007, Markus Larsson
30
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
31
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
32
Boost


General C++ library
Contains lots of useful stuff





Smart pointers
Regex
Threading
Etc...
Practically a part of standard C++
12/17/07
Simulation Engines 2007, Markus Larsson
33
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]
Muskedunder Interactive
Third Party Libraries
• Box 2D
– Rigid body physics
• Papervision
– 3D graphics
• Active community
– Loads of utilities
Oct 28, 2008
Johan Peitz, [email protected]
Muskedunder Interactive
Break
• Any questions before that?
• Any formalities from Staffan?
Off you go then.
Oct 28, 2008
Johan Peitz, [email protected]
Muskedunder Interactive
Performance and optimization


Optimization techniques and measuring
performance could be a course of its own
Optimize with extreme prejudice


12/17/07
Optimization is a time-consuming task
Put your effort into optimizing the critical parts of the
code and leave the rest to the compiler
Simulation Engines 2007, Markus Larsson
35
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


12/17/07
Identifies bottlenecks
Often, bottlenecks are not where you would expect
them to be
Simulation Engines 2007, Markus Larsson
36
Performance and optimization

Beware of virtual functions



Use assembly only when absolutely necessary



Calling virtual functions in C++ requires looking up
function pointers in the virtual function table of a
class
Do not use in inner loops
Assembly is rarely portable
Try tweaking your compiler first
Read Zen of Code Optimization by Michael
Abrash for tips
12/17/07
Simulation Engines 2007, Markus Larsson
37
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
Oct 28, 2008
Johan Peitz, [email protected]
Muskedunder Interactive
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
38
Documenting a simulation engine

A simulation engine should be documented in at least
the following ways

Requirements


Analysis


Class and interaction diagrams.
Implementation

12/17/07
The conceptual model of your game engine, including the high-level
concepts and their associations.
Design


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.
Api reference (source code documentation).
Simulation Engines 2007, Markus Larsson
39
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);
12/17/07
Simulation Engines 2007, Markus Larsson
40
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
Oct 28, 2008
Johan Peitz, [email protected]
Muskedunder Interactive
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
41
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
42
World Editors: Examples

Terragen


FreeWorld 3D


Generates and renders fairly
impressive procedural terrain
Terrain editor geared towards
with game development with
support for Ogre3D
CryEngine Sandbox

12/17/07
The engine used in FarCry has
exceptional tools for working
with outdoor scenes
Simulation Engines 2007, Markus Larsson
43
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
44
Level Editors: Examples

Hammer


Radiant


Used with the Source engine
(Half-life)
Editor for the Quake3 and now
Doom3 engine
UnrealEd

12/17/07
Official editor for the Unreal
engine
Simulation Engines 2007, Markus Larsson
45
3D modeling

3D Studio Max


Maya


Powerful but not as common
Softimage


Popular with animatos
Lightwave 3D


Most popular
Modern and flexible but not as common
Blender

12/17/07
Free and surprisingly able
Simulation Engines 2007, Markus Larsson
46
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

12/17/07
FBX, Collada, Obj, 3ds, etc
Simulation Engines 2007, Markus Larsson
47
Example: Maya API



Maya Embedded Lanuage, MEL
API for C/C++ access
Fairly usable (in contrast to the Max SDK)
• 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
12/17/07
•
•
•
•
•
•
•
•
•
•
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
Simulation Engines 2007, Markus Larsson
48
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]
Muskedunder Interactive
Content Creation Tools, cont
• Other assets
– In house built tools
– XML export
Oct 28, 2008
Johan Peitz, [email protected]
Muskedunder Interactive
Ogre3D
12/17/07
Simulation Engines 2007, Markus Larsson
49
Ogre showcase
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
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 fast
to develop a game with OGRE than it is with another all-in-one
engine. [...] My philosophy is to build a flexible graphics component
which can be used in the maximum number of situations, and to make
it easy to integrate with other components - not to build an engine
that 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 to
handle only a small subset of scene types, with strongly integrated
features designed from a certain perspective. [...]
12/17/07
Simulation Engines 2007, Markus Larsson
56
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
57
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
58
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
59
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
60
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
• Forums
• Wiki
• IRC
12/17/07
http://www.ogre3d.org
http://www.ogre3d.org/phpBB2/
http://www.ogre3d.org/wiki
irc://freenode/ogre3d
Simulation Engines 2007, Markus Larsson
61
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]
Muskedunder Interactive
Thanks for listening!
Johan Peitz
[email protected]
www.muskedunder-i.com
And yes, we’re open to ”exjobb”! Not only Flash related, but preferably. Don’t hesitate to ask.
Oct 28, 2008
Johan Peitz, [email protected]
Muskedunder Interactive