# Highest level of math needed for 2D game development?

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

## Recommended Posts

Hello everyone. I am interested in making 2D games on my own, and I would like to know how advanced the math gets if I decide to write my own 2D game engine from scratch instead of using one that already exists.

##### Share on other sites

Well it depends on whether or not you want to use rotations, or an orthographic camera.

The highest level of math if you want a game with rotations would be trigonometry, however, if you want to use an orthographic camera, you'l need to learn linear algebra to create the matrices.

Edited by Solid_Spy

##### Share on other sites

Well you a mod can merge this thread with this other thread, seeing as they are the same thing.

##### Share on other sites
If you want to make simple games. You can get by with very little math and still create fun games. Any additional math will enable you to create more complicated and interesting game mechanics.

##### Share on other sites

Hello everyone. I am interested in making 2D games on my own, and I would like to know how advanced the math gets if I decide to write my own 2D game engine from scratch instead of using one that already exists.

There is no highest level, you can make use of extremely advanced math in a 2D game if you want to.

The lowest level you'd need is just addition and subtraction.

##### Share on other sites

Hello everyone. I am interested in making 2D games on my own, and I would like to know how advanced the math gets if I decide to write my own 2D game engine from scratch instead of using one that already exists.

As someone said depends what you do, but sometimes you probably will need to do some more advanced math

I am doing 2d framework and game prototypes and I found a need to do

- mixing rotations and translations on 2d (I can go somewhat lost in it)

- many intersection math for different type of intersection test (it is not so easy at least for me)

- physics by hand and dealing with torque impulse responses etc (can be quite complicated equations)

- you can do probably more complicated especially if you do simulations

You probably also can avoid that when doing more sprite

based games less geometry+physics+simulation ones

##### Share on other sites

I consider a solid understanding of discrete math to be a necessary skill for any type of programming. If you don't agree, I submit you probably don't know discrete math very well. Learn it, and you'll be enlightened.

I've only just started delving into lambda calculus, but what I have learned so far has drastically improved my productivity and the quality of my code.

If you're interested in anything involving free motion, i.e. an Asteroids clone or an FPS, then trigonometry and linear algebra are important. A solid understanding of differential calculus can significantly enhance your understanding of many problems you might encounter with your update loop as well.

##### Share on other sites

You can get away with very little math, as other people have pointed out. However, there are lots of things that are much easier to do if you do know some math.

For 2D graphics, complex numbers are extremely useful: Think of point (x,y) as being the complex number x+y*i. Translation now consist of adding a complex number, rotation consists of multiplying by a unit-length complex number, the rotation to align something to something else is a division of the unit-length complex numbers that represent their attitudes... Your code ends up being extremely compact and easy to get right the first time around.

##### Share on other sites

I find that, whenever this question is asked, invariably the answers tend to be overblown and overcomplicated.  People throw around terms like "lambda calculus" and "linear algebra", but most of it is just to sound impressive and generally the programming only barely touches those concepts on a surface level, if at all.

The truth is, for most game programming (including 3D graphics), if you've gotten your 2nd year of algebra in high school, you'll be fine.

Some concepts can be expressed in multiple ways - and advanced mathematics can just give you another way of thinking about or expressing the details of a problem.  For instance, Alvaro suggests complex numbers as being useful to 2D graphics - but he's really just talking about Cartesian coordinates and 2D vectors.  Ultimately, in the end, the code is going to end up looking pretty similar no matter which conceptual abstraction you used in your mind to get there

The exception to this rule is if you're planning on writing a physics engine - and at that point, first-year calculus and a year of physics will generally get you all that you need.

An important, related question is - are you good at math? Because if you're really bad at math, you're probably going to have some difficulty.  Not because you need the mathematics itself, but because the kind of logical thinking that goes into programming is very similar to the kind of logical thinking that goes into mathematics.  So there's going to be some correlation there - if you're good at one, you'll probably be good at the other.  And if you're bad at one, you'll probably be bad at the other.

But if you're good at mathematics, even if you don't know a concept important to your work, you'll be able to quickly pick up and learn what you need as you go along.

Edited by Haytil

##### Share on other sites

Some concepts can be expressed in multiple ways - and advanced mathematics can just give you another way of thinking about or expressing the details of a problem. For instance, Alvaro suggests complex numbers as being useful to 2D graphics - but he's really just talking about Cartesian coordinates and 2D vectors. Ultimately, in the end, the code is going to end up looking pretty similar no matter which conceptual abstraction you used in your mind to get there

Not quite. If you are only using additions as translation, I agree. If you start thinking of rotations as unit-length complex numbers instead of angles, that's when using complex numbers simplifies lots of things. You could use Cartesian coordinates and encode rotations as (cos(angle), sin(angle)), and then you'll be basically doing the same thing I suggest.

• 21
• 11
• 9
• 17
• 13