Jump to content
  • Advertisement
Sign in to follow this  
Thomas Wiborg

Where to learn 2D Math for game dev

This topic is 808 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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

Edited by Thomas Wiborg

Share this post


Link to post
Share on other sites
Advertisement

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 :)

Share this post


Link to post
Share on other sites

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!

Share this post


Link to post
Share on other sites

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.

Edited by BHXSpecter

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites

There's also an awesome video tutorial serie, 

 "Math for Game Developers".

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

Share this post


Link to post
Share on other sites

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.

Edited by nfries88

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!