+ All Categories
Home > Documents > Mathematics in Computer Games Nicolas Redfern. Maths in Games There are many uses for maths in...

Mathematics in Computer Games Nicolas Redfern. Maths in Games There are many uses for maths in...

Date post: 13-Jan-2016
Category:
Upload: john-bryant
View: 214 times
Download: 0 times
Share this document with a friend
Popular Tags:
19
Mathematics in Computer Games Nicolas Redfern
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.

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.

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.

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.
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.

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.
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.

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.

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.
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.

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.
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.

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.

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.
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.

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.
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.

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.
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.

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)


Recommended