cse 381 – advanced game programming code setup
TRANSCRIPT
![Page 1: CSE 381 – Advanced Game Programming Code Setup](https://reader035.vdocuments.mx/reader035/viewer/2022062314/56649ef25503460f94c04116/html5/thumbnails/1.jpg)
CSE 381 – Advanced Game ProgrammingCode Setup
![Page 2: CSE 381 – Advanced Game Programming Code Setup](https://reader035.vdocuments.mx/reader035/viewer/2022062314/56649ef25503460f94c04116/html5/thumbnails/2.jpg)
![Page 3: CSE 381 – Advanced Game Programming Code Setup](https://reader035.vdocuments.mx/reader035/viewer/2022062314/56649ef25503460f94c04116/html5/thumbnails/3.jpg)
![Page 4: CSE 381 – Advanced Game Programming Code Setup](https://reader035.vdocuments.mx/reader035/viewer/2022062314/56649ef25503460f94c04116/html5/thumbnails/4.jpg)
![Page 5: CSE 381 – Advanced Game Programming Code Setup](https://reader035.vdocuments.mx/reader035/viewer/2022062314/56649ef25503460f94c04116/html5/thumbnails/5.jpg)
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](https://reader035.vdocuments.mx/reader035/viewer/2022062314/56649ef25503460f94c04116/html5/thumbnails/6.jpg)
![Page 7: CSE 381 – Advanced Game Programming Code Setup](https://reader035.vdocuments.mx/reader035/viewer/2022062314/56649ef25503460f94c04116/html5/thumbnails/7.jpg)
Game Programmers 30 Years Ago
• Used to do everything• design• art• code
![Page 8: CSE 381 – Advanced Game Programming Code Setup](https://reader035.vdocuments.mx/reader035/viewer/2022062314/56649ef25503460f94c04116/html5/thumbnails/8.jpg)
Today’s Game Programmer
• Typically Specialized• Character movements programmer
• Network communications programmer
• Web programmer …
![Page 9: CSE 381 – Advanced Game Programming Code Setup](https://reader035.vdocuments.mx/reader035/viewer/2022062314/56649ef25503460f94c04116/html5/thumbnails/9.jpg)
Why is that important?
![Page 10: CSE 381 – Advanced Game Programming Code Setup](https://reader035.vdocuments.mx/reader035/viewer/2022062314/56649ef25503460f94c04116/html5/thumbnails/10.jpg)
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](https://reader035.vdocuments.mx/reader035/viewer/2022062314/56649ef25503460f94c04116/html5/thumbnails/11.jpg)
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](https://reader035.vdocuments.mx/reader035/viewer/2022062314/56649ef25503460f94c04116/html5/thumbnails/12.jpg)
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](https://reader035.vdocuments.mx/reader035/viewer/2022062314/56649ef25503460f94c04116/html5/thumbnails/13.jpg)
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](https://reader035.vdocuments.mx/reader035/viewer/2022062314/56649ef25503460f94c04116/html5/thumbnails/14.jpg)
Unity Scene Editor
![Page 15: CSE 381 – Advanced Game Programming Code Setup](https://reader035.vdocuments.mx/reader035/viewer/2022062314/56649ef25503460f94c04116/html5/thumbnails/15.jpg)
Lots of them Out There
![Page 16: CSE 381 – Advanced Game Programming Code Setup](https://reader035.vdocuments.mx/reader035/viewer/2022062314/56649ef25503460f94c04116/html5/thumbnails/16.jpg)
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](https://reader035.vdocuments.mx/reader035/viewer/2022062314/56649ef25503460f94c04116/html5/thumbnails/17.jpg)
Why Blender3D?
• It can make great content
• It's widely used
• It's free
![Page 18: CSE 381 – Advanced Game Programming Code Setup](https://reader035.vdocuments.mx/reader035/viewer/2022062314/56649ef25503460f94c04116/html5/thumbnails/18.jpg)
Download & Install
• http://www.blender.org/download/get-blender
• Latest version 2.68a
![Page 19: CSE 381 – Advanced Game Programming Code Setup](https://reader035.vdocuments.mx/reader035/viewer/2022062314/56649ef25503460f94c04116/html5/thumbnails/19.jpg)
Blender 3D: Noob to Pro
• http://en.wikibooks.org/wiki/Blender_3D:_Noob_to_Pro
![Page 20: CSE 381 – Advanced Game Programming Code Setup](https://reader035.vdocuments.mx/reader035/viewer/2022062314/56649ef25503460f94c04116/html5/thumbnails/20.jpg)
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](https://reader035.vdocuments.mx/reader035/viewer/2022062314/56649ef25503460f94c04116/html5/thumbnails/21.jpg)
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](https://reader035.vdocuments.mx/reader035/viewer/2022062314/56649ef25503460f94c04116/html5/thumbnails/22.jpg)
Model Data
• Vertices
• Edges
• Faces
• Surface Normals
![Page 23: CSE 381 – Advanced Game Programming Code Setup](https://reader035.vdocuments.mx/reader035/viewer/2022062314/56649ef25503460f94c04116/html5/thumbnails/23.jpg)
Steps in the Modeling Process
• Object modeling
• Shading
• Lighting
• Rigging
• Posing
![Page 24: CSE 381 – Advanced Game Programming Code Setup](https://reader035.vdocuments.mx/reader035/viewer/2022062314/56649ef25503460f94c04116/html5/thumbnails/24.jpg)
Shading includes Texturing
• Wrapping 3D geometry in images
• Atlas and Model
![Page 25: CSE 381 – Advanced Game Programming Code Setup](https://reader035.vdocuments.mx/reader035/viewer/2022062314/56649ef25503460f94c04116/html5/thumbnails/25.jpg)
Polygon Mesh Creation Example
![Page 26: CSE 381 – Advanced Game Programming Code Setup](https://reader035.vdocuments.mx/reader035/viewer/2022062314/56649ef25503460f94c04116/html5/thumbnails/26.jpg)
Polygon Mesh Creation Example
![Page 27: CSE 381 – Advanced Game Programming Code Setup](https://reader035.vdocuments.mx/reader035/viewer/2022062314/56649ef25503460f94c04116/html5/thumbnails/27.jpg)
Polygon Mesh Creation Example
![Page 28: CSE 381 – Advanced Game Programming Code Setup](https://reader035.vdocuments.mx/reader035/viewer/2022062314/56649ef25503460f94c04116/html5/thumbnails/28.jpg)
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](https://reader035.vdocuments.mx/reader035/viewer/2022062314/56649ef25503460f94c04116/html5/thumbnails/29.jpg)
Blender3D Axes
• X, Y, Z– Cartesian Coordinates– Are negative coordinates ok?
• Right-handed System, Huh?
![Page 30: CSE 381 – Advanced Game Programming Code Setup](https://reader035.vdocuments.mx/reader035/viewer/2022062314/56649ef25503460f94c04116/html5/thumbnails/30.jpg)
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](https://reader035.vdocuments.mx/reader035/viewer/2022062314/56649ef25503460f94c04116/html5/thumbnails/31.jpg)
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](https://reader035.vdocuments.mx/reader035/viewer/2022062314/56649ef25503460f94c04116/html5/thumbnails/32.jpg)
Translation, Rotation, & Scaling
![Page 33: CSE 381 – Advanced Game Programming Code Setup](https://reader035.vdocuments.mx/reader035/viewer/2022062314/56649ef25503460f94c04116/html5/thumbnails/33.jpg)
Multiple Transformations
• They can be combined on an object
• Order of processing matters
![Page 34: CSE 381 – Advanced Game Programming Code Setup](https://reader035.vdocuments.mx/reader035/viewer/2022062314/56649ef25503460f94c04116/html5/thumbnails/34.jpg)
Projections
• Our 3D worlds are projected onto 2D screens
– Orthographic vs. Perspective projection
Orthographic
Perspective
![Page 35: CSE 381 – Advanced Game Programming Code Setup](https://reader035.vdocuments.mx/reader035/viewer/2022062314/56649ef25503460f94c04116/html5/thumbnails/35.jpg)
Orthographic views can be useful. Why?
![Page 36: CSE 381 – Advanced Game Programming Code Setup](https://reader035.vdocuments.mx/reader035/viewer/2022062314/56649ef25503460f94c04116/html5/thumbnails/36.jpg)
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](https://reader035.vdocuments.mx/reader035/viewer/2022062314/56649ef25503460f94c04116/html5/thumbnails/37.jpg)
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](https://reader035.vdocuments.mx/reader035/viewer/2022062314/56649ef25503460f94c04116/html5/thumbnails/38.jpg)
The Projection Plane
• Depends on camera position and orientation
![Page 39: CSE 381 – Advanced Game Programming Code Setup](https://reader035.vdocuments.mx/reader035/viewer/2022062314/56649ef25503460f94c04116/html5/thumbnails/39.jpg)
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