# A 10x better way to learn STEM

### How much maths, physics and computer science can you learn by developing games?

I've often seen this question, can one learn STEM by developing games? My claim is that you can learn tons of stuff. Also, you would be far better at applying this knowledge in the real world if you learn it through game development. But this is a high-level claim, lacking specifics. Most games in education advocates get stuck at such 10k feet view. Instead, I want to actually list down what can you learn by learning to develop games.

Each paragraph talks about one domain of STEM knowledge in the list below. The headings show ideas from simplest to advanced when the -> arrow is used.

### Geometry -> Coordinate Systems -> Vectors

Games are fundamentally about things (players, enemies, objects) placed in the world depicted on screen. To make this happen, a game developer needs to figure out how to represent space and how to put things somewhere. You understand the gist of coordinate geometry from this. But our game world is 2D or 3D. You realise using multiple numbers for positions or speed+directions becomes tricky. It is better to treat them as a single multi-dimensional number entity aka vectors.

### Divide and Conquer -> Derivatives -> Integration

A game can start by putting things in place. But then things have to move, either due to the player's input or enemies moving from the game's AI. Sir Isaac Newton invented calculus to exactly solve these problems related to motion. A game developer goes through the same journey of discovery and arrives at the gist of the ideas of differential and integration. Break down the problem into small parts, compute and then aggregate the results. A game loop is carrying out the process of integration in a way!

### Rotations -> Trigonometry -> Quaternions

Things in the game world don't move only in straight lines. To make them rotate, we have to learn about Trigonometry. Again, the crux of the idea is easier to understand in a game dev context: trigonometric ratios are patterns related to rotations that hold for any scale. Later moving to 3D geometry, we realise rotations are complicated. So we need other tools (quaternions or matrices) to handle them.

### Newtonian Mechanics -> Rigid body dynamics

Combine the maths explained in the last three paragraphs with the idea of impulse and simple rules of how things move and we get Newton's world. For example, making the jump of a platformer character realistic or coding up gravity and thrust in a Lunar lander game. Soon we have to think hard about what the are the implications of laws of mechanics, even if we have to bend them for the sake of better graphics. Game development also exposes us to an area of physics that gets subpar treatment in conventional education because there are no analytical solutions: things like rigid body dynamics, and multi-particle systems.

### Statistics and Probability, AI

Newton's world, although wonderful, is deterministic. Games with low replay value are boring. Games we play are about chance occurrences. How do you code them up? It brings us to ideas in probability and statistics. Creating fun little monsters that follow the player? It will give you exposure to the field of classical AI such as search algorithms.

### Advanced Linear Algebra

We touched upon vectors and rotation matrices earlier. But all 3D games are rendered on a 2D screen. The whole field of 3D rendering is nothing but linear algebra. You will see why we need matrices, why matrix multiplication is needed and so on.

### Computer Science & Engineering

Nobody likes glitchy slow, unresponsive games. Building fast games that work on a wide variety of hardware goes deep into ideas in computer engineering like speeding up embarrassingly parallel computations via GPU. Or the whole idea of building hardware and abstractions for a specific, bottleneck task. Engineering is about solving problems under constraints. There's no better example of this than looking at games that were ahead of time. Like how doom used fixed-point arithmetic for calculations or used clever geometric constraints to render a fake 3D world on older hardware. Or how on older hardware like 6502 processors, game geometry was often tightly bound to shift instructions in the CPU because there was no multiplication support.

### Software Development

Even if you ignore hardcore computer science, it takes some effort to make games playable on multiple software systems. How do you package the game up for something like HTML5? How to use custom build to reduce the size of output binary. How do you collect analytics from the game or let multi-player over the network games? How do you organise a large codebase to keep complexity low? Game development can expose you to good software development practices practically. And games are the best place to understand the value of object-oriented programming than made-up cliche examples of animal kingdoms.

### Conclusions and a dream

Wow, that is a rather long list and I've not even scratched the area of user interface design and the theory of fun. Does one need to know all this before starting game development? Absolutely not. You can start from scratch. That is what I did sometime back but I'm still amazed (and proud) of how I've learnt enough about each one of the things on that list. It doesn't matter if the quest was financially successful, it has been a heck of a learning ride.

I had started PleDu to teach via playing games. But the real long-term dream is to build a ~2 years course in which you learn by building games. Each graduate of the program will be a thousand times better at maths, physics, computer science, and user interface design in the real world than in conventional education. I know it sounds like a loonshot.. but that's the whole point.