the nitty gritty of game development

28
The Nitty Gritty of Game Development Life in and around the Game Industry

Upload: basisspace

Post on 26-May-2015

209 views

Category:

Technology


1 download

DESCRIPTION

A talk given to students at the University of Texas's Game Development program. General information about my experiences in the game industry (from ~10 years ago), as well as more recent work around the game industry.

TRANSCRIPT

Page 1: The nitty gritty of game development

The Nitty Gritty of Game Development

Life in and around the Game Industry

Page 2: The nitty gritty of game development

NVIDIA Corporation

Overview

“Quick” Bio

Anatomy of the Game Industry

Engine components

Life as a Game Developer

Getting there from here

Page 3: The nitty gritty of game development

NVIDIA Corporation

“Quick” Bio

2002-2003 Electronic ArtsCommand & Conquer Generals

Design Support / Audio / Optimization

2003-2005 TimeGate StudiosKohan Kings of War, Axis & Allies

Graphics / Audio / Optimization

Page 4: The nitty gritty of game development

NVIDIA Corporation

“Quick” Bio

2005-2009 NVIDIA Corporation - Architecture8800, 9800, gt 2xx

Performance Simulators

2009-Pres NVIDIA Corporation - Developer TechnologyWut

Page 5: The nitty gritty of game development

NVIDIA Corporation

Developer Technology

Game Optimization

Developer EducationGDC, Siggraph, etc

New feature integrationTessellation

3D Vision

ResearchRealtime Per-face Texture Mapping

PN-AEN triangles (crack-free PN triangles)

Page 6: The nitty gritty of game development

NVIDIA Corporation

Anatomy of the Game Industry

DevelopersMake Games

PublishersFinance Games

Advertise

First Party – Developers that are owned by a publisherBioware, id, Maxis, Ensemble (RIP)

Third Party – Independent development housesValve, Epic, Gearbox

Page 7: The nitty gritty of game development

NVIDIA Corporation

Developers from 10’

Large developers often split into two or more teams:Engine Team (usually one)

Game Team (usually one per title in simultaneous development)

Engine Team focuses on reusable components

Game Team focuses on everything needed for one game

Other aspects of Game DevelopmentArt – Models, Textures, Animation

Sound / Music

Design – Level design, Gameplay design, etc

Q/A – Make sure everything works!

Production – Everything else

Page 8: The nitty gritty of game development

NVIDIA Corporation

Art pipeline from 5’

Art is a complex pipeline with many piecesConcept art – 2D artwork that conveys mood and tone

Modeling – In a DCC such as 3DS Max or Maya

Unwrap – Often combined with Modeling these days

Sculpting – Creation of normal maps

Rigging – Assigning a skeleton to vertices for animation / attachments

Texturing – Material properties to be applied to a model

Animation – Everything relating to model motion

Page 9: The nitty gritty of game development

NVIDIA Corporation

Engine Components

Modern engines are as complex as some OSesFilesystem

GUIController input (Keyboard/Mouse/Gamepad)

Windowing system

Audio

Rendering

Threading / Fibers

AI

And have strong realtime requirements60 Hz is only 16.66… ms

Page 10: The nitty gritty of game development

NVIDIA Corporation

Filesystem?

Problem: fopen is verrrrrrry slow

Solution: WADs.Giant conglomeration of all files (at least of one type) needed by the game

fopen only called once

Header read from the file into memory

As other data is needed, just fseek into the wad and fread big chunks

But you don’t want everyone to have to know about the WAD

Generally use Fseek or engine::fseek, etc.

Page 11: The nitty gritty of game development

NVIDIA Corporation

GUI

Today’s games support complex, rich interaction with gamers

Some embed complete HTML renderers (!!)

Problems: Relying on the OS’s windowing system…Makes it harder to port

Subjects the developer to OS bugs

Solution: HomegrownOften built with Scaleform or similar technologies

But still require significant game development and time

One of the most important aspects for making a game feel “tight”

Page 12: The nitty gritty of game development

NVIDIA Corporation

Audio Engine

Scheduling, play and decode of audio effectsPlay and decode generally handled by the Miles Sound System

~10Ks of titles have used MSS

Scheduling, pre-caching and prioritization still handled by application, though

As well as placement and movement throughout the world

Generally 32 or 64 voices can be dealt with at onceApplication prioritizes based on volume, importance, distance, etc

Other samples are culled

Avoid clipping!

Page 13: The nitty gritty of game development

NVIDIA Corporation

Threading

Amdahl’s Law: A system can only be as fast as the sum of the length of the critical path.

By and large, games tend to be mostly single-threadedBut this subjects them heavily to Amdahl’s Law

Multithreaded programming is still hard

Most common thread divisionMain Thread – Message Pump management, simulation updates

Rendering Thread – Just issues D3D calls as fast as possible

Loading Thread – Loads assets from disk asyncronously

Main thread is still subject to Amdahl’s Law

Page 14: The nitty gritty of game development

NVIDIA Corporation

Why not thread the simulation?

For peer-to-peer topologies, this is very hardNeed absolutely deterministic behavior on all clients

To make this possible, would need to make agent updates commutative

Client-Server is no picnic, eitherStill subject to all of the usual multithreading issues

And client-server tends to have radically fewer agents

Page 15: The nitty gritty of game development

NVIDIA Corporation

Rendering

My personal favorite Typically split into two phases

View phase

Draw phase

View Phase makes broad determinations about visibilitySimulation updates view objects, which always exist

What is on screen? Near the screen? Far away?

Which chunks need to be resident in memory?

Which can be evicted from a cache and pushed back to disk?

Page 16: The nitty gritty of game development

NVIDIA Corporation

View Phase (cont’d)

Many types of visibility determinationChunking

View Frustum culling (Bounding volume testing)

Occlusion queries

Quad or Oct trees

Once an object is determined to be on or near screenIt is submitted to the rendering queue, which will actually draw it

If the data is not available to render, the view might ask to load itIt might block (causing a stall—yuck)

Or it might just say “load this asap, we’ll skip it this frame”

Avoiding stalls without breaking immersion is tricky

Page 17: The nitty gritty of game development

NVIDIA Corporation

Draw Phase

D3D9 is still the most common :,(Consoles control this

D3D11 is becoming more common

OpenGL is (unfortunately) the Linux of graphics APIsTechnically superior, but somewhat unloved

2008, THE YEAR OF OPEN/GL

2011, THE YEAR OF OPEN/GL

2015, THE YEAR OF OPEN/GL

Fear not!Which API you know is less important than understanding the graphics pipeline.

Page 18: The nitty gritty of game development

NVIDIA Corporation

Types of Renderers

Two main forms of real-time renderingForward rendering

Deferred rendering

In forward rendering, objects are shaded final colors, including all lights, as you go

If N is # objects and L is # lights, then naively this is O(N * L)

Can mean waste as you render an object, then render something over the top of it. D’oh!

Can be mitigated with a depth prepass

First, only lay down depth

Next, render objects, but use a depth test of == with no depth write

Page 19: The nitty gritty of game development

NVIDIA Corporation

Deferred Rendering

Deferred rendering is two-passFirst pass, lay down material properties

In theory, this is good, simple shaders

In practice, this is fairly bandwidth intensive, which directly translates to W

Second pass, apply lighting.

For N objects and L lights, deferred rendering is O(N + L)Better!

And no real need for a depth-only prepass

Page 20: The nitty gritty of game development

NVIDIA Corporation

AI

Broadly “what should NPCs do?”

Can often be a significant portion of the frame time

More convincing AI is often more expensive

But there are also “tricks” that can look convincing without actually being expensive

Page 21: The nitty gritty of game development

NVIDIA Corporation

Breakdown of a frame

In most games, Care and Feeding of the GPU is the most expensive CPU task

Talking to the APIs is unfortunately expensive

Better with D3D11 and OGL, but still an issue

AI / Pathfinding is generally the second most expensive chunk of time

Both suffer (fundamentally) from Amdahl’s Law:The GPU is a giant state machine, so it’s difficult to hold many conversations with it at once

AI needs to reason about the game world, and that is hard to do if the game world isn’t frozen in time (at least briefly)

Page 22: The nitty gritty of game development

NVIDIA Corporation

Life as a Game Developer

Page 23: The nitty gritty of game development

NVIDIA Corporation

Life as a Game Dev

Initially, very hardExpect long hours

And comparatively low pay

Many, many, many programmers want to be game developersLike all of you

Multiplied by every college in the country

Except University of Florida, because… Florida.

But the game industry isn’t that big

So supply and demand is working against labor

Page 24: The nitty gritty of game development

NVIDIA Corporation

Life as a Game Dev (cont’d)

Move Early, Move OftenMost areas have 0-2 game developers (heavily skewed towards 0)

This means as a developer, you will move geographically and frequently

The game industry has an abnormally high divorce rateApproaching 75%. Yikes.

Spouses often refer to themselves as widows with husbands/wives

You do not play games for a living.

Page 25: The nitty gritty of game development

NVIDIA Corporation

Crunch time

Crunch is ubiquitousEven Valve

Suckitude of crunch varies by employerMuch better at Valve, id, EA (modern EA)

Page 26: The nitty gritty of game development

NVIDIA Corporation

Still not dissuaded?

Ship titles. Shipped titles are freedom in the game industry

Figure out what’s important to you, and negotiate for that.

You will be a peon for your first game. I’m sorry! To be fair, you’ll be a peon for your first gig regardless

But Game Industry Peon << Any other industry Peon

There are upsidesEveryone you work with loves games as much as you do

You get to work on your hobby

You get immediate feedback about the cool shit you’ve done

You can point to something tangible, and say “I made that.”

You will be the hero of kids everywhere

Page 27: The nitty gritty of game development

NVIDIA Corporation

Getting there from here

So how do you get there?Good fundamentals. I cannot stress this enough.

Algorithm analysis, quick O estimations

Computer organization and assembler

Debugging

Be sociable / personable

Personal Projects / OSS

Page 28: The nitty gritty of game development

NVIDIA Corporation

Questions?