This isn’t your average “how gaming can be used to teach and reinforce math” article. I think and hope by now that it is common knowledge that gaming and math go hand in hand. This article specifically addresses the amount of math that is used in a simple computer game and helps answer the big “why do I need math” question that I hear so often.
I have a math degree.
I have a math website.
I love math.
And, to boot, I am a big gamer.
That may make me a little more biased towards math and gaming than a lot of people but it also gives me insight into just how much math is used in games.
When I look on forums, I’m always surprised at how many questions are posed pertaining to writing computer games. It always seem to be with a student asking if they need to know math to have a career in writing computer games. And it seems from the number of questions that I see that writing computer games is high on students list of careers they’d like to pursue.
The short answer is YES, you DO need to know math to write computer games.
Okay that question has been answered, but would that convince a student? Maybe it would for some of them, but for the ones looking for real life examples probably not. So out of curiosity I looked at one of the math games I had written for MathNook to get an actual count of how many math operations were used in the program. Then I decided that using a math game wouldn’t be good because even though the math part of the program is fairly small, it is still a math program. I figured someone looking at the statistics would just figure that of course a math program would have a lot of math in it. So I looked at another game that was not math related. It is called Space Traffic. It can be played for free and I’ve created a page showing the details of the math used in it. Now rather than telling students that you need math to write computer games, I can just send them to this page so they can really see some of the gory details on how much math is used.
Common Core State Standard 6.EE.B.6 states: Use variables to represent numbers and write expressions when solving a real-world or mathematical problem; understand that a variable can represent an unknown number, or, depending on the purpose at hand, any number in a specified set. The reason I bring this up is because grasping the concept of using variables to represent numbers was a tough concept for me to grasp. I remember it so well because it was sort of a sink or swim moment for me with Algebra. That is if you consider a moment as spanning several days!
And yes you guessed it, variables are used extensively in games to represent numbers and values. There are very few lines in Space Traffic and any game that doesn’t use a variable. There are over 1,400 lines of code in Space Traffic. Some of the lines are there to make the program more readable but I would say that about 800 of the lines in the program use variables!
Below is a summary of the number of occurrences of math operations used in the game:
• 139 variables defined
• 94 Comparison statements ( >, <, =, >=, <= )
• 4 equations using PI
• 4 equations using cosine
• 4 equations using sine
• 2 boolean operations
• 75 variables defined with values
• 39 boolean variables defined
• 2 negative integers used
• 22 equations using addition
• 3 equations using subtraction
• 15 equations using multiplication
• 4 equations using division
• 4 arrays defined
• 47 statements using arrays
If you haven’t seen or played Space Traffic, it consists of cars passing through a 4 way intersection. The object is to keep the cars from crashing by clicking on a car to speed it up or slow it down. It only has one level and is considered by today’s standard to be a fairly simple game.
Hopefully this article will help convince your budding game programmer that math is needed. If they need more convincing you can always send them over to the page) where they can play the game and see more of the details than are listed above.