Improv math

I always loved math and it was one of my favourite subjects during school. I have to thank my dad and my bro for instilling that love in my head. My young self was always baffled by how most people around me not only hated math, but they seemed to have a hard time with it. How could it be hard? It was all logical, you hardly needed to work or memorize anything because, hey, with just a few basics in your head you could deduce any formulas or theorems you needed during an exam, right? Heh.

This year I’m one of the tutors for the Master on Game Programming at the U-Tad. The subject I’m teaching this course is Game Architecture: Game Objects, Main Loop and Timing, Reading & Saving, etc. This is the Master’s debut year, so while I believe the course is going great (and students seem to agree so far), some bits and pieces are not ideal and will need improvement for the following years.

One of them is, unsurprisingly, math.

During a mid-course evaluation, the students complained that they didn’t have enough math background to follow some of the subjects. 3D graphics, of course, was the major stumbling block a couple weeks earlier, but things would get hairy again when we got into physics, and in general many types of AI, entity behaviour and animation will need a decent grasp of math and algebra concepts. Students had some of the theoretical tools and knowledge, but lacked the practice and familiarity for putting them to use when solving actual problems. So I shaved a few hours off the Architecture stuff and improvised a quick couple of practical math classes; thankfully I had already scheduled my material in a, so to speak, agile way: most important stuff upfront, always ready to ship.

As part of the materials, I rushed to put together a quick set of links:

Absolutely not a comprehensive set, but all useful stuff.

The topics I touched during those two days included:

  • 2D points and vectors
  • The dot product, normals and reflecting a vector
  • Sphere-sphere collisions and balls bouncing off each other
  • Computing and working with angles
  • Integrating motion over variable time steps
  • Computing parabolic trajectories
  • Lerping, easing functions, and how to derive and compose them
  • 2D transformations, 3×3 matrices and that 3rd component in a 2D vector
  • Composing transforms, hierarchical scenes
  • 3D vectors and the cross product
  • Extending matrices to 3D
  • Coordinate systems and common transforms: local, world, camera, projection, viewport

It was very useful for me and the students. Some funny things said during the classes:

  • The computer doesn’t understand “nice looking”, it can only chew on numbers
  • Ignore left-handed, always use your right hand
  • The cross product can sometimes be seen as the subtraction of two directions

I hope we will find time in the schedule to cover a bit more ground, either standalone or as part of the introduction to physics, as well as provide a better and more cohesive set of links.