← Explorations
The Finished Game
Eight weeks of math, running. Press M to see it think.
or A D walk space or jump let go early for a shorter jump S slow motion R start over M see what the engine sees

There is no engine download behind this

Every rule in this game lives in one file with fifteen functions in it, and each of those functions is a piece of math. Students in the Build a Game Engine Out of Math course write all fifteen, one or two a week, and build this game on top of them as they go.

  • Bodiesa thing in the world is just numbers
  • Physicsgravity is two additions; a jump is a square root
  • Collisionboxes are four comparisons; round things are Pythagoras
  • Motionpatrols flip a sign; the ghost follows a vector of length one
  • Momentumkeys push the speed, and friction takes a percentage
  • Camerasubtract one number from everything

Press M while playing. The pink boxes are the collision bodies and the blue arrows are velocity. A jump leaves a trail of dots, which is the arc the quadratic makes. The orange triangles run to the coins, with the nearest one labelled: that is the Pythagorean theorem, drawn live. The circles are the touching test. The dashed lines under the enemies are their patrol ranges with the sign of their speed, the purple arrow on the ghost is its heading with a length of exactly one, the strip in the corner is the camera's slice of the world, and the panel is the six numbers the engine holds for the player. None of it is decoration: it is the engine showing its own arithmetic.

Why you cannot copy it from here

This page is play-only on purpose. The point of the course is that the person playing it could have written it, and by week eight, they have.