Every game is a simulation running on arithmetic. A character moves because a velocity vector was added to a position vector. An enemy turns to face you because of a trigonometric function. A camera follows smoothly instead of snapping because of interpolation. Engines hide most of that, right up until you want something they do not provide, and then the math is the whole job.
Why The Engine Cannot Do It For You
Phaser, PixiJS, Three.js and Babylon.js handle the common cases internally, and for plenty of games that is enough. The moment you want a homing missile that curves toward its target, a grappling hook that wraps around corners, terrain that looks natural rather than noisy, or a collision response that feels satisfying rather than merely correct, you are writing the math yourself.
The good news is that the list is much shorter than people assume. Linear algebra for vectors and matrices, trigonometry, and a handful of specific algorithms cover almost everything a game does. You do not need calculus for most games, and you do not need abstract algebra at all. We keep a full breakdown of game math for web games with the formulas and the JavaScript to go with them.
Vectors And The Dot Product
A vector carries a direction and a magnitude, and every position, velocity, force and surface normal in your game is one. Addition, subtraction, scaling and normalization handle the daily work of moving things around.
The dot product is where vectors start paying for themselves. For two normalized vectors it equals the cosine of the angle between them, so 1 means they point the same way, 0 means they are perpendicular, and -1 means they point in opposite directions. That one number answers whether an enemy is inside the player's field of view, how much light lands on a surface, and which way a projectile should bounce.
Trigonometry For Aiming And Motion
Any time an angle is involved, trigonometry shows up. A turret aiming at a player is Math.atan2(playerY - turretY, playerX - turretX), which handles all four quadrants correctly and returns the angle in radians.
Sine and cosine also buy you organic motion for almost no code. A platform that bobs is its base position plus an amplitude times the sine of time times frequency. Layer two or three waves at different frequencies and you get movement that would take hours to keyframe by hand.
Interpolation Is What Makes It Feel Good
The difference between a camera that snaps and a camera that follows is interpolation. Most of what players call feel is a value being eased toward a target instead of assigned to it, and the same idea covers health bars that slide, colors that fade, and enemies that turn to face you across several frames.
There is also a hard limit sitting behind all of it on the web: 16.67 milliseconds per frame at 60 FPS, and JavaScript is not C++. Treating the math as a black box costs you frames, because you cannot make sensible calls about precision, caching or algorithmic complexity inside code you do not understand.
None of this needs a math degree. It needs the small set of formulas that covers 90 percent of what games actually do, plus the willingness to write the other 10 percent yourself. That is the difference between fighting your engine and using it.