Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Mathematics and Game Programming

Tags:

math

2d

I want to program graphical 2D games more complex than the basic 2D stuff I already know. I don't want to do 3D programming. Just more complex 2D stuff. I dropped high school before I could learn a lot of stuff so I walked away with enough algebra knowledge to balance my checkbook and do some light 2D Cartesian programming.

Are there any good resources out there for a guy with a limited attention span (say 20 minutes apiece for a subject I'm keenly interested in) to learn, gradually, how to do something more useful with math in programming?

like image 598
Xfcn Avatar asked Oct 09 '08 16:10

Xfcn


People also ask

What is math for game programming?

Common branches of math utilized in game design and development include Algebra, Trigonometry, Calculus, Linear Algebra, Discrete Mathematics, Applied Mathematics, and more.

Can a mathematician become a game developer?

Game Developer As a game developer, you will need strong mathematical skills. You must be familiar with linear algebra, calculus, geometry, trigonometry, statistics, etc. Games are complex systems that require a lot of mathematical calculations.

Do you need math for game coding?

While some fields of programming require you to have extensive knowledge of mathematics (such as game development and machine learning), you don't need advanced math skills for most coding jobs.

Is math used in game scripting?

A lot of math in gameplay scripting is fairly simple, but math used in game engine architecture is far more complex and a lot more taxing mentally. Math in game development is simulated either by the developer or handled by the engine at runtime by running computations to calculate the operation that is needed.


1 Answers

You need to be competent in Trigonometry: Wikipedia and Mathworld

Even though you don't wish to do 3D programming, 2D games also use vectors and matrices. (from Linear Algebra)

Linear Algebra resources: Wikepedia and Mathworld

One point that will save you a lot of effort in Trig programming is realizing the need for the atan2() function, rather than the atan() function. This is important when determining the direction between two points.

Being able to move between various coordinate systems is a big plus. This will come with experience. Two common things that trip people up are:

a) Most screen systems place the origin (0,0) in the upper left corner, with the positive x axis extending to the right and the positive y axis extending down. Standard Cartesian coordinates suppose the origin of Quadrant 1 (where x and y are always positive or zero) in the lower left. This requires a programmer to 'flip' the y orientation at some stage.

b) Typical geography places 0 degrees as North and positive degrees sweep clockwise. All the Trig functions place 0 degrees as East with positive degrees sweeping counter-clockwise.

Finally, even though we tend to think in degrees, real libraries will use radians. A best practice is to store angles as radians (in 'math' orientation rather than 'geo') and convert things when displaying debug information..

like image 141
TomZ Avatar answered Oct 20 '22 06:10

TomZ