Math...


#1

Why types of math will I need to know to program video games? and how is the math put to use?

Thanks.


#2

Most important is something called Linear Algebra. Basically, it’s about 2d and 3d geometry, transformations, projections, adding of vectors etc. It is used for manipulating geometry, projecting it to the screen. It is also used quite a lot for physics simulations.

And connected to that is also trigonometry (angles and such).

McWolfe


#3

How does it go into the code? The entire problem? Or just the solutions?


#4

I’m not quite sure I understand your question, but I’ll try to explain a bit more.

Let’s say you are writing a graphics engine from scratch and you want to use vectors, then perhaps you create a class that looks a bit like this

class vector {
double x,y,z;
// lot of constructors etc here
}

your next class is perhaps a triangle class

class triangle {
vector v1, v2;
vector normal;
}

in order to calculate your normal (which is essential for shading etc) you multiply the two vectors according to something called a cross product (I think it’s called that in english).

To know how you do that you have to know a little about linear algebra. The short story would be

normal.x = v1.yv2.z + v1.zv2.y;
normal.y = v1.zv2.x - v1.xv2.z;
normal.z = v1.xv2.y + v1.yv2.x;

(or something like that, I don’t remember exactly, maybe someone else can correct me).

And then there are a lot of other tricks and methods for manipulating the geometry according to your wishes.

McWolfe


#5

I have no clue what any of that math means but you did answer my question, thank you! :thumbsup: :slight_smile:


#6

If its just programming - Algebra and the base 2 system.

If it’s where you have characters moving around like in Doom - Vectors, Trigonometry, and Matrices.

If you going to aim for 3D - good luck! :smiley:


#7

Yeah, I’m aiming for 3D. What do you mean characters moving around? Characters move around in all… games?


#8

Minesweeper - No Characters Moving Around, installed with every copy of Windows.

There’s more to games than characters :wink:


#9

so i think the answer to the question is: pretty much everything at least until calculus. there is just an incredible amount of math you have to understand, not just knowing the equations but how it works (unit circle just one example), and you have to have really read into the subject so that you can avoid all the “bad” areas (like, im sure there are solutions to problems which would work using more basic math, but take up too much memory that way and so thus you ened some obscure but more elegant equation)
also a fairly deep knowledge of physics is going to be necessary for… physics calculations! and light. and pretty much any motion which isn’t controlled by some pre-made animation (like projectiles, bouncing off of walls, etc)


#10

I think I can answer the question in two ways.

First, what you need to know depends on what you want to do. But think of it like this. The more math you know, the more options are available to you. There is hardly any math that cannot be used in game programming. Contrary to what is said above, I can easily find uses for calculus in my work. A simple example is to make something move a desired distance in a desired amount of time, and to also move with smooth acceleration. If you know multivariable calculus and more advanced forms of math, you can do solid state physics simulations and other things.

The thing is that, if you want to innovate at all, you will have to solve problems. The more math you know, the more likely you can find an efficient and awesome way to solve the problem.

On the other hand, there is a lot you can do while only knowing basic algebra, like minesweeper, or super-nintendo type games.

So how much do you need to know? There is an entire range of possible answers. It depends on how much you really want to be able to do.

The other way to answer is that learning math before programming might be a bit backwards. Sure, math is independent of programming, so it is more efficient to learn math first. But it’s not as motivating. It seems to me that a person should understand a question before they search for the answer. Once you learn more programming, you will understand the “question”-- ie. how do you solve certain problems to achieve what you want. Then, it will be much more motivating to learn as much math as you can, in order to answer those questions you have in your head.

Also, when you are just learning, you can “fake it”. You don’t need to be an expert in linear algebra to do 3D. I made a 3D engine when I was 14, all I had to do was copy some equations off of a tutorial I got from a BBS. Here’s a tutorial you can find useful: http://freespace.virgin.net/hugo.elias/


#11

A good suggestion would be to make a maths class( as in a C++ class ). Its a great way to see how far you’ve come in Maths - but make sure you only add in stuff that you understand! Oh man, its just cheating otherwise… :smiley:


#12

this is good for me to read right now…this semester i have spent far more time on the math class than actually working in maya and i was beginning to feel…


#13

i agree, i have often used calculus, not just algebra.


#14

Believe it or not, there is a book called “Calculus made Easy”…author is Martin Gardener( Palgrave series ). :thumbsup:


#15

This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.