mathematics in computer games nicolas redfern. maths in games there are many uses for maths in...
TRANSCRIPT
![Page 1: Mathematics in Computer Games Nicolas Redfern. Maths in Games There are many uses for maths in games: Object interaction/collisions Gravity and other](https://reader035.vdocuments.net/reader035/viewer/2022062518/56649edc5503460f94bed7c8/html5/thumbnails/1.jpg)
Mathematics in Computer GamesNicolas Redfern
![Page 2: Mathematics in Computer Games Nicolas Redfern. Maths in Games There are many uses for maths in games: Object interaction/collisions Gravity and other](https://reader035.vdocuments.net/reader035/viewer/2022062518/56649edc5503460f94bed7c8/html5/thumbnails/2.jpg)
Maths in GamesThere are many uses for maths in games:•Object interaction/collisions•Gravity and other forces•Breakable objects•Realistic vehicle movement•Realistic positional sound•Particle systems•Lighting
![Page 3: Mathematics in Computer Games Nicolas Redfern. Maths in Games There are many uses for maths in games: Object interaction/collisions Gravity and other](https://reader035.vdocuments.net/reader035/viewer/2022062518/56649edc5503460f94bed7c8/html5/thumbnails/3.jpg)
Object Interaction/Collisions Through use of mechanics, it is possible to
allow objects in a game to collide realistically with each other.
Collisions are calculated using the following formula: v2-v1=-e(u2-u1)
u2 and u1 are the velocities before collision, and v2 and v1 are the velocities after collision.
e is the coefficient of restitution. In a game this would be set by the developers.
![Page 4: Mathematics in Computer Games Nicolas Redfern. Maths in Games There are many uses for maths in games: Object interaction/collisions Gravity and other](https://reader035.vdocuments.net/reader035/viewer/2022062518/56649edc5503460f94bed7c8/html5/thumbnails/4.jpg)
![Page 5: Mathematics in Computer Games Nicolas Redfern. Maths in Games There are many uses for maths in games: Object interaction/collisions Gravity and other](https://reader035.vdocuments.net/reader035/viewer/2022062518/56649edc5503460f94bed7c8/html5/thumbnails/5.jpg)
Gravity
•Gravity is simulated in games to ensure that objects fall realistically.
•On earth, the acceleration due to gravity is 9.8 m/s2.
![Page 6: Mathematics in Computer Games Nicolas Redfern. Maths in Games There are many uses for maths in games: Object interaction/collisions Gravity and other](https://reader035.vdocuments.net/reader035/viewer/2022062518/56649edc5503460f94bed7c8/html5/thumbnails/6.jpg)
![Page 7: Mathematics in Computer Games Nicolas Redfern. Maths in Games There are many uses for maths in games: Object interaction/collisions Gravity and other](https://reader035.vdocuments.net/reader035/viewer/2022062518/56649edc5503460f94bed7c8/html5/thumbnails/7.jpg)
Calculating the Height of the Tower•The items all took 2 seconds to fall (t)•Acceleration (a) (due to gravity) is 9.8
m/s2
•The initial velocity was 0 m/s2 (u)•Distance travelled is worked out using:
s=ut+½at2
•s=0+9.8 (2)2/2•s=19.6 m
s=?s=?u=0u=0v=v=a=9.8a=9.8t=2t=2
![Page 8: Mathematics in Computer Games Nicolas Redfern. Maths in Games There are many uses for maths in games: Object interaction/collisions Gravity and other](https://reader035.vdocuments.net/reader035/viewer/2022062518/56649edc5503460f94bed7c8/html5/thumbnails/8.jpg)
Momentum in Portal
•Portal is an action/puzzle game, that makes use of momentum in its puzzles.
![Page 9: Mathematics in Computer Games Nicolas Redfern. Maths in Games There are many uses for maths in games: Object interaction/collisions Gravity and other](https://reader035.vdocuments.net/reader035/viewer/2022062518/56649edc5503460f94bed7c8/html5/thumbnails/9.jpg)
![Page 10: Mathematics in Computer Games Nicolas Redfern. Maths in Games There are many uses for maths in games: Object interaction/collisions Gravity and other](https://reader035.vdocuments.net/reader035/viewer/2022062518/56649edc5503460f94bed7c8/html5/thumbnails/10.jpg)
Lighting• Lighting is of immense importance to games.
A game can be much more immersive, if the lighting is realistic.
• Often, dynamic lights are used, for moving light sources.
+ =
colour luminance(colour)*colour
![Page 11: Mathematics in Computer Games Nicolas Redfern. Maths in Games There are many uses for maths in games: Object interaction/collisions Gravity and other](https://reader035.vdocuments.net/reader035/viewer/2022062518/56649edc5503460f94bed7c8/html5/thumbnails/11.jpg)
![Page 12: Mathematics in Computer Games Nicolas Redfern. Maths in Games There are many uses for maths in games: Object interaction/collisions Gravity and other](https://reader035.vdocuments.net/reader035/viewer/2022062518/56649edc5503460f94bed7c8/html5/thumbnails/12.jpg)
Illustrative Lighting in Team Fortress 2Team Fortress 2 uses a cartoon-like look to
achieve a unique visual style and comedic effect.
It uses complex equations to produce lighting effects.
![Page 13: Mathematics in Computer Games Nicolas Redfern. Maths in Games There are many uses for maths in games: Object interaction/collisions Gravity and other](https://reader035.vdocuments.net/reader035/viewer/2022062518/56649edc5503460f94bed7c8/html5/thumbnails/13.jpg)
Character Lighting Equation• This is the equation that determines the
lighting for characters in Team Fortress 2:
•Spatially-varying directional ambient
•Modified Lambertian terms•Unclamped Lambertian term•Scale, bias and exponent•Warping function
•Albedo
Li id
lnwcnak 1 ))ˆˆ(()ˆ( )ˆ()ˆˆ()ˆˆ(,)ˆˆ(max1
vakfunrvkfrvfkc rr
L
i
kirr
kissi
rimspec
))ˆˆ(((1
L
i ii lnwc
)))ˆˆ((( ln
)ˆˆ( iln
)ˆ(na
)))ˆˆ((( lnw
dk
![Page 14: Mathematics in Computer Games Nicolas Redfern. Maths in Games There are many uses for maths in games: Object interaction/collisions Gravity and other](https://reader035.vdocuments.net/reader035/viewer/2022062518/56649edc5503460f94bed7c8/html5/thumbnails/14.jpg)
![Page 15: Mathematics in Computer Games Nicolas Redfern. Maths in Games There are many uses for maths in games: Object interaction/collisions Gravity and other](https://reader035.vdocuments.net/reader035/viewer/2022062518/56649edc5503460f94bed7c8/html5/thumbnails/15.jpg)
Realistic positional sound
• Many games use positional sound: this is where sound varies depending upon where it is coming from.
• Another way in which sound is made more realistic is varying it upon the surrounding, environment.
• The Doppler effect can also be simulated in game: as an object moves towards you, the sound becomes lower in pitch, and continues to do so as it moves away.
• In Day Of Defeat: Source, another effect is applied: sounds far from the player lack higher frequencies and thus sound more like they naturally would, for example, abrupt pops for gunshots.
![Page 16: Mathematics in Computer Games Nicolas Redfern. Maths in Games There are many uses for maths in games: Object interaction/collisions Gravity and other](https://reader035.vdocuments.net/reader035/viewer/2022062518/56649edc5503460f94bed7c8/html5/thumbnails/16.jpg)
![Page 17: Mathematics in Computer Games Nicolas Redfern. Maths in Games There are many uses for maths in games: Object interaction/collisions Gravity and other](https://reader035.vdocuments.net/reader035/viewer/2022062518/56649edc5503460f94bed7c8/html5/thumbnails/17.jpg)
Breakable objects
• Having objects that can be broken up, adds another level of realism to a game.
• Usually, only certain objects can be broken, such as crates and fragile items.
![Page 18: Mathematics in Computer Games Nicolas Redfern. Maths in Games There are many uses for maths in games: Object interaction/collisions Gravity and other](https://reader035.vdocuments.net/reader035/viewer/2022062518/56649edc5503460f94bed7c8/html5/thumbnails/18.jpg)
![Page 19: Mathematics in Computer Games Nicolas Redfern. Maths in Games There are many uses for maths in games: Object interaction/collisions Gravity and other](https://reader035.vdocuments.net/reader035/viewer/2022062518/56649edc5503460f94bed7c8/html5/thumbnails/19.jpg)
Bibliography
•Jason Mitchell, Moby Francke and Dhabih Eng, "Illustrative Rendering in Team Fortress 2," International Symposium on Non-Photorealistic Animation and Rendering, 2007
•Games:▫Half-Life 2, Day Of Defeat: Source, Portal
and Team Fortress 2 (Valve)▫Garry’s Mod (Garry Newman)▫Crysis (Crytek)