1 / 59

Evolution of Games

Mathematics in Videogames By: (alphabetical order ) Angela Ren Christine Lee Faizan Khalid Michelle Wong Minna Lee. Evolution of Games. Wolfenstein, one of the earliest FPS (first person shooter) games. Evolution of Games Cont. Doom, the next breakthrough in graphics.

dinesh
Download Presentation

Evolution of Games

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Mathematics in VideogamesBy:(alphabetical order )Angela RenChristine LeeFaizan Khalid Michelle Wong Minna Lee

  2. Evolution of Games Wolfenstein, one of the earliest FPS (first person shooter) games

  3. Evolution of Games Cont. Doom, the next breakthrough in graphics

  4. Evolution of Games Cont. Quake, this was a huge leap in the quality of graphics in computer games

  5. Evolution of Games Cont. Quake III, one of the newest FPS games around with more detailed images

  6. Numbers • Integers • Fixed point numbers • Floating point numbers • Discreteness Spatial discreteness Temporal discreteness

  7. Integers • Integers can be stored exactly in binary and have efficient methods for addition and subtraction, as well as slightly less efficient methods of multiplication and division. • When used in computers, integers have upper and lower limits. This limit is important when operating certain operations as overflow can occur. • Integers have been favored for storing variables used in video games because operations on them were much faster than on other types of numbers.

  8. Fixed Point Numbers • Efficient way of dividing an integer by a scale factor: when the scaling factor is a power of two the division can be easily performed by using binary shifts, when number is stored in this manner, it is called a fixed point number, the integer represents a number with both integer and fractional parts, separated by a binary point.

  9. Floating Point Numbers:Fixed Ranges • The main disadvantage of fixed point numbers is that they lack precision over a large range: they cannot hold very large or very small numbers. • Solution: floating point numbers • Two parts: 1. A signed exponent (the range shift) • 2. Signed mantissa (raw value) *turn a floating number into a fixed point number by shifting the mantissa by and number of bits specified in the exponent.

  10. Discreteness • Discreteness-values in computer games often have integer values. • Time is not continuous (split up into frames of 1/60th of a second) • Character positions are not continuous (they are displayed on pixel boundaries) *This can be very useful as an approximation to a smooth universe.*

  11. Spatial Discreteness:Aligning objects to grid boundaries • On nearly all video games, characters must be placed on integral pixel boundaries. • The use of fixed point (or floating point) numbers for game objects means the objects are held with greater precision than is shown on the screen.

  12. Temporal Discreteness:Game Frames • The concept of games frames is fundamental to traditional games programming. • Most games are based on the ticking of a clock which happens a fixed number of times per second. Every time this clock signal is processed, the game executes one cycle of thought. Operations that may have been taught to calculate all at once have to be done one step at a time.

  13. Temporal Discreteness:Game Frames • The game frame is not the same as the display frame. • The game is run in a separate “thread” from the display code, so it should be immune to the display code being bogged down by too many objects or a scene being too complex. • The shared variables that are written by the game code and read by the display code should be double buffered to prevent synchronization problems.

  14. Shading • Flat Shading • Gouraud Shading • Phong Shading • Quadratic Shading

  15. Flat Shading andGouraud Shading • Flat shading simply assigns a single color to a polygon. It is very simple and fast, but makes the object look very artificial. • Colors are assigned to each vertex, then they are blended across the face of the polygon. Since each vertex is typically associated with at least three distinct polygons, this makes the object look natural.

  16. For example…

  17. Phong Shading • Introduced by Phong, is the appropriate shading method to go with his illumination model. • Triangles are shaded by linearly interpolating the surface model the surface normal and re-revaluating the illumination equation at each pixel. • Phong shading is superior to other methods but it is computationally demanding and very expensive.

  18. Quadratic Shading • A quadratic can express the shading maximums and minimums that appear within a triangle’s interior. • Can approximate light distribution better than Gouraud shading. • Can be constrained to enforce continuity across triangle edges, but this increases computation because the quadratic has more degrees of freedom (6) so it needs more constraints.

  19. Geometry, Vectors and Transformations • In order to understand how FPS games work, geometry, vectors and transformations are required. • Geometry: is the study of shapes of various sort. • Vectors: mathematical way of representing a point. • Transformations: moves a point (or an object, or even an entire world) from one place to another.

  20. Geometry • Simple shapes: a point and a line ― a straight line. • Complex shapes: a plane ― a flat sheet, like a piece of paper or a wall and a solid ― a cube or a sphere. Simple geometric figures

  21. Vectors • A vector is 3 numbers: usually x, y, z for three different directions to get one point. • For example, when x=3, y=1, z=5 this point can be found by using the 3-Dimensional (x, y, z) coordinate plane. Picture of a vector and directions

  22. Transformation • Transformation, moving the object across a plane, is also called Translation • Another type of transformation is called Rotation Translations and rotations

  23. 3D Graphics • The basic idea of 3D graphics is to turn a mathematical description of a world into a picture of what that world would look like to someone inside the world. • The mathematical description could be in the form of a list, for instance: there is a box with center (2,4,7) and sides of length 3, the color of the box is a bluish grey. To turn this into a picture, we also need to describe where the person is and what direction they are looking, for instance: there is a person at (10,10,10) looking directly at the center of the box. From this we can construct what the world would look like to that person.

  24. 3d Graphics cont. • What I just described above is similar to what the computer is doing (50 times a second!) every time you run around shooting hideous monsters in Quake, although the details are slightly different. • In computer games (at the moment) the description of the world is just a list of triangles and colors. The newest computer games are using more complicated descriptions of the world, using curved surfaces, however in the end it always reduces to triangles. For instance, a box can be made using triangles as illustrated below:

  25. 3d Images

  26. Cartesian Coordinates • In 3-D games, we use x, y, and z axes to graph coordinates in a game. • X-coordinate is the horizontal value • Y-coordinate is the vertical value • Z-coordinate is the depth value

  27. Polar Coordinates • Polar coordinates are good for figuring out the velocities of objects in 2-D games (sports games, etc) • A person can be running in a particular direction and then change angle by a certain amount each game frame, while maintaining the same speed.

  28. Quaternions • Quaternions: noun: Any number of the form a + bi + cj + dk where a, b, c, and d are real numbers, ij = k, i2 = j2 = -1, and ij = -ji. • Quaternions are used to process rotations in three dimensions.

  29. Matrices • Matrices are used to change your point of view in the videogame. • Objects and characters in a game are positioned with coordinates: (x, y, z).

  30. To get your coordinates to transform, multiply by a matrix: • Rotate around x-axis: • Scale to size: • Translation:

  31. Vectors Vector Products: • Vector products determine an object’s seen surface and hidden surface. This is done by a process that uses both vector products. • Various lighting scenarios, ambient light, parallel light and point source light are used to give the game a touch of realism.

  32. We need to cover the set of points that define the object with a convex polygon mesh. By taking cross productsof two defined edge vectors, we generate a “normal” vector to the plane of the polygon Hidden Surfaces

  33. Hidden Surfaces • Because the normal will point out from the object’s surface, this allows us determine which section is visible and hidden to the object. • Another way to determine the hidden surfaces is when the dot product of the vector observer, V2, and the normal, n, is positive.

  34. Light • A brightness of a certain part of an object is dependent on the component of reflected light reaching the observer.

  35. Light cont. • N is a unit normal  R = 2(N•L )N – L • Component for reflected light  (O•R)O • O is a unit vector in the direction of the observer. • Scaling factors on the length of this vector is used to generate the desired effect.

  36. Inertia • Newton’s first law states that unless there is an obstacle or another force on an object’s path, it will move in a straight line (inertia) • In order to apply this knowledge, we need to make sure that we keep in track of the object’s velocity, and this should be added to the object’s position each game frame • We should change the velocity to handle various forces that act upon the object, not simply change the object's position.

  37. Gravity • Gravity is a force that pushes two things together • The force of gravity is defined by: • G is the universal gravitation constant, m1 is the mass of the first object and m2 is the mass of the second object, and r is the distance between them • The effect of gravity on earth’s surface is of constant acceleration at which point you can use F=mg, where m is the mass of an object and g is 9.8 N/m2

  38. Gravity cont. • So to make objects fall, add an acceleration constant to their y velocity every game frame. Then add the y velocity to the y position. • You can change the acceleration constant to change the feel of the game world. When the constant is low, the game has a lunar landscape feel, and the jumps seem to go in slow motion. But when the constant is high, the jump is way faster and the person seems to run faster as well.

  39. Bouncing • When an object in the game hits the background or another object, it is called a collision. There are two types of collision: inelastic and elastic (use of physics) • When an object hits a horizantal background, it bounces up. This is done by multiplying the y velocity vector by a negative number bween 0 to –1. • This number is related to the coefficient of the level of “bounciness” • The higher the number is, or the closer it is to 0, the less bouncy it is.

  40. Bouncing Cont. • Similar to the horizontal backgrounds discussed earlier, same rules apply for vertical backgrounds. • With vertical backgrounds, you do the same but instead you multiply by the x velocity vector. • Other backgrounds, excluding horizantal and vertical, includes the use of geometry • If an objects hits a diagonal, or any non vertical or non horizantal background, then you measure the angle. • But as the measure of the angle changes, the speed does as well.

  41. Friction In the real world, once you stop pushing things they generally slow down and stop.

  42. Friction • You can simulate friction by multiplying an object's velocity by a constant value between 0.0 and 1.0 each frame. • This value should be only slightly less than 1.0, since the lower it is the faster the object will slow down. • Experimenting with different values to see which numbers look right in your game

  43. Jumping • : User should be able to control how high their game character jumps by holding down a button. • : Game designer control gravity. • : THIS GOES AGAINST THE LAWS OF PHYSICS!!!!

  44. Newton's Differences:Simplifying the physics maths  • A object fired into the air under gravity will basically follow the path of a parabola (ax2 + bx + c ) • Take differences of the results of this function, and they form a more simple pattern.

  45. Figure five x x2 D x2 D D x2 D D D x2 0 0 1 1 1 3 2 0 Velocity Acceleration 2 4 5 2 0 3 9 7 2 0 4 16 9 2 0 5 25 11 2 6 36 Newton's Differences:Simplifying the physics maths  • Take differences of the results of this function. • Repeating that step yields a constant number. This is the acceleration of the object!

  46. Calculus: The proof behind the simplifications • These differences are in fact the special case of differentiation • Call distance X and time t • Velocity=dX/dt • Acceleration=dV/dt

  47. Figure five t t2 D t2 D D t2 D D D t2 0 0 1 1 1 3 2 0 Velocity Acceleration 2 4 5 2 0 3 9 7 2 0 4 16 9 2 0 5 25 11 2 6 36 Calculus: The proof behind the simplifications dX/dt = 2t dX/dt = 2 0 2 2 4 2 6 2 8 2 10 2

  48. Intelligent Motion • The deterministic algorithms for enemy movement used in most games: • Chase • Evade • Pattern • Response • Random choice.

  49. Intelligent Motion • Deterministic algorithms are simple AI techniques • Use a set of variables as the input and then use some simple rules to drive game objects based on these inputs.

  50. Perceived Smoothness: Removing jerkiness  For motion to be smooth, it should be continuous to the greatest extent. • Position - if this changes suddenly, the object appears to jump. • Velocity - sudden changes of velocity seem very line based. • Acceleration - changes of acceleration are not so noticeable in a game.

More Related