Transcript Lect 5

ITB/ITN751 Games Production
Lecture 5
Game Engine Programming
Ross Brown
CRICOS No. 000213J
Queensland University of Technology
Lecture Contents
• Game Engine Programming
• Guest Lecture – Lachlan Bland, THQ
a university for the
real world
R
CRICOS No. 000213J
Readings
• Textbook Chapters:
– Chapter 7
• Websites:
– http://www.gamecareerguide.com/features/171/so_you_want_to
_be_a_game_programmer.php?page=2 - a programmers view of
game programming skills
– http://www.gamecareerguide.com/features/137/career_paths_in_
the_game_.php?page=1 – nice reference for the assignment
– http://www.gamasutra.com/features/20020715/olsen_01.shtml some wage issues covered here
a university for the
real world
R
CRICOS No. 000213J
Bigger, better, faster, stronger
• “Programming today is a race between software
engineers striving to build bigger and better
idiot-proof programs, and the Universe trying to
produce bigger and better idiots. So far, the
Universe is winning” - Rick Cook
a university for the
real world
R
CRICOS No. 000213J
Havok Euphoria Engine Software
http://www.youtube.com/watch?v=3bKphYfUk-M
a university for the
real world
R
CRICOS No. 000213J
Game Engine Programming
• This is the first lecture on a programming role
within the game industry
• Game Engine development is one of the basic
jobs within the computer games
industry…maybe the oldest
• Argument: it predates graphics technology, so
text-based art free games were still programmed
a university for the
real world
R
CRICOS No. 000213J
What is a Game Engine?
• Underlying software technology that supports the execution of the
game
• Contains a number of software modules (amongst others) integrated
together to provide the gaming experience:
–
–
–
–
–
–
–
–
Graphics
Physics
Sound
Scripting
Animation
Artificial Intelligence
Networking
User Interface
a university for the
real world
R
CRICOS No. 000213J
Game Engine Overview
Game Engine
AI
Game
Content
Physics
Graphics
Scene
Graph
User
Interface
a university for the
Audio
real world
R
CRICOS No. 000213J
Game Engines
• Developed to abstract away underlying aspects
of a game
• Enables reuse of code
• Facilitates porting code to other hardware
platforms
a university for the
real world
R
CRICOS No. 000213J
Graphics Module
• Provides an abstraction of the Graphics Processing Unit
(GPU) in the hardware
• Provides the ability to render the geometric content
created by artists at the highest level of fidelity possible
• Incorporates advanced real-time mathematical models of
how light interacts with the surface of an object
• Modern GPUs are programmable allowing for very
sophisticated effects
a university for the
real world
R
CRICOS No. 000213J
Graphics
Sprites
Sprites
Surface Materials
Shadows
Bloom
Bump Mapping
a university for the
real world
R
CRICOS No. 000213J
Physics Model
• Implements Newtonian model of physics for the
game environment objects
• Gives the game object’s mass, force and
velocity and uses collision detection methods to
provide animation
• Often uses simplifications of physics models to
simulate the physics in order to provide real-time
responses
a university for the
real world
R
CRICOS No. 000213J
Sumotori Dreams
http://web.t-online.hu/archee83/sumotori/
• Simple physics demo
• Fits into 96k
• Illustrates:
–
–
–
–
Collision Detection
Animations
Newtonian Physics
Rag Doll Physics
http://youtube.com/watch?v=hOvq3-oG5BM
a university for the
real world
R
CRICOS No. 000213J
Sound Module
• Manages the components of the soundtrack
content developed by musicians and sound
designers
• Executes sounds based on triggers in the
environment from explicit execution, time events
or interactions between game objects – eg.
collisions
a university for the
real world
R
CRICOS No. 000213J
Scripting
• A language add-on to the engine that exposes
internal engine architecture
• Allows designers to glue the game together by
implementing the gameplay mechanics for
events, AI, rewards, etc.
a university for the
real world
R
CRICOS No. 000213J
Animation
• Data structures are provided to manage and
support hierarchical rigging and to animate the
scripts stored from mocap and animations hard
coded by the animators
• The animation system needs to blend between
the various canned animations and the physics
interactions
a university for the
real world
R
CRICOS No. 000213J
Artificial Intelligence
• Provides finite state automata and a behaviour
model for the agents in the game to behave
• Also provides facilities for learned behaviours –
Neural Networks
• Group behaviours (swarming), predator (seek),
prey (flee) behaviours
• Path finding is another included component for
Non-Player Character (NPCs) to find their way
around a game environment
a university for the
real world
R
CRICOS No. 000213J
Artificial Intelligence
Neural
Network
Seek and Flee Behaviour
Flocking
Finite State Automata
a university for the
real world
R
CRICOS No. 000213J
Networking
• Software to support network
connections to other clients on
a network or to servers
• Used to maintain verified game
state on any machine
connected to the server
• Sophisticated caching software
is used to make sure every
node is made aware of the
present state of the game
http://www.bigworldtech.com/technology/server_en.php
a university for the
real world
R
CRICOS No. 000213J
Scene Graph
• Tree data structure used to store the content
• Is operated upon by the Artificial Intelligence and
Physics modules to update its state
• Fed to Graphics Module to be rendered (drawn)
into the framebuffer (screen memory)
a university for the
real world
R
CRICOS No. 000213J
Scene Graph
• Above shows a simple example of a scene graph for a
robot
http://www-evasion.imag.fr/~Francois.Faure/doc/inventorMentor/sgi_html/ch03.html#id17983
a university for the
real world
R
CRICOS No. 000213J
Game Loop
• While user input not exit
–
–
–
–
Update Scene-Graph with network cache
Update Scene-Graph via AI
Update Scene-Graph via Physics and Animation
Render Scene-Graph to Screen via Graphics System
• Endwhile
a university for the
real world
R
CRICOS No. 000213J
Game Engine is Real-time
• All of this has to be updated at ~30 frames per
second for a game
• Thus entire loop must run in 1/30th second or
less for high quality animation rates
• Thus a very tight real-time system
• Thus programmer skills MUST be at a high level
a university for the
real world
R
CRICOS No. 000213J
Game Engine Developer
•
•
•
•
Programs the Game Engine
Programs one or multiple modules in the engine
Tends to be a specialist in one area
Usually the best programmers in the shop
a university for the
real world
R
CRICOS No. 000213J
Roles
•
•
•
•
Engine Development
Engine Research and Development
Cross Platform Development
Bug fixing with Quality Assurance (QA)
a university for the
real world
R
CRICOS No. 000213J
Roles
• Work with a lead developer in a development
team
• Works with technical director who oversees a
number of projects
• Work with animators and designers to negotiate
technical requirements for the game
a university for the
real world
R
CRICOS No. 000213J
Skillset
• High level Software Engineering skills –
specification, testing, documentation skills
• Deep understanding of basic computer science
algorithms – hashing, data structures, pointer
arithmetic, code optimisation (necessary)
• C++ a necessity
a university for the
real world
R
CRICOS No. 000213J
Skillset
• Usual analytical skills required from general ICT
programming for specification/understanding of
program design
• Problem solving skills – creative solutions and or
bug fixing
• Mathematics, Physics and AI skills very
desirable
a university for the
real world
R
CRICOS No. 000213J
Skillset
• Multiprocessor programming – concurrant
programming of multiple threads (mini
programs) - for the new multicore Xbox, PC and
PS3s
• Do lots of development of your own mods - good
• Development of deep technical skills via creation
of your own engine components
• People skills – yep, that again
a university for the
real world
R
CRICOS No. 000213J
Development Tools
• Interactive Development
Environments (IDE)
– Visual Studio, Eclipse…
• Sophisticated environments for
the development of software:
– Intelligent Editors – think word
processor for source code
– Debuggers – allows you to
watch the code execute to find
problems (bugs)
– Profilers – enables analysis of
the efficiency of developed
code
a university for the
real world
R
CRICOS No. 000213J
Development Tools
• Application Programming Interfaces (APIs)
–
–
–
–
Libraries of useful code to use within into your source code
DirectX – graphics/audio
OpenGL – graphics
Open Audio – audio
• Middleware – useful software APIs that facilitate various
smaller tasks in games (goes between other
components)
– Physics, Data Processing, Networking, AI, User Interfaces
– Goto: http://www.gamemiddleware.org/middleware/index.html
a university for the
real world
R
CRICOS No. 000213J
Console/Handheld Development Tools
• Console/Handheld
Development Kits
• To develop for a console or
handheld device – X360, PS3,
DS, PSP
• Specially manufactured
hardware is used to
communicate via a network
link
Aug. 2006, PS3 Dev. Kit
http://au.media.ps3.ign.com/articles/726/726255/img_3851913.html
a university for the
real world
R
CRICOS No. 000213J
Console/Handheld Development Tools
• Remotely debug software on device
• Consoles only run signed code, so need dev. kit
hardware for unsigned code
• Code is then given signature which runs on
normal consoles
– http://msdn2.microsoft.com/en-us/library/ms537361.aspx
a university for the
real world
R
CRICOS No. 000213J
Some Commercial Games Engines
• Gamebryo – classed as a middleware game engine
solution
– http://www.emergent.net/index.php/homepage/products-andservices/gamebryo
• Unreal – full engine with tools and scripting interface for
game development
– http://www.unrealtechnology.com/html/technology/ue30.shtml
• Half Life 2 Source Engine – C++ engine with toolset
– http://www.valvesoftware.com/
a university for the
real world
R
CRICOS No. 000213J
Some Free Game Engines
• XNA Game Studio Express – free proprietary
game engine and development environment
– http://creators.xna.com/
• Irrlicht – free open source game engine
– http://irrlicht.sourceforge.net
a university for the
real world
R
CRICOS No. 000213J
Guest Lecturer
• Lachlan Bland – Engine Programmer
• THQ Studios
a university for the
real world
R
CRICOS No. 000213J
References
• Eberly, David H., 3D Game Engine Architecture:
Engineering Real-Time Applications with Wild
Magic, 2004 – Available online at QUT Library
• Eberly, David H., Title3D game engine design : a
practical approach to real-time computer
graphics, Morgan Kaufmann, 2001
a university for the
real world
R
CRICOS No. 000213J