Advertisement

Where to learn 2D Math for game dev

Started by April 26, 2016 09:23 AM
11 comments, last by Serapth 8 years, 7 months ago

What kind of Math do I need to learn in order to make the games listed under.
And where can I learn this kind of math, are there any newbie sites, book etc, that isent very hard?

- Terraria
- Mario

- Diablo 1 and 2 Isometric
- Plant vs Zombie
- Zelda 2D RPG

//Thomas Wiborg

Just learn linear algebra and analytic gemetry (not sure if thats how you call it in english).

Both are really sumple, just take a bit time to master it. After you learn those things you will know what to learn next.

Additionally learn calculus :)

Advertisement

Basic graph theory and trigonometry, arithmetic. Khan Academy should have everything you want.

Do you have experience programming? If not, you'd probably be better off learning that first. This article outlines some good projects to start with, which you can tackle before trying some of the more advanced stuff you mentioned in your post.

Beginner. Whatever I said above could be completely wrong.

Basic graph theory and trigonometry, arithmetic. Khan Academy should have everything you want.

Do you have experience programming? If not, you'd probably be better off learning that first. This article outlines some good projects to start with, which you can tackle before trying some of the more advanced stuff you mentioned in your post.

Yep I can program. Thanks for the tips!

//Thomas Wiborg

There are a lot of books about the matter also. This book is the one I used in my college course: Fundamentals of Math and Physics for Game Programmers by Wendy Stahler.

Yes, I know you asked for 2D, but I'm going to add this in case you move to 3D for any reason.

There is also 3D Math Primer for Graphics and Game Development by Fletcher Dunn; again; in case you are interested in 3D.

There are other books as well, but I've not read any of them to be able to recommend any other book.

start with 2d Cartesian coordinate systems, 2d vectors, and basic trig.

some analytic geometry (beyond the basics listed above) may be of some use at some point.

then you can move on to 3d and linear algebra.

calculus - haven't found much use for it myself.

and i've taken just about every math class ever invented (all the way through differential equations).

and liner is not easy. and i got an A in linear. <g>.

Norm Barrows

Rockland Software Productions

"Building PC games since 1989"

rocklandsoftware.net

PLAY CAVEMAN NOW!

http://rocklandsoftware.net/beta.php

Advertisement

calculus - haven't found much use for it myself.

Calculus is one of those fun subjects that you don't appreciate it until you need it, then it is amazing.

Vector calculus is used all the time in both graphics and physics. If you want to deform objects in graphics, to make their normals work out you need to figure out how the deformations change the shape and then change the normals appropriately. Same thing in physics, parametric shapes are defined by math functions, and figuring out angles to bounce and otherwise react with requires calculus to figure out the formulas.

... Either that or you can look up the existing formulas as best you can, and just assume that they did it all right instead of actually know the math yourself.

Splines in general are calculus, but again many programmers don't bother to understand the math, just search out a formula they can run against a matrix multiply to get their results.

Many game programmers get by with iterative methods and accumulating values. It is more precise to compute the endpoints and the rates of change, then directly compute the intermediate rather than accumulating the values (and also accumulating the error). But a little bit of simple calculus as you implement the system lets you implement directly and then solve in the middle.

Any time you are using an iterative solution, like accumulating a tiny bit of motion every update, it is usually better to figure out the proper math for it. Accumulated values also accumulate error, and once you've added a tiny number for a few minutes your accumulated error quickly becomes significant. Better for the programmer to find the rate of change (that's usually calculus!) and then write a function to compute the value directly.

I'm kind of surprised that there isn't an online "school" that isn't dedicated to 'Math for Game Programmers/Graphics Programmers".

Beginner in Game Development?  Read here. And read here.

 

There's also an awesome video tutorial serie,

"Math for Game Developers".

It is in 3D but it may be helpful anyway.

Hey, have a look at my Telegram channel about programming: www.telegram.me/theprogrammingart

calculus - haven't found much use for it myself.

derivatives can be used to calculate surface normals from a displacement map. I suppose integrals could be used to do the reverse.
You've almost certainly used Euler's method in the form of velocity += (acceleration * time); position += (velocity * time); etc. It's a method for solving differential equations quickly.
I've used Taylor expansions to implement extremely fast trig function approximations. Taylor expansions represent functions as a series of infinite sums (but in trig functions, only the first few are of significance for 0 < x < pi/2) calculated from its derivatives.


As for the OP, any math site should be able to teach you the concepts. For 2D games, you only need trig and geometry, although basic linear algebra wouldn't hurt.

This topic is closed to new replies.

Advertisement