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.
- Vector Math
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, and Vector normalisation are essential.
How do I move my game object? The novice might say:
“I know! I’ll just do:”
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?
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.
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 why you will need to know physics equations:
- Making a ball bounce (see: co-efficient of restitution)
- Make a ball move in a direction with ‘x’ newtons of force
- Make something have more or less friction so it will slide at a different speed
- 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.
I dream of the day when game development is as data driven as art production. I don’t see it anywhere on the horizon so for now knowing some math appears to be a necessity.
Math is like technique, the more the better, as long as you can apply it.
Here is the order of importance I see.
- Linear Algebra (with geometric interpretations)
- Calculus (physics)
- Combinatorics (randomized levels)
- Probability (balancing)
- Statistics (Bayesian esp. for AI)
I could keep going. The more you know the better, but learning a bunch of math doesn’t mean you will make a great game, but it can help.
A very basic one is the Pythagorean theorem. Also known as the distance formula.
b are the edges of a right triangle and
c is the hypotenuse. This means that in order to find the length of a vector, you do this:
Another note of interest is that if you’re just comparing distances, you don’t have to take the square root (which can be relatively costly). That’s why most frameworks have a “distance squared” or “length squared” function for their vectors.