I was terrible at mathematics in my adolescence. I hated it. I dropped it as a subject going into Year 10, though that’s not super important, as I eventually dropped myself from the entire curriculum before that HSC. At the time, I had no idea I’d eventually become a games developer, or the lasting effect my disregard for algebra and trigonometry would have.
Almost 15 years on, I still have nightmares about high school.
It’s the typical fare — sometimes I’m late for an exam, in others I’ve lost my timetable and am aimlessly wandering the quadrangle searching for the right building. It’s never anything simple, like facing up to the canteen lady for a sausage roll and being 10 cents short, or losing my motor skills and getting permanently stuck in the dunce square in handball.
No, my night terrors are fixated, oddly, on my truncated education. Was cutting maths loose all those years ago a mistake? Should I have stuck with it? The only way to get any kind of answer was to go back and see if a stronger grasp of high school mathematics would have helped me.
Is Our Children Learning?
The first step is to dive into the current mathematics syllabus in Australia. Just a guess — but I think the maths I was learning in Year 10-12 back in the late 1990s and early 2000s is going to be a little different to what students are going though in 2015.
There are a number of resources online that cover the current outcomes and topics being taught in schools, though to keep things simple, we’ll focus on the materials provided by the NSW Board of Studies.
Back when I was in high school, doing anything above the standard involved taking additional “units” of a subject — up to four in the case of maths. What was once units is now referred to as “extensions”, of which there are three levels.
Looking over the syllabus, two and three unit maths (Mathematics and Mathematics Extension 1 in modern terms) covers the vast quantity of subjects you’ll encounter in games — integration (very important), probability and geometry. That’s not to say four-unit is without benefits (graphs, yay!), but it’d be overkill for games development.
That contents of the syllabus itself doesn’t seem to have changed much so I can confidently say that yes, doubling-down on high school maths would have made my life as a games developer easier. It has nothing to do with knowing formulas off the top of your head, or being able to recite pi to the 1000th decimal.
No, it all has to do with understanding the tools at your disposal and knowing when you should use them. Unfortunately, younger me was equipped with neither.
Knowing You Have A Problem
My weak grasp of numbers never bothered me much until I fired up QBasic one day and started making a clone of Solar Winds. QBasic was the compiler / integrated development environment (IDE) that came with later versions of MS-DOS. Fun fact: Aussie developer Man Fight Dragon is using it to make Black Annex, albeit in a modernised form.
But I digress. Here’s Solar Winds:
It’s a top-down space shooter with RPG bits. You use the arrows keys to turn your ship left and right, with up and down tied to acceleration and braking. It was Asteroids on steroids. And I loved it. So much so I wanted to build my own version.
Now, how does one go about translating arrow key actions into movement? I know teenage me had no idea how to accomplish this task. With internet access at a premium in those days and little recourse, I attacked the problem laterally.
What I did was tie left and right to an “integer” variable called “ROTATE” — think of it as a counter you can add or subtract whole numbers from. Pressing left would make this number go down by one, while right would make it go up. I knew a circle was composed of 360 degrees (I retained some of my education), so when the number hit -1 or 360, I had a special check in there to make it “wrap” — both values would become 0 instead.
The result looked something like this, with X and Y representing how much the ship should move by on those axes:
IF ROTATE = 0 THEN X = X + 0 Y = Y + 1 ELSE IF ROTATE = 1 THEN X = X + 0.1 Y = Y + 0.9 ELSE IF ROTATE = 2 THEN X = X + 0.2 Y = Y + 0.8 ELSE IF ROTATE = 3 THEN X = X + 0.3 Y = Y + 0.7 ELSE IF ROTATE = 4 THEN ...
And so on. The increments for X and Y are incorrect, but get the idea across.
Almost immediately after completing this exhausting array of conditional statements, I was struck with a most depressing thought: There had to be an easier way. If I’d had access to a site such as Stack Overflow, I could have looked up “directional vectors and velocity” and figured out my way from there:
X = X + SPEED * COS(ANGLE); Y = Y + SPEED * SIN(ANGLE);
Where speed is tied to say, pressing up and down, while angle is simply our “ROTATE” value from before. That’s it, that’s all I needed.
But I couldn’t crack out SIN and COS, because I had no idea these functions were used to solve problems like this. It was the first time in my short programming career that I hit a road block I couldn’t work my way through. My manifesto of IF/THEN/ELSE statements (a primitive form of a lookup table) would have taken forever to tweak.
After banging my head against the code, I gave up on my clone.
SIN and COS? Yeah, this is basic trigonometry, currently covered in Mathematics General in the Australian syllabus. Sure, there’s no textbook example involving Solar Winds, but that doesn’t change the maths.
So… Stay In School?
In less than two decades, the ways in which we can educate ourselves have changed dramatically. With sites like Khan Academy and Stack Overflow, school, TAFE and university aren’t the be-all, end-all of learning, especially if you just want to focus on particular aspects of a topic.
Heck, you can even ask the internet directly what maths is involved in making games and get an excellent answer from Quora as the first result.
Even so, if you’re chasing a career in games development and wondering if high school maths is a waste — it isn’t. If I could go back and stick with it, I’d do it in a heartbeat, if only to finish that darn clone…
In addition to his weekend work on Kotaku Australia, Logan Booker works as an independent developer at Screwfly Studios, along with David Kidd. Their first game was Zafehouse: Diaries, released in September 2012 and their second title was Deadnaut, published in November 2014. Fear Equation is Screwfly’s in-development third title. You can follow Logan and David on Twitter, though they won’t be offended if you just check out their games instead.