Every game is doing math while you play it. For this assignment I played three games and tried to look at them as a developer rather than a player: Subway Surfers and Vector from my course's recommended list, and Water Sort Puzzle (Color Sort) as my own pick. Behind each swipe and jump there are vectors, distance checks and interpolation formulas running about sixty times a second, and once I started looking for them I couldn't stop.
Before we start, the math words in plain English:
- Distance: how far apart two things are.
- Vector: an arrow that says which way something moves and how fast.
- Algebra: numbers that change by a rule, like scores and coins.
- Dot product: a quick test for whether something is in front of you or behind you.
- Cross product: a quick way to decide which direction something should turn.
- Lerp (linear interpolation): moving a little closer to a target each step instead of jumping there instantly, so motion looks smooth.
**
Game 1: Subway Surfers
**
Platform: Mobile (iPhone) · Genre: Endless runner (action) · Developer: SYBO and Kiloo · Released: 2012
Subway Surfers follows Jake, a kid who gets caught spray-painting a train and takes off down the subway tracks with a security inspector and his dog after him. My job while playing was to look ahead and make quick escape choices: jump over trains and barriers, roll under obstacles, grab coins where I could. The fun comes from the speed. One wrong swipe ends the run, so there is no moment where you can switch off.
The gameplay loop goes Main Menu → Tap to Run → Gameplay (dodge obstacles, collect coins, complete missions) → Crash → Score and Coins Summary → Spend coins → Run Again. The loop is deliberately short. A run can be over in twenty seconds, and the summary screen pushes you straight into another attempt.
Distance
The game checks distances non-stop. When Jake stumbles on a small obstacle, the inspector closes the gap behind him, and a second stumble while the inspector is close gets you caught. So the game must be tracking the distance between those two characters the whole time. Collision is also a distance question: when the gap between Jake and a train reaches zero, that's the crash. The camera keeps a roughly fixed distance behind the player as well.
Direction and Vectors
Jake always moves along a forward vector, and his speed keeps creeping up. A swipe left or right adds a sideways vector that shifts his lane. A swipe up gives him a vertical component for the jump. Trains and obstacles come at him along the opposite forward vector.
Algebra
Numbers change constantly while I play. Coins go up by one per pickup. Score grows with the distance run and then gets multiplied by the multiplier shown at the top of the screen (x2 in my screenshot). So the game is quietly computing score = distance × multiplier for the whole run.
Dot Product
Whether an object sits in front of a character or behind them is the classic dot product test: take the character's forward vector, take the vector toward the object, and check the sign of their dot product.
Cross Product
When Jake changes lanes his body banks toward the direction he's moving, and the camera tilts slightly with him. Deciding which way to rotate, left or right relative to forward, is the question the cross product answers, since its sign gives the turn direction.
Linear Interpolation (Lerp)
Lerp shows up all over this game. Swipe to change lanes and Jake doesn't teleport to the next lane; he slides across in a fraction of a second. The camera eases back into position after a jump instead of snapping. Menu panels slide in, the score counter rolls upward, the hoverboard transition blends. All of that in-between motion is interpolation between a start value and a target value.
Mechanic deep-dive: lane switching
The three lanes sit at fixed sideways positions, say x = -2, x = 0 and x = +2. When the player swipes, the game sets a new target lane, and every frame after that the sideways position updates with linear interpolation:
x = start + (target - start) × t // t runs from 0 to 1 in about 0.25s
That's why the movement feels smooth but still responsive. The collision checks don't pause during the slide either, so you can still crash mid-swipe by moving into a train. One swipe combines a vector (the sideways direction), a lerp (the slide) and a distance check (the collision).
Strengths
- Swipes register instantly and map one-to-one to moves, so deaths feel like my fault rather than the game's.
- The camera follows at a stable distance and eases smoothly, which is why the high speed never becomes disorienting.
- Difficulty is basically one variable: forward speed rising slowly with distance. Simple, and it works.
- Obstacles are color-coded and readable at speed. I always knew why I crashed.
What I would improve
I would add a near-miss bonus. If the distance between the player and an obstacle at the closest point stays under a small threshold and there’s no collision, give bonus points. The game already computes these distances for collision detection, so the feature would be cheap to build, and it would give skilled players a reason to take risks. A practice mode at reduced speed would also help new players, and it only needs the forward velocity vector scaled down.
So Subway Surfers looks simple but runs on constant distance checks, velocity vectors and interpolation. Its polish comes less from complicated math and more from easy math applied smoothly, every single frame.
Game 2: Vector
Platform: Mobile (iOS) · Genre: Action (parkour runner) · Developer: Nekki Limited · Released: 2012
Vector is about a man, drawn as a black silhouette, who breaks out of a glass office building and runs across the city rooftops with a security hunter chasing him. You have to reach the end of each level without getting caught, collecting bonus cubes and earning stars on the way. What sold me on this game is the animation. Movement looks genuinely lifelike, and the hunter a few steps behind keeps the pressure on the whole level.
The gameplay loop goes Main Menu → Level Select → Gameplay (run, jump, slide, perform tricks) → Level Complete or Caught → Stars and Bonus Summary → Unlock Tricks/Next Level → Play Next Level.
Distance
The whole tension of Vector lives in one distance value: the gap between you and the hunter. Every mistake, a clumsy landing, clipping an obstacle, shrinks the gap. Clean tricks widen it. When it reaches zero, the hunter tasers you and the level ends. Collecting bonus cubes is a proximity check too; you pick one up when you pass close enough to it.
Direction and Vectors
The game is literally named after the concept. The runner's motion is a velocity vector with horizontal and vertical components. Running builds up the horizontal part; jumping adds a vertical part. Sliding keeps your horizontal speed while dropping your height. Momentum matters here: jump from a faster run and you fly further, which is just how a velocity vector behaves.
Algebra
Levels award stars based on performance and bonus cubes collected. Cubes double as currency for unlocking new parkour tricks, with prices going up for the fancier moves. Level unlocks are threshold checks on these numbers: finish the previous level, have enough stars.
Dot Product
Obstacles only trigger their interaction when the runner comes at them from the front, along his direction of travel. The hunter also reacts to where the player is relative to his own facing. Both are in-front-or-behind questions, which is dot product territory.
Cross Product
Vector's tricks are full-body rotations: flips, rolls, vaults. Every rotation has a direction, forward flip versus backward roll, clockwise versus anticlockwise. Representing which way a body spins around an axis is where the cross product comes in.
Linear Interpolation (Lerp)
Vector's famous smoothness is blending. The character never snaps from running to jumping; the animation crossfades between the two states. The camera glides after the runner instead of rigidly tracking him, easing toward his position each frame. That's the standard lerp camera follow.
Mechanic deep-dive: the jump arc
A jump in Vector is projectile motion. At takeoff the runner carries horizontal velocity from running and gets vertical velocity from the jump. Each frame, gravity eats into the vertical part while the horizontal part stays roughly constant, and the result is a parabola. The gameplay consequence is direct: your landing point is decided the instant your feet leave the ground. Jump too early over a gap and the arc simply doesn't cover enough horizontal distance. That's why the real skill in Vector is timing, not reflexes. The parabola does not negotiate.
Strengths
- The movement is motion-capture based, so every jump and roll looks physically believable.
- One swipe input drives a whole vocabulary of moves, so the controls stay simple while the output stays varied.
- Early levels quietly teach each mechanic before combining them. The difficulty pacing is good.
What I would improve
I would dress the security guy different from the escaping man to make a small difference.
Vector wears its math in its name. Of my three games it is the clearest proof that a velocity vector, gravity, and one distance value (the hunter gap) are enough to build a compelling game.
Game 3: Color Sort (my off-list pick)
Platform: Mobile (iOS) · Genre: Puzzle · Developer: Tripledot Studios · Released: 2021
Water Sort Puzzle: Get Colour gives you a set of tubes holding mixed layers of colored liquid, plus one or two empty tubes. You pour liquid between tubes until every tube holds a single color. A pour is only legal onto a matching color or into an empty tube, and every tube holds exactly four units.
The objective is just to solve the level. The enjoyment is completely different from the two runners: no timer, no chase, just thinking. The satisfaction is in untangling a board that looks impossible into perfect order.
The gameplay loop goes Main Menu → Level Start → Gameplay (select tube, pour, repeat) → Stuck? Use undo or add an extra tube → Level Solved → Coins/Reward → Next Level.
I chose this game expecting to find almost no math in it. I was wrong.
Algebra and Counting
The game runs on counting and constraints. Each tube holds exactly 4 units, and a pour transfers:
poured = min(matching units on top of source, empty space in destination)
If the source has 3 red units on top and the destination has 1 free slot, exactly 1 unit pours. Around the board there's more bookkeeping: the level counter ticks up, coins arrive per solved level, and undo or an extra tube costs a fixed coin amount.
Linear Interpolation (Lerp)
Nearly all of this game's feel is interpolation. Tap a tube and it rises smoothly instead of popping up. Pour, and the selected tube glides across the screen, tilts gradually, and the liquid levels in both tubes animate down and up over about a second. That liquid level is plainly being lerped from its old value to its new one. Even the level-complete celebration fades and scales in smoothly.
Direction and Vectors
When a tube travels to its pouring position it moves along the straight line from its slot to the destination, sliding along the vector between the two points. A small use of vectors, but a clear one, in a game with no characters at all.
Distance
Distance shows up in the input handling. A tap selects whichever tube is closest to the touch point, which means comparing the distance from your finger to each tube on screen.
Logic and State (beyond the class list)
Each board is a state, and each legal pour moves the game into a new state. Every move has to pass two conditions (top colors match OR destination empty, AND destination has space), and the game has to notice the win state, where every tube is uniform or empty. Watching this made something click for me: a game with no physics is still math. It's just discrete math instead of continuous.
Mechanic deep-dive: one pour, five steps
- A distance check resolves the tap to the chosen tube
- The game validates the move: top colors match or the destination is empty, and the destination has space
- The pour amount comes from min(matching top units, free space)
- The tube lifts and travels with lerp along the vector to the destination
- Both liquid levels interpolate to their new values, then the board state updates
One tap, and the game does five bits of math before the liquid settles.
Strengths
- The interface is minimal, basically nothing on screen except the puzzle, so there is no learning curve at all.
- The pour animation gives a purely logical action a physical, satisfying weight.
- Early levels are trivially easy, and difficulty rises by adding colors and removing empty tubes. The difficulty formula is that clean.
What I would improve
I'd add a par move count per level (solvable in N moves) so players can optimize instead of merely solving; each level becomes an efficiency problem. And the game badly needs a colorblind mode with patterns or symbols on each liquid layer, because right now the entire game state is communicated through color alone. Both features build on data the game already tracks.
Color Sort proved the assignment's point in reverse. I picked it expecting little math and found it everywhere: in the pour formula, in the move validation, and in the interpolation that makes the puzzle feel alive.
Reflection
The concept I kept running into was linear interpolation. It was in every game without exception: Jake sliding between lanes, Vector's animation blending and camera glide, the liquid levels rising and falling in Color Sort. Before this assignment I would have filed all of that under "good animation." Now I recognize it as one formula, a value moving from a start toward a target over time, reused anywhere a game needs to feel smooth instead of mechanical.
The assignment also changed how I watch games. I used to ask whether a game was fun. Now I catch myself asking why the camera never jerks, or how the game knows an enemy is close, or what formula sets an upgrade price. As a software engineer, the biggest surprise was how little of "game feel" comes from hard math. It's distance checks, velocity vectors and lerp, executed consistently sixty times a second.
Conclusion
Three very different games, one toolkit. Distance handles detection and collision. Vectors handle motion. Algebra runs the scores and the economies. Dot and cross products answer the facing and rotation questions, and interpolation smooths everything the player sees. The genres, the pace and the audiences have nothing in common, but the math underneath is the same, and after an assignment spent staring at it I can't stop seeing it.
All screenshots are from my own gameplay sessions on iPhone.
















Top comments (0)