How is math used in video game designing and programming? originally appeared on Quora: the knowledge sharing network where compelling questions are answered by people with unique insights.
Answer by Matthew S. Stenquist, video game developer, on Quora:
Math is an absolute fundamental foundation to successful game development and game design. Math is everything when it comes to games. From having the ability to calculating the trajectory of an Angry Bird flying through the sky, to ensuring that a character can jump and come back down to the ground. Without the help of mathematics, games simply wouldn't work. A character wouldn't be able to walk up a slope, slide down a slide, fire a bullet from a gun, or even jump without the help of the mathematics. The most basic of games use some form of math to the most complex of games. Math is essential to the production of games. It is the flour to the cake that game developers are trying to bake. Without it, the cake wouldn't rise.
Math is used in every aspect of game development, including art. Maya is a math-based program that plots out the vertices and normals in mathematical form while the artist just uses a tool that allows them to create stunning 3D graphics without worrying about math. Simply put, you could model Godzilla in notepad and push it into Maya, if you knew where to plot the points in numerical form (which is extremely difficult).
However, a lot of the math is computed at runtime and handled by the game engines that render back face culling, and the other nitty gritty things that would be too cumbersome to do without the use of using an engine to alleviate the math calculation portion at runtime. 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.
Here are some examples:
Another example for instance is, Kerbal Space Program; a game that relies heavily on math. The entire game is pretty much all math when you think about it.
Newtonian physics are heavily simulated in KSP. Without the use of math in KSP, the game wouldn't be able to do much. Your rocket wouldn't be able to get off the ground and out of the atmosphere into space. The simulations in the game would be boring, and quite frankly the game wouldn't be able to do much. A rocket wouldn't be able to get off the ground because thrust doesn't exist, and or be able to pitch, yaw, and roll when in the sky.
In game development we're allowed to get away with faking math so that it is to work with the design of a game, but a lot of the time the math in games mirror real world physics and math principles. Math helps out with calculating everything from what a particles velocity should be, to the spread of a shotgun blast, to using gravity to bring a ball back down to the ground, and vice versa. These are all very basic math principles that a lot of games use. And their is still much more sophisticated and advanced math used in AAA games that I haven't covered.
What are the main branches of math used in game development?
How is math used in game programming and game scripting?
Math in game programming can be as easy as adding x + y, to calculating and manipulating cos, sin, tan with added variables while stringing it to your function, all the while their is still much much more advanced ways to use math in games.
Let's take a look at creating a constant variable called MAX_SPEED and MIN_SPEED (vectors) and adding that to the game update loop while adding a speed to a spaceship so that it can move, to creating an array that runs an algorithm that loads a random level every time the game is played, to simply altering a child's X (vectors) in the update loop, or to adjusting the angle of rotation once it hits a wall (reflection) on a spin wheel when a ball hits it. Doing any sort of basic thing, such as movement in a game will incorporate some form of math.
Math is an essential ingredient that is necessary to the production of games. Without the use of math in games we would just have pretty art that's semi-interactive. Math adds a whole new element to entertainment by blending the sciences and arts into a whole.
With that being said, mathematics allows games to do incredible things that the real world cannot simulate by allowing new ways for the game script and engine to handle calculations on the fly that would not be feasible to do in the real world. So next time when you question your math teacher if you're going to ever use "Algebra" in the real world when you're done with your studies, you sure will especially if you pursue a career in game development.
What can math do in game design?
Here are some books I recommend reading.
Physics for Game Developers: Science, math, and code for realistic effects: David M Bourg, Bryan Bywalec: 9781449392512: Amazon.com: Books
Concrete Mathematics: A Foundation for Computer Science (2nd Edition): Ronald L. Graham, Donald E. Knuth, Oren Patashnik: 0785342558029: Amazon.com: Boo
Amazon.com: Essential Mathematics for Games and Interactive Applications: A Programmer's Guide, Second Edition (9780123742971): James M. Van Verth, Lars M. Bishop: Books
National Geographic Angry Birds Furious Forces: The Physics at Play in the World's Most Popular Game: Rhett Allain, Peter Vesterbacka: 9781426211720: Amazon.com: Books
This question originally appeared on Quora. Ask a question, get a great answer. Learn from experts and access insider knowledge. You can follow Quora on Twitter, Facebook, and Google+.