39
CSE 381 – Advanced Game Programming Code Setup

CSE 381 – Advanced Game Programming Code Setup

Embed Size (px)

Citation preview

Page 1: CSE 381 – Advanced Game Programming Code Setup

CSE 381 – Advanced Game ProgrammingCode Setup

Page 2: CSE 381 – Advanced Game Programming Code Setup
Page 3: CSE 381 – Advanced Game Programming Code Setup
Page 4: CSE 381 – Advanced Game Programming Code Setup
Page 5: CSE 381 – Advanced Game Programming Code Setup

Fix the Working Directory

[ERROR] Failed to initialize the resource cache! Are your paths set up correctly?Function: GameCodeApp::InitInstance\psf\home\desktop\gamecode4\source\gcc\gamecode4\gamecode.cppLine: 178

Solution: Right-click on the TeapotWars project and go to properties. Then go to the Debugging section and enter in ..\..\..\Game as the Working Directory.

Page 6: CSE 381 – Advanced Game Programming Code Setup
Page 7: CSE 381 – Advanced Game Programming Code Setup

Game Programmers 30 Years Ago

• Used to do everything• design• art• code

Page 8: CSE 381 – Advanced Game Programming Code Setup

Today’s Game Programmer

• Typically Specialized• Character movements programmer

• Network communications programmer

• Web programmer …

Page 9: CSE 381 – Advanced Game Programming Code Setup

Why is that important?

Page 10: CSE 381 – Advanced Game Programming Code Setup

Oh by the way

Version Control is not just for Code

Assets too

Don’t lose a model an artist spent weeks on

Page 11: CSE 381 – Advanced Game Programming Code Setup

Paraphrasing Richard Garriott (a.k.a Lord British)

The game industry is a lot like the movie industryBUTAt the beginning of every game project we start by inventing new cameras, film, and processing techniques, and projectors.

Page 12: CSE 381 – Advanced Game Programming Code Setup

SDKs Pros & Cons

• Pros:• Speed Up Development• Flexible• Well Tested (hopefully)• Can be powerful

• But, might::• Be inflexible for your purposes• Have difficult to find bugs• Have big differences between versions

Page 13: CSE 381 – Advanced Game Programming Code Setup

Game Engine SDKs with Tools• For Building game

• merging & optimizing assets

• organizing content

• Adding triggers, dynamic object generators, bots, etc.

• Level geometry/terrain likely built elsewhere• i.e. Maya

Page 14: CSE 381 – Advanced Game Programming Code Setup

Unity Scene Editor

Page 15: CSE 381 – Advanced Game Programming Code Setup

Lots of them Out There

Page 16: CSE 381 – Advanced Game Programming Code Setup

For Next Wednesday

• Read Chapters 2-5 (that’s 125 pages or so)

• Download & Install Blender3D• do Noob to Pro Tutorial Units 1-2B

• http://en.wikibooks.org/wiki/Blender_3D:_Noob_to_Pro

• I’ll check next Wed. to make sure everyone completed the Simple Person with a Hat

Page 17: CSE 381 – Advanced Game Programming Code Setup

Why Blender3D?

• It can make great content

• It's widely used

• It's free

Page 18: CSE 381 – Advanced Game Programming Code Setup

Download & Install

• http://www.blender.org/download/get-blender

• Latest version 2.68a

Page 19: CSE 381 – Advanced Game Programming Code Setup

Blender 3D: Noob to Pro

• http://en.wikibooks.org/wiki/Blender_3D:_Noob_to_Pro

Page 20: CSE 381 – Advanced Game Programming Code Setup

What can blender do?

• Create 3D content• Create 3D worlds• Produce realistic, beautiful, fantastic 2D projected

renderings of 3D content/worlds

Page 21: CSE 381 – Advanced Game Programming Code Setup

First, some formal definitions

• What's a 3D model?– an abstract version of an object

– renderable

– data (vertices, edges, textures, etc.)

• What's modeling?– Process of making 3D models

Page 22: CSE 381 – Advanced Game Programming Code Setup

Model Data

• Vertices

• Edges

• Faces

• Surface Normals

Page 23: CSE 381 – Advanced Game Programming Code Setup

Steps in the Modeling Process

• Object modeling

• Shading

• Lighting

• Rigging

• Posing

Page 24: CSE 381 – Advanced Game Programming Code Setup

Shading includes Texturing

• Wrapping 3D geometry in images

• Atlas and Model

Page 25: CSE 381 – Advanced Game Programming Code Setup

Polygon Mesh Creation Example

Page 26: CSE 381 – Advanced Game Programming Code Setup

Polygon Mesh Creation Example

Page 27: CSE 381 – Advanced Game Programming Code Setup

Polygon Mesh Creation Example

Page 28: CSE 381 – Advanced Game Programming Code Setup

3D World Construction & Rendering

• Based on Geometry• Imagine a model of this room• Everything needs a position in 3D space

– think 3D coordinates (x, y, z)– Where's the origin (0,0,0) of our room?

Page 29: CSE 381 – Advanced Game Programming Code Setup

Blender3D Axes

• X, Y, Z– Cartesian Coordinates– Are negative coordinates ok?

• Right-handed System, Huh?

Page 30: CSE 381 – Advanced Game Programming Code Setup

Axes of Rotation

• We'll want to rotate stuff

• How do we denote a rotation?

• We need 2 things:

– Axis of rotation– Angle around axis

• Right-grip rule

Page 31: CSE 381 – Advanced Game Programming Code Setup

Coordinate Transformations

• Changes an object's coordinate values in some way

– Moving an object (translation)– Rotating an object (rotation)– Enlarging or shrinking an object (scaling)

Page 32: CSE 381 – Advanced Game Programming Code Setup

Translation, Rotation, & Scaling

Page 33: CSE 381 – Advanced Game Programming Code Setup

Multiple Transformations

• They can be combined on an object

• Order of processing matters

Page 34: CSE 381 – Advanced Game Programming Code Setup

Projections

• Our 3D worlds are projected onto 2D screens

– Orthographic vs. Perspective projection

Orthographic

Perspective

Page 35: CSE 381 – Advanced Game Programming Code Setup

Orthographic views can be useful. Why?

Page 36: CSE 381 – Advanced Game Programming Code Setup

Perspective Projection uses Foreshortening

• What's that?

– nearby objects rendered larger than faraway objects– gives the illusion of depth and distance

Page 37: CSE 381 – Advanced Game Programming Code Setup

What's a vanishing point?

• Imagine looking down a set of train tracks• They appear to converge at a point on the horizon• This is the vanishing point

Page 38: CSE 381 – Advanced Game Programming Code Setup

The Projection Plane

• Depends on camera position and orientation

Page 39: CSE 381 – Advanced Game Programming Code Setup

Blender Coordinates

• Global Coordinate System

– each scene has its own– fixed origin & orientation– virtual camera may be moved about

• Local Coordinate System– each object has its own