Ask A Developer: How Important Is High School Maths For Making Games?

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:

Image: Wikipedia

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.

Image: Chris Moore / Flickr, licensed under Creative Commons 2.0


Comments

    "Is our children learning?"

    Perhaps English should have been the focus.

      Great quote by Mr G. W. Bush there.
      https://www.youtube.com/watch?v=-ej7ZEnjSeA

      I think that was the joke.

      all i could see... Preacher not a Teacher thankfully

    Some high school maths is important for programming, but not all of it. There were still some mathematics I needed to learn to be effective as a programmer, and I did a lot of high school maths. Matrix operations for example are absolutely critical to understand for 2D and 3D graphics, and we didn't cover those in high school.

      Interesting, we did matrix operations in Year 11.

        I don't think I did matrix operations at all in high school maths, nor even for Computer Science at uni. Pretty sure I only ended up covering them during a games programming course way down the track.

        I also remember my Chemistry teacher in year 11 being surprised that none of us knew anything about logarithms, wondering why we hadn't learnt about them in year 10.

          I would've been worried to...
          Log Laws, Matricies, Complex Numbers, Integral and Differential Calculus, 2D and 3D Algebra, Complex and Hyperbolic Trig, etc are all covered even in Tasmanian schools (I'm a Tasmanian Year 12 student)

      I'm not sure where/when you were in high school - but these days, in Victoria at least. A lot of subjects tend to have optional modules, where the individual school may choose which particular topics to teach.
      I did both further maths and maths methods in VCE. Further maths is your basic mainstream maths, and we definitely covered matrices but I cant remember if it was a core module, or an optional one.

        Victoria, but I finished VCE in 2001. Did maths methods and specialist maths, which covered some of the stuff I needed but not all. University maths for computer science covered a bit more stuff, including logic, a more thorough exploration of probability, combinatorics and set theory, plus matrices and vector mathematics (Specialist Maths had lots of vector stuff, but no matrices for me). There was also a fair bit of number sequence stuff and I feel like they may have covered some coding theorems in mathematics as well (eg Huffman coding) but 1st year Computer Science is a bit of a blur to me.

        Either way, all of the mathematics we did at university level I will use at least once a week, if not once a day in my job.

    Good article. I can relate, having flunked out of maths B in high school because it was too hard and boring. Did a maths B makeup course in uni so i could do Computer science and got a high distinction though so it helps to have a reason/goal to learn. Try hard in school kids because you may regret it later if you slack off.

    I think mathematics in high school is quite important - even if you don't end up using basic algebra and trigonometry later on in life (although, it's applicable to a lot of everyday things and many careers), maths requires logical thinking. Learning and doing the problems is like exercise for your mind. Your training your mind to think and learn in a logical way.

    People exercise their body physically, regardless if their careers demand it. But when it comes to the mind, people tend to disregard it simply because they think it's irrelevant for the career path they want to take.
    A healthy mind is just as important as a healthy body. We need to exercise and train both, especially at a young age.

    With that said, high school maths is actually very basic in the grand scheme of mathematics. I think the way we teach it in schools makes it harder than it is, especially when coupled with the mentality mentioned above.

    Maths is super important in everything!

    But maths isn't about learning formulas or remembering the multiplication table. Maths is about logical thinking, steps involved in proving or disproving something. Maths give you a language to do that.

      This guy gets it.
      Even if you don't actually require the mathematics, learning it opens up your mind considerably.

        Totally.

        Depending on the job too, you'll probably find that more often than not being able to solve the problem yourself isn't even all that important. There'll likely be some other resource you can fall on to help you get the answer. The real skill is being able to identify the problem to begin with and breaking down it's components and discarding irrelevant details. At that point you can solve it yourself or if not present it to someone else in a concise manner that makes sense to them. It's very difficult to help someone with an issue when they can't actually articulate what the issue is and what the desired outcome should be.

        I think it mostly taught me how much I could hate something. Which was quite a lot as it turned out.

        Last edited 11/10/15 5:30 pm

          Don't hate the maths! Hate the teacher who failed at teaching you.

    The problem with Maths in high school is that 99% of it appears to be entirely useless. As a student I could never engage with most of the maths subjects because I couldn't put it into any kind of context. It was just arbitrary rules and pointless esoterica as far as I was concerned.

    I'm inclined to think simple coding should be a part of the standard maths curriculum as it takes a lot of those more abstract elements of maths and gives them a reason to exist. Likewise meshing mathsy science subjects like Physics together with the maths classes would help.

    On a side note, I've got 16 games on my resume (1 or 2 with Mr Booker). If you don't want to deal with maths, get good at art.

    Last edited 11/10/15 5:28 pm

      There is a great quote from the intro from a maths book called "How Not to be Wrong". I'll try and paraphrase it here:

      All those boring equations you had to solve in maths class, all those maths rules (quadratic formula, anyone?) that you had to remember - they are weight training and calisthenics and dieting are to sports. If you want to play a sport, really play, at a competitive level, you've got to do lots of boring, repetitive, apparently pointless drills. Do pro sportsmen (and women) ever use these drills? You won't see them doing curls or running zig zags between cones on the field. But you do see the players using strength, speed, insight and flexibility they built up doing those drills, week after week after boring week.

      If you want to play sports for a living, or play at a super competitive level, you'll be spending lots of boring time doing drills. But if you can't take the drills, you can just play sports for fun.

      Maths is the same. Most people aren't aspiring to be using maths for a living. But you can still do maths, and probably are using maths without knowing it. Maths is a science of not being wrong about stuff, its techniques hammered out by centuries of hard work and argument. With the tools of maths, you can understand the world in a deeper, sounder, more meaningful way.

    I finished school over 10 years ago now and I cannot remember any time since then that I've needed to use trigonometry and other similar level maths in real-world scenarios. But even upon saying that, do I think it was a waste of time? Hell no. Just because I haven't had to use it doesn't mean it was a waste to learn.
    The issue is that as a teenager you don't see the potential value of something that you may never use, especially one that is so abstract. The best thing that could be done with mathematics classes to make it more engaging is show how maths effects us. Teach basic coding to students. Show how maths is in nature. Show how it is used in art.

    I did uni in Europa at 20-23. Had a mid live crisis at 40 and did uni again at 42-45. In between I did programming as a hobby. Now i'm a professional programmer. Amazing how much math you can forget in 20 years. I think that math is a 'must have' for programmers. Other benefit if my math 'refresher' is that I'm able to help my high school schilderen with their math homework.
    Other comment I have is that your article proves that everybody can be a programmer but with a proper education you can create 'nice' code which is maintainable by other programmers.

    so far ive never had to use algebra in my day to day life, i have however used trig while i was in army

    Last edited 11/10/15 7:03 pm

    The problem is that schools don't even know the application of this mathematics. I told an old school teacher that matrix maths is used for matrix transforms (rotation of 3d models) she was completely blown away. The equation of a line is how you move an object in 3 Dimensions. It makes high school maths a TON more relevant when you're applying it to real world problems. Sin/Cos/Tan are some of the most valuable maths I've come across.

    Computer science should be rolled into mathematics classes and they should be teaching students maths through game design. It would get a ton more students interested in both subjects.

    Last edited 11/10/15 8:26 pm

    I was terrible at maths in HS and almost failed but I've ended up learning a lot more in uni and general osmosis than I did in school. That being said, my school wasn't great - sitting in on a maths class now actually feels somewhat efficient and holistic as opposed to the "sheet of paper with life's answers" approach I had.

    I am currently doing a gaming course and I haven't used math once. Unreal Engine is really good for those who aren't so great at mathematics and they have the "node programming style" (just plugging things in). But I am sure when we move onto Unity as the programming is typed code, the knowledge of math will be needed there.

    It's not just trig that'll help you out in game development, probability and weighting help so much. Knowing how to weight, say, mob spawning against score and time fairly and smoothly.

    Conversely I cannot think of any maths I learnt in high school that I haven't used in u job or everyday life. Maths can be applied to everything, that's the beauty of it..

    Every day when I script/code, I am super thankful I did advanced Maths.
    Just wish I could go back and tell the kids in class who said 'there is no real word use for algebra' and tell them that coding IS algebra; and every operating system, program, game, heck everything with any kind of computer in it is running on algebra.

    I'm certain I did matricies in year 10 advanced maths back in 1982.

    I was one of those nerds that used to hang out in the 'computer room' (that consisted of 2 - count them - 2, Apple ]['s) during lunch in late year 8 - 1980. The school didn't have a computing course in those days so we taught ourselves out of magazines and the occasional, monumentally expensive book. By the time programming was on the curriculum I'd already been coding for 18 months and was writing my own machine code. Political correctness then not being what it is today - the teacher used to call us freaks. Lovely.

    I've noticed over the years since that there are almost always quicker, easier ways to do things and it's only a lack of knowledge that separates you from the best version of your code. Once someone points it out, you slap yourself, make the changes, remember it, and move on. It's one of the best things about my job these days - I never, ever stop learning and, seeing as learning is one of my favorite thing to do, I can't imagine a better career.

Join the discussion!

Trending Stories Right Now