Mathematics and Physics for Game Developers

Game Development

Mathematics and Physics

Programming

Thumbnail for the article

Back when games ran on computers and other machines with very limited resources, there were no game engines to let developers build directly. Instead, you needed to learn math and a bit of physics just to make a ball bounce off a wall in the right direction!

Nowadays, game engines provide easy-to-use tools and systems for developers, so a developer can make a high-level game without even knowing the formula for the area of a triangle

So, are math and physics still actually important? They're still taught at institutes specializing in game development education, even though engines spare you the need for them

Is Learning Math and Physics Important?

Unfortunately, there's no straightforward answer here. Yes, learning math and physics makes you better at game development, but you don't need to learn them specifically for that reason—maybe just some basic lessons and that's it

Yes, because you need to know some things in math and physics just to become a game developer in the first place, and the more you learn, the more your game development experience grows, and the better games you'll be able to make

And no, because a lot of games don't rely on either of them—the player just presses a few buttons here and there to move to a different stage, like Visual Novels or menu-based games

In general, this field differs from a lot of other technical fields in this regard. In web or app development, you don't need to learn physics unless the project itself specifically involves it, but here things are a bit different

Even though game engines now remove a lot of the math and physics burden from you, sometimes you'll still need one or both of them if your game relies heavily on a technique related to those fields

At the same time, needing to understand math specifically is essential if you want to understand what's happening under the hood in the engine—for example, the lerp function, which returns a specific value between two points based on the ratio you set

So you need to distinguish between learning math and physics as a game developer versus learning them as a game engine developer—the former doesn't need them much, but the latter can't do without them

When Is It Important

I explained that it's both important and not important at the same time—important for game engine developers, the people who work directly with world-building techniques and graphics libraries to render the game, and you also need both of them a lot to build physics systems in an engine

You need a lot—a whole lot—of math and physics if you want to make a game engine, and you'll also need them a lot if you decide to make your own game without an engine

And since game engines in the past weren't powerful enough and didn't have all the modern techniques, game developers also had to learn math and physics, because they often had to build those techniques themselves

That doesn't mean you don't need them now—if your game relies heavily on physics, then you'll need to learn physics and math, not just the basics, but maybe even to the point of learning quantum mechanics!

I'm exaggerating a bit there—you don't need to learn quantum mechanics, but the point is you need to learn enough physics to the degree your game requires, because in that case, no one else knows exactly what idea you're trying to build

You'll also need it if you decide to work with shader techniques programmatically—you may need to understand how to work with mathematical equations, since you'll be dealing with them a lot because of UVs and how to wrangle them to get what you want

Can You Make Games Without Them?

Yes, absolutely, of course

Nowadays, someone can learn game development without knowing much about math—it's enough to understand numbers, ratios, and coordinates, and that's it, because the engine will handle the rest with ready-made tools

No need to learn the Pythagorean theorem, trigonometry, or how to find areas, and no need to learn calculus Because all of that can easily be done with commands and instructions (code) inside the engine, or directly through the programming language you're using

The problem really comes down to just two points. First, in many small cases you'll find you need math to understand why a certain problem is happening, or to reach a result that isn't obvious at first

The second problem is dealing with ratios and vectors, since everything in the game deals with the latter, while the former is needed in a few techniques, like knowing what percentage of health an enemy has, so you can display it accordingly on their health bar

What Should You Learn?

Learning math and physics here can be split into 3 tiers. The first is the basics, which everyone should learn and shouldn't skip anything in. The second tier gives you a deeper understanding of how the engine works, so you can solve its problems faster and reach better techniques. The last tier is only for those who want to make physics-based games—or torture themselves :)

The topics for each tier are as follows:

Tier One: Basics

  1. Algebra: finding the unknown and applying that to variables and equations
  2. Linear algebra: related to vectors, used to represent objects' movement, size, and position in the game world
  3. Force physics: every object is affected by some force, such as gravity, collision, and even acceleration

Tier Two: Problem-Solving

  1. Trigonometry: understanding sine, cosine, and tangent to solve problems related to angles. This can be useful for character movement and aiming mechanics
  2. Probability and statistics: for applying and distributing specific or random values to different elements in the game
  3. Calculus (basic): for understanding accumulation, change, and acceleration processes, useful for simulations
  4. Collisions: learning how objects interact upon collision, including concepts like elasticity and momentum transfer

Tier Three: Depth

  1. Rigid body dynamics: dealing with objects, their collisions, and how they affect each other
  2. Calculus (in depth): using derivatives to calculate complex motion and simulate physics
  3. Soft body dynamics: simulating deformable objects like cloth or muscles
  4. Everything mentioned above, but in more depth*

And remember, you don't need the deep tiers unless your game actually relies on them

When and Where to Learn It

Ask yourself first—what stage are you at? What do you need right now? Are you still too much of a beginner to solve a small equation, or have you reached problems involving building equations to speed up your script?

Having a problem with your game's physics isn't necessarily a reason to go down this road—maybe the problem is a simple variable, and that's all you need to know

I remember once spending about a week searching for a physics bug in my game, only to discover in the end that the engine already had a solution for it from the start—it was just changing one variable from 0.1 to 0.2, and that was it. I didn't need to learn collision physics that time

That answers the "when" question, and in short: learn when you decide to level up your game development skills

As for "where," there are several Arabic resources that offer math lessons, including Khan Academy and Nagwa. The first has a huge library of lessons across many fields, while the second focuses on school curricula from elementary through high school, so you can pick whichever suits you and start learning

You can also search for lessons by name, or identify the specific problem you're facing and then search for lessons related to that problem

Summary

Math and physics aren't essential in modern game development. They used to be essential before game engines existed, but now, as a game developer, you don't need to go deep into them—the basics are enough

How deep you go depends on what you want. If you want to build your own game engine, or make a game that relies heavily on physics and motion, then you might need to learn physics and math

Image sources: 1, 2, 3