• Announcements

    • khawk

      Download the Game Design and Indie Game Marketing Freebook   07/19/17

      GameDev.net and CRC Press have teamed up to bring a free ebook of content curated from top titles published by CRC Press. The freebook, Practices of Game Design & Indie Game Marketing, includes chapters from The Art of Game Design: A Book of Lenses, A Practical Guide to Indie Game Marketing, and An Architectural Approach to Level Design. The GameDev.net FreeBook is relevant to game designers, developers, and those interested in learning more about the challenges in game development. We know game development can be a tough discipline and business, so we picked several chapters from CRC Press titles that we thought would be of interest to you, the GameDev.net audience, in your journey to design, develop, and market your next game. The free ebook is available through CRC Press by clicking here. The Curated Books The Art of Game Design: A Book of Lenses, Second Edition, by Jesse Schell Presents 100+ sets of questions, or different lenses, for viewing a game’s design, encompassing diverse fields such as psychology, architecture, music, film, software engineering, theme park design, mathematics, anthropology, and more. Written by one of the world's top game designers, this book describes the deepest and most fundamental principles of game design, demonstrating how tactics used in board, card, and athletic games also work in video games. It provides practical instruction on creating world-class games that will be played again and again. View it here. A Practical Guide to Indie Game Marketing, by Joel Dreskin Marketing is an essential but too frequently overlooked or minimized component of the release plan for indie games. A Practical Guide to Indie Game Marketing provides you with the tools needed to build visibility and sell your indie games. With special focus on those developers with small budgets and limited staff and resources, this book is packed with tangible recommendations and techniques that you can put to use immediately. As a seasoned professional of the indie game arena, author Joel Dreskin gives you insight into practical, real-world experiences of marketing numerous successful games and also provides stories of the failures. View it here. An Architectural Approach to Level Design This is one of the first books to integrate architectural and spatial design theory with the field of level design. The book presents architectural techniques and theories for level designers to use in their own work. It connects architecture and level design in different ways that address the practical elements of how designers construct space and the experiential elements of how and why humans interact with this space. Throughout the text, readers learn skills for spatial layout, evoking emotion through gamespaces, and creating better levels through architectural theory. View it here. Learn more and download the ebook by clicking here. Did you know? GameDev.net and CRC Press also recently teamed up to bring GDNet+ Members up to a 20% discount on all CRC Press books. Learn more about this and other benefits here.
Sign in to follow this  
Followers 0
distilledwater71

Highest level of math needed for 2D game development?

18 posts in this topic

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.

0

Share this post


Link to post
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
0

Share this post


Link to post
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.
0

Share this post


Link to post
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.

0

Share this post


Link to post
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

0

Share this post


Link to post
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.

2

Share this post


Link to post
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.

0

Share this post


Link to post
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
1

Share this post


Link to post
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.

0

Share this post


Link to post
Share on other sites


I consider a solid understanding of discrete math to be a necessary skill for any type of programming.

 

plus one that!

 

apparently, the vast majority of CS / math stuff is discrete mathematics.  I was quite surprised when i took the class.   i'd already gotten to diff eq's in regular engineering math, but discrete was something "a little different" - quite enlightening.

1

Share this post


Link to post
Share on other sites

Now that I think about it, there is one problem that keeps coming up in these forums which does require knowing linear algebra and solving a quadratic equation: Aiming at a moving target with a constant-speed projectile. (Sample thread [url="http://www.gamedev.net/topic/401165-target-prediction-system--target-leading/"]here[/url])

 

But really, that's the only example I can think of, and there's a good chance you'll never even encounter it.

0

Share this post


Link to post
Share on other sites

Addition, subtraction, multiplication, division at a minimum. You'll probably find yourself at a point where you'll need to understand the distance equation (square roots), and some basic trig: sine, cosine, and maybe even arc tangent. You'll be using them more as tools that, while you don't understand how they work, you know how to use them to get done what you need.

Edited by smr
0

Share this post


Link to post
Share on other sites

I was working on a 2D mobile game where you had to throw an object at a certain rotation depending on the touch input and it would bounce on the walls depending on the angle it collided. I recall having to do a revision on my trigonometry.

0

Share this post


Link to post
Share on other sites

Now that I think about it, there is one problem that keeps coming up in these forums which does require knowing linear algebra and solving a quadratic equation: Aiming at a moving target with a constant-speed projectile. (Sample thread here)

 

But really, that's the only example I can think of, and there's a good chance you'll never even encounter it.

 

and if the OP encounters that problem he can just click that link and copy the functions :)

0

Share this post


Link to post
Share on other sites

People are throwing around the term "linear algebra" when I think they mean "linear equations" (i.e., first year algebra).  They are not the same.

 

You do not need to know "linear algebra" to program games.  "Linear algebra" is extremely abstract.

Edited by Haytil
0

Share this post


Link to post
Share on other sites

People are throwing around the term "linear algebra" when I think they mean "linear equations" (i.e., first year algebra).  They are not the same.

 

You do not need to know "linear algebra" to program games.  "Linear algebra" is extremely abstract.

 

When I said "linear algebra" in this thread I meant understanding how the dot product works. I suspect others also meant "linear algebra" when they said "linear algebra", as in using matrices to represent linear and affine transformations, which is actually very useful for game programming.

0

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0