Basic gameplay programming.
Part 2
Mouse Input
Mouse motion
To respond to mouse motion, we must listen for the
SDL_MOUSEMOTION event. We can then check the
new position of the mouse by using the event
3D Graphics
Part 1
Perspective
Perspective vs. Orthographic projection.
Orthographic projection matrix.
Building a perspective projection matrix.
Perspective vs. Orthographic projection.
55
75
95
Pers
Platformer game physics.
Platformer games overview.
Building a single screen platformer.
Building a single screen platformer.
Movement.
x_acceleration
+x_acceleration
All leftright movement for dyna
Shaders
Part 1.
The rendering pipeline.
MODELVIEW MATRIX
VIEWPORT MAPPING
PROJECTION MATRIX
FRAGMENT
SHADER
VERTEX SHADER
The Vertex Shader
A program that transforms the properties (such as position,
Advanced 2D collision detection.
Separating axis theorem (again).
Y
b
a
X
How far away are they on X?
Y
b
bw
a
p
aw
ax
if p >= 0, we are not
colliding!
bx
X
Y
b
bw
a
aw
ax
X axis is the separating axi
Shaders
Part 3
Screen shaders.
Anatomy of a screen shader.
Rendering to texture.
Frame Buffer Objects (FBOs)
Creating an FBO.
1. Generate and bind a frame buffer .
GLuint frameBuffer;
glGenFramebuffer
3D Graphics
Part 2
Billboards.
Billboards
=
Sprites that always face the camera.
Method #1  Rotate all billboards towards camera.
(Viewpoint oriented)
ANGLE TOWARDS CAMERA
CAMERA
Method #1  Rotate a
CS3113
Introduction to game programming
Hello!
Prof. Ivan Safrin
Surprise C+ quiz!
What are games?
What are computer games?
What is game programming?
What are common
game components?
What are common
g
3D / Windowing
Problems with using Euler angles for rotation.
Y
Z
X
Gimbal lock
Need to create 3 separate matrices
when creating the nal model matrix.
Euler angle rotations are order dependent and thu
Game AI.
Part 2
Pathnding
Navigating game maps.
Navigation nodes.
Graphs
NODES
B
D
A
F
C
E
EDGES
Finding the path between two graph nodes.
Breadth First Search algorithm.
class Node cfw_
public:
Node(
Game AI.
Part 1
https:/www.youtube.com/watch?v=GLKSuuOvnTw 1
Basic AI components.

Sensing
Pathnding
States
Sensing
Sensing the player.
Sensing the world.
Pathnding
Navigating the level.
States
Norma
Graphics foundations
Part 3.5
Nonuniform sprite sheets.
Uniform
Nonuniform
Need to keep a list
of coordinates for
nonuniform sprite
sheets.
class SheetSprite cfw_
public:
SheetSprite();
SheetSprite
Graphics Foundations
Part 3
Texture coordinates
0,1
1,1
Texture coordinates
are dened in 01
units called UV
coordinates, not
pixels!
T (V)
0,0
S (U)
1,0
0,1
1,1
0,0
1,0
GLfloat quadUVs[] = cfw_0.0, 0
Shaders
Part 2
Lighting using shaders.
2D Lighting
For each pixel, check its distance to each light
and increase its brightness based on that lights attenuation.
Light attenuation
Denes the decrease i
Graphics Foundations
Part 2
Colors in computer graphics.
How can color be represented?
The CMYK Model
The RGB Model
The HSV Model
The YUV Model
Luminance
Chrominance
Both
The RGB Model is most common
Effects and animation.
Part 2.
Particle systems.
Anatomy of a basic particle system.
A dripping faucet.
An emitter contains an array of particles, which have a
position, velocity and a lifetime. Their
Matrix transformations.
Part 2
Inverse of a matrix.
Inverse of a matrix.
=
A matrix that undoes the
matrixs transformation.
MATRIX MULTIPLICATION
MATRIX INVERSE
Inverse of a matrix.
 Scaled by 1/scal