What math should all game programmers know?

There are many other forms of math that are useful, but at the absolute minimum you need to know these:
  • Algebra and Arithmetic
These are pretty basic, but if you don't know these you won't have a chance at even being a programmer let alone a game developer.
Objects in a game world are represented with vectors. A vector represents things like an object's position, look direction and speed. Vector math calculations such as the Dot Product, Cross Product, Vector normalisation are essential.
How do I move my game object? The novice might say:
"I know! I'll just do:" object.position.x++.
No no no. You need to use a vector calculation. The object needs a position, direction and acceleration vector which you can use to move the object. If you do the novice thing, you'll get stuck in an unmaintainable mess, and how do you make it move in a direction not aligned with the world's XYZ axis?
  • Quaternions
Main reason games use quaternions is because they represent rotations almost as space-efficiently as Euler angles, without suffering from Gimbal lock. Gimbal Lock begins when any Euler angle reaches a rotation of 90 degrees around any axis: you immediately lose a degree of freedom. Quaternions address this issue by adding a fourth dimension. If you stuck with Euler angles, you'd have to restrict one axis to never rotating more than ~89 degrees.
  • Physics
If you are going to be programming the math for physics responses in a game, then taking a physics class wouldn't have been a bad idea.
Reasons will you need to know physics equations:
  1. Making a ball bounce (see: co-efficient of restitution)
  2. Make a ball move in a direction with 'x' newtons of force
  3. Make something have more or less friction so it will slide at a different speed
  4. Collision responses: What direction will the object rotate when I hit it 'here'?
If you use a physics engine (or a game engine which has the physics engine inbuilt) then you can get away with knowing very little about physics. Still, it's quite good to know when you need to get your hands dirty because the physics engine isn't performing properly.

0 comments:

Post a Comment

Don't Forget to comment

About Me

My photo

HI i am mohammed  a Embedded Software Developer ,SEO specialist,Electronic engineer   Read more

ads