Game Engine Architecture

Slides:



Advertisements
Similar presentations
12 VECTORS AND THE GEOMETRY OF SPACE.
Advertisements

Math Review Guest Lecturer: Michiel van de Panne Week 1, Wed Jan 9
Chapter 4.1 Mathematical Concepts
Chapter 4.1 Mathematical Concepts. 2 Applied Trigonometry Trigonometric functions Defined using right triangle  x y h.
CS 4731: Computer Graphics Lecture 6: Points, Scalars and Vectors Emmanuel Agu.
CSCE 590E Spring 2007 Basic Math By Jijun Tang. Applied Trigonometry Trigonometric functions  Defined using right triangle  x y h.
Chapter 3 Vectors in Physics.
University of British Columbia CPSC 314 Computer Graphics Jan-Apr 2007 Tamara Munzner Math Review Week 1, Wed.
CS 376b Introduction to Computer Vision 03 / 04 / 2008 Instructor: Michael Eckmann.
Chapter 2: Vectors Ian Parberry University of North Texas Fletcher Dunn Valve Software 3D Math Primer for Graphics and Game Development.
Linear Algebra Review CSE169: Computer Animation Instructor: Steve Rotenberg UCSD, Winter 2005.
Matt Thrasher Upward Bound Academic Advisor North Hennepin Community College ACT MATH PREP.
The Cross Product Third Type of Multiplying Vectors.
Mathematical Fundamentals
Unit 1 – Physics Math Algebra, Geometry and Trig..
CGDD 4003 THE MATH LECTURE (BOILED DOWN, YET LIGHTLY SALTED)
MATH – High School Common Core Vs Kansas Standards.
CSCE 552 Fall 2012 Math By Jijun Tang. Applied Trigonometry Trigonometric functions  Defined using right triangle  x y h.
University of British Columbia CPSC 314 Computer Graphics Jan-Apr 2005 Tamara Munzner Math Review Week 1, Fri.
 What you should know: Basic Trig (SOHCAHTOA), Pythagorean Theorem, Compass directions, a little Physics (34/35 of you), angle properties (Geometry!).
Computer Graphics Mathematical Fundamentals Lecture 10 Taqdees A. Siddiqi
Linear Algebra Review Tuesday, September 7, 2010.
 Get a good night’s rest. Eat what you always eat for breakfast.  Use the test booklet for scratch paper. You can’t bring your own.  Remember your.
Vectors. Reviewing Vectors Vectors are defined as physical quantities that have both magnitude (numerical value associated with its size) and direction.
CA 302 Computer Graphics and Visual Programming
Vectors for Calculus-Based Physics
Vectors Some quantities can be described with only a number. These quantities have magnitude (amount) only and are referred to as scalar quantities. Scalar.
Lecture Outline Chapter 3 Physics, 4th Edition James S. Walker
Vectors AP Physics C.
General Physics 101 PHYS Dr. Zyad Ahmed Tawfik
Core mathematical underpinnings
Problem 1.5: For this problem, we need to figure out the length of the blue segment shown in the figure. This can be solved easily using similar triangles.
Chapter 1 Vectors.
Lecture Outline Chapter 3
Vectors Objective Students will be able to use basic vector operations to solve problems.
4.1 Vectors in Physics Objective: Students will know how to resolve 2-Dimensional Vectors from the Magnitude and Direction of a Vector into their Components/Parts.
Chapter 3–2: Vector Operations
Chapter 3.
Chapter 3 Vectors September 17, 2018 Chap 3.
Chapter 3.
Vectors for Calculus-Based Physics
Lecture 03: Linear Algebra
Vector Calculus – Part 1 By Dr. Samer Awad
The formula for calculating the area of a parallelogram
Joshua Barczak CMSC 435 UMBC
C H A P T E R 3 Vectors in 2-Space and 3-Space
Copyright © 2017, 2013, 2009 Pearson Education, Inc.
Vectors Vectors in one dimension Vectors in two dimensions
Unit 2: Algebraic Vectors
Copyright © Cengage Learning. All rights reserved.
Chapter 3 Vectors.
Vectors and the Geometry
Scalars vs Vectors Scalars – a quantity that only needs a magnitude (with a unit) to describe it Ex: time, distance, speed, mass, volume, temperature Vectors.
Vectors for Calculus-Based Physics
Notes: 8-1 Geometric Vectors
Lecture Outline Chapter 3 Physics, 4th Edition James S. Walker
Find sec 5π/4.
UMBC Graphics for Games
CSE 411 Computer Graphics Lecture #2 Mathematical Foundations
Kinematics Vectors and Motion
CSCE441: Computer Graphics 2D/3D Transformations
Lecture Outline Chapter 3 Physics, 4th Edition James S. Walker
Linear Algebra A gentle introduction
Week 2 Vectors in Physics.
Game Programming Algorithms and Techniques
Mathematics Vectors a b c LabRat Scientific © 2019.
Lecture Outline Chapter 3 Physics, 4th Edition James S. Walker
Notes: 8-1 Geometric Vectors
Solving Right Triangles
Presentation transcript:

Game Engine Architecture CS 134 Video Game Math Game Engine Architecture Chapter 4

Today in Video Games

Roll Call

Video Game Math While the game is running, guys are moving around. Where are they at any point in time? When you click, which tile got clicked on?

Video Game Math Algebra, Linear Alegbra , Geometry, and Trigonometry are the common maths of Video Games. And a smidge of basic Calculus... just a smidge! Let's do a review of the math needed when writing games.

Video Game Math

Video Game Math Algebra and Geometry Algebra – Solve for X: X² + 6 = 10 Geometry – Properties of Circles, Triangles Pythagorian Theorem Quadratic Formula Simple motion

Video Game Math How long would it take to move from Start to End? Assume speed of 30px / second.

Video Game Math How long would it take to move from Start to End? Assume speed of 30px / second. Needed info: Delta X = 4 tiles Delta Y = 2 tiles 1 tile = 16x16 pixels

Video Game Math Trigonometry Sin, Cos, Tan as the circle functions cos²(x) + sin²(x) = 1 atan2, one of the most useful functions.

Video Game Math What angle should the character be rotated to face the direction they are walking? Remember: Delta X = 4 tiles Delta Y = 2 tiles 1 tile = 16x16 pixels

Video Game Math Viewing these operations as doing Linear Algebra makes a lot of the operations easier. Linear Algebra according to MathWorld is: The study of linear systems of equations and their transformation properties. This is NOT the way game developers view Linear Algebra.

Video Game Math Viewing these operations as doing Linear Algebra makes a lot of the operations easier. Linear Algebra according to game devs is: The study of 2D and 3D positions and how they change in different views.

Video Game Math Video Game Linear Algebra: Instead of viewing the world as having X values and Y values, view the world as a collection of (X,Y) values. This is a POINT or a VECTOR. A transformation to another view of the world is represented as a collection of new values for the X, and Y axes. This is a MATRIX. Linear Algebra is the math you can do on POINTS, VECTORS, and MATRICES.

Video Game Math Many linear algebra operations have geometric meaning: Magnitude (length) Weighted average (a.k.a. barycentric coords) Dot product (Angle between vectors) To calculate magnitude, use the Pythagorean theorem Length(24,32) = sqrt(24 * 24 + 32 * 32) = sqrt(1600) = 40

Video Game Math To do a weighted average, do a bunch of scalar multiplies and adds that sum up to one 0.2 * (24, 32) + 0.8 * (0, 8) = (4.8, 6.4) + (0, 6.4) = (4.8, 12.8) To calculate dot product, multiply the X and Y parts together and add the result. Dot((24,32), (0,8)) = 24 * 0 + 32 * 8 = 256

Video Game Math Origin is upper left Points Position in world Vector Change in position

Video Game Math Weighted Average Has geometric meaning as long as weights add up to 1 Animating this is called Linear Interpolation or ”lerp”

Video Game Math The dot product v⋅w = Length(v) * Length(w) * cos θ If you look as the sign, you can see if two vectors are pointing in the same direction.

Video Game Math Let’s solve some real game problems: Choose ”direction” for animation to play. Determine visiblity in a stealth game. Animate characters moving.

Video Game Math Let’s solve some real game problems: Choose ”direction” for animation to play. Determine visiblity in a stealth game. Animate characters moving.

Video Game Math

Video Game Math

Video Game Math

Video Game Math What about Matrices and 3D? Matrices are generally not needed for 2D. They are extremely useful in 3D. Other useful 3D only things: Cross product (perpendicular) Determinant (volume) ”Left Hand” vs ”Right Hand” coordinate systems

Video Game Math And what about Calculus? We will cover calculus when we get to video game physics.

Video Game Math The math you will use is: Algebra and Geometry Trigonometry Linear Algebra One nice thing about Linear Algebra is everything you will do has geometric interpretations.

Game Engine Architecture Video Game Math Questions? Game Engine Architecture Chapter 4