Skip to content

The Craft

Maths for Games

Explore chance, movement and drawing through experiments and reusable routines.

Choose a starting point. Each sequence explains the maths it uses; you do not need to complete one before trying another.

Chance and samples

5 lessons · Sinclair BASIC · ZX Spectrum

Build Dice Roller and watch a distribution take shape. Compare small and large samples, then see what changes when you keep adding rolls.

Start chance and samples
  1. 01Roll a die
  2. 02Keep the tallies
  3. 03Compare shares
  4. 04Watch the distribution
  5. 05Compare experiments

Aiming and movement

6 lessons · Interactive browser experiments

Turn coordinates into a direction, aim at a target, and see how rounding changes a shot. Explore triangles, trigonometry and fixed-point movement.

Start aiming and movement
  1. 01Place a point
  2. 02Measure the triangle
  3. 03Turn an angle into movement
  4. 04Measure angles in radians
  5. 05Find the angle to a target
  6. 06Keep fractional movement in integers

Drawing on a grid

2 lessons · Worked examples · native assembly routines

Choose pixels with integer error, reflect curved edges, fill rows and move bitmap glyphs. Connect the maths to reusable machine code.

Start drawing on a grid
  1. 01Draw with integer error
  2. 02Move a glyph, keep its shape

Further explorations

Planned

More ways to explore the maths behind games. These lessons are still to come.

Transformations and 3D
Rotate a cube, move a camera, and understand matrices, local and world coordinates, and perspective.
Vectors and motion
Build orbits, pursuit and bouncing movement from directions and distances.
Measurement and collision
Use lines, rays and intersections to test sightlines, contact and sliding.
Curves and surfaces
Follow curved tracks and build spheres using interpolation, tangents and normals.
Time, waves and patterns
Explore acceleration, springs, oscillation, terrain and the effects of discrete updates.
Chance and decisions
Extend Dice Roller into weighted encounters, expected value and perceived fairness.
Mathematics for game AI
Understand graphs, path costs, heuristics and utility scores: the mathematical groundwork for Game AI.

Fixed-point arithmetic and numerical accuracy run throughout, with visible examples of rounding, drift and precision trade-offs.