ITB/ITN751 Games Production Lecture 5 Game Engine Programming Ross Brown
Lecture Contents Game Engine Programming Guest Lecture – Lachlan Bland, THQ
Readings Textbook Chapters: Websites: Chapter 7 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
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
Havok Euphoria Engine Software http://www.youtube.com/watch?v=3bKphYfUk-M
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
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
Game Engine Overview Game Engine Audio AI Physics Game Content Scene Graphics Scene Graph User Interface
Game Engines Developed to abstract away underlying aspects of a game Enables reuse of code Facilitates porting code to other hardware platforms
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
Graphics Sprites Sprites Surface Materials Shadows Bloom Bump Mapping
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
Sumotori Dreams Simple physics demo Fits into 96k Illustrates: 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
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
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.
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
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
Artificial Intelligence Neural Network Seek and Flee Behaviour Finite State Automata Flocking
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
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)
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
Game Loop While user input not exit Endwhile 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
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
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
Roles Engine Development Engine Research and Development Cross Platform Development Bug fixing with Quality Assurance (QA)
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
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
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
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
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
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
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
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
Some Commercial Games Engines Gamebryo – classed as a middleware game engine solution http://www.emergent.net/index.php/homepage/products-and-services/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/
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
Guest Lecturer Lachlan Bland – Engine Programmer THQ Studios
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