And so it begins...
by Greg Baker · 02/06/2007 (10:14 am) · 12 comments
This blog records my journey into a deeper understanding of mathematics, computer graphics, game design and development.
Preface
During my second year of college I decided that I wanted to do something more with computers than just play Doom against my friend across town. I knew I wanted to become a software developer and run my own business. I looked into the Computer Science program, but decided that all the math and theory just didn't seem applicable to real world development, so I settled on a Bachelor's of Business Administration (BBA) with a concentration in Computer Information Systems (CIS). The CIS degree offered exactly what I was looking for. A focus on software development and design in conjunction with the business classes I wanted to prepare me for starting my own business.
I've now spent the last 7 years doing primarily C/C++ and MFC development for various employers and started my own business in April of 2004. Game development for me has included mods for commercial titles such as Neverwinter Nights, and Vampire, a custom DX9 2D game engine for a 'Space Invaders' style game for touch screen devices, level creation using UnrealED, and custom tools for MMORPGs like Everquest.
As you can see, I've done a considerable amount of dabbling, but I haven't gotten serious about game development until the last few months. I finally looked inside of myself and stopped avoiding doing what I really wanted to and that's make games. I love games. Board games, card games, sports, video games...all kinds of games. I also love to be challenged. I need something that stretches my brain and forces me to exercise my mind be innovative. For me, business software is mind-numbingly dull. Honestly, how many times do I have to write code that connects to a database and displays data on a form for someone to edit?
Mathematics
I took a serious shot at a game programming job just a few months ago. As part of the interview process I was required to take an elementary exam to test my 3D math skills and C++ programming knowledge. The programming part was easy, the math piece, not so much. It had been 7 years since I had taken a derivative or any type of vector or matrix math. Needless to say it was an eye-opening experience and one that prompted my first move toward getting serious about learning this math stuff everyone thinks is so important. :)
I took it as a personal challenge to teach myself much of what I had forgotten and even some that I had never learned before. Over the past few months I've progressed quickly through the help of several online calculus tutorials, in particular this one http://www.qcalculus.com/cal02.htm as well as my own dusty calculus book from college. I've also found the following book Mathematics for 3D Game Programming and Computer Graphics, Second Edition extremely helpful in dusting off the cobwebs from working with Vectors and Matrices.
The most interesting result from all of this has been how much more I'm capable of truly understanding what is taking place behind the mathematics now. I understand what is happening, why we're taking a derivative, and what it actually means rather than just following along with an instructor at school and memorizing a process so I can pass an exam in a few weeks. Being able to understand the concepts of calculus is a much more rewarding experience than simply regurgitating the steps required to solve a math problem.
For instance, lets take the following function:
then the derivative is:
Wow, great, we did it! But...what does our result mean? Why did we just drop the constant value 10 completely? Well, lets examine these questions a bit more deeply.
What does our result mean?
What does it mean? To answer this question you must understand what a derivative is or what it represents. In short, a derivative is how quickly y is changing for a given value of x. A derivative is a measurement of the rate of change. The example of velocity and acceleration for a moving vehicle is a classic example. The velocity of a car is how fast it is currently traveling, but acceleration, the derivative of velocity, tells us how quickly our velocity is changing. For example, if I'm traveling at 60 mph, that's my velocity. If I press the gas pedal harder, my velocity will start to increase, but how quickly is it increasing? That's when the derivative, which is acceleration in this case, comes into play. Acceleration, the derivative of velocity, will tell me how quickly my velocity is changing.
This is just a simple example to illustrate a point that a derivative measures the rate of change in a dependant variable.
Why did we just drop the constant value 10 completely?
Interesting question. Why did we do that? Most math books just gloss over this concept, as well as most instructors I've had, and students are taught to just accept that a constant value is dropped when taking a derivative. Okay, great, but...why? Let's go back to our definition of the derivative. A derivative measures the rate of change of a dependant variable. In our case, y is dependant on the value of x. This means that as x changes, the value of y will change. So, back to our question, why did we drop the constant value? Well, it's dropped from the derivative because we want to measure the rate of change of y as we change the value x. So, we only want to keep components in the equation who's values are affected by x. Clearly, the constant value 10 isn't affected by the value of x at all. We could set x = 100 or x = -40 and the value 10 will always be 10. It's constant. It will never change. It was, and forever will be, the value 10. Since we're only concerned about measuring the rate of change in y for a value of x, we can toss out the constant value because it doesn't affect what we're measuring when we take the derivative.
Spend some time thinking about this. Once you get this concept, calculus will make a lot more sense and in turn get a lot easier to understand. You may even find you enjoy it!
Preface
During my second year of college I decided that I wanted to do something more with computers than just play Doom against my friend across town. I knew I wanted to become a software developer and run my own business. I looked into the Computer Science program, but decided that all the math and theory just didn't seem applicable to real world development, so I settled on a Bachelor's of Business Administration (BBA) with a concentration in Computer Information Systems (CIS). The CIS degree offered exactly what I was looking for. A focus on software development and design in conjunction with the business classes I wanted to prepare me for starting my own business.
I've now spent the last 7 years doing primarily C/C++ and MFC development for various employers and started my own business in April of 2004. Game development for me has included mods for commercial titles such as Neverwinter Nights, and Vampire, a custom DX9 2D game engine for a 'Space Invaders' style game for touch screen devices, level creation using UnrealED, and custom tools for MMORPGs like Everquest.
As you can see, I've done a considerable amount of dabbling, but I haven't gotten serious about game development until the last few months. I finally looked inside of myself and stopped avoiding doing what I really wanted to and that's make games. I love games. Board games, card games, sports, video games...all kinds of games. I also love to be challenged. I need something that stretches my brain and forces me to exercise my mind be innovative. For me, business software is mind-numbingly dull. Honestly, how many times do I have to write code that connects to a database and displays data on a form for someone to edit?
Mathematics
I took a serious shot at a game programming job just a few months ago. As part of the interview process I was required to take an elementary exam to test my 3D math skills and C++ programming knowledge. The programming part was easy, the math piece, not so much. It had been 7 years since I had taken a derivative or any type of vector or matrix math. Needless to say it was an eye-opening experience and one that prompted my first move toward getting serious about learning this math stuff everyone thinks is so important. :)
I took it as a personal challenge to teach myself much of what I had forgotten and even some that I had never learned before. Over the past few months I've progressed quickly through the help of several online calculus tutorials, in particular this one http://www.qcalculus.com/cal02.htm as well as my own dusty calculus book from college. I've also found the following book Mathematics for 3D Game Programming and Computer Graphics, Second Edition extremely helpful in dusting off the cobwebs from working with Vectors and Matrices.
The most interesting result from all of this has been how much more I'm capable of truly understanding what is taking place behind the mathematics now. I understand what is happening, why we're taking a derivative, and what it actually means rather than just following along with an instructor at school and memorizing a process so I can pass an exam in a few weeks. Being able to understand the concepts of calculus is a much more rewarding experience than simply regurgitating the steps required to solve a math problem.
For instance, lets take the following function:
f(x) = 3x^4 + x^2 + 10
then the derivative is:
f'(x) = 12x^3 + 2x
Wow, great, we did it! But...what does our result mean? Why did we just drop the constant value 10 completely? Well, lets examine these questions a bit more deeply.
What does our result mean?
What does it mean? To answer this question you must understand what a derivative is or what it represents. In short, a derivative is how quickly y is changing for a given value of x. A derivative is a measurement of the rate of change. The example of velocity and acceleration for a moving vehicle is a classic example. The velocity of a car is how fast it is currently traveling, but acceleration, the derivative of velocity, tells us how quickly our velocity is changing. For example, if I'm traveling at 60 mph, that's my velocity. If I press the gas pedal harder, my velocity will start to increase, but how quickly is it increasing? That's when the derivative, which is acceleration in this case, comes into play. Acceleration, the derivative of velocity, will tell me how quickly my velocity is changing.
This is just a simple example to illustrate a point that a derivative measures the rate of change in a dependant variable.
Why did we just drop the constant value 10 completely?
Interesting question. Why did we do that? Most math books just gloss over this concept, as well as most instructors I've had, and students are taught to just accept that a constant value is dropped when taking a derivative. Okay, great, but...why? Let's go back to our definition of the derivative. A derivative measures the rate of change of a dependant variable. In our case, y is dependant on the value of x. This means that as x changes, the value of y will change. So, back to our question, why did we drop the constant value? Well, it's dropped from the derivative because we want to measure the rate of change of y as we change the value x. So, we only want to keep components in the equation who's values are affected by x. Clearly, the constant value 10 isn't affected by the value of x at all. We could set x = 100 or x = -40 and the value 10 will always be 10. It's constant. It will never change. It was, and forever will be, the value 10. Since we're only concerned about measuring the rate of change in y for a value of x, we can toss out the constant value because it doesn't affect what we're measuring when we take the derivative.
Spend some time thinking about this. Once you get this concept, calculus will make a lot more sense and in turn get a lot easier to understand. You may even find you enjoy it!
About the author
#2
02/06/2007 (10:32 am)
Never thought about that, good insight!
#3
02/06/2007 (10:36 am)
Thanks for the recommendation! I just purchased that book on Amazon so I can improve my 3D math skills.
#4
02/06/2007 (10:37 am)
This is why I aint a programer, my mind just gos on standby when math is involved :)
#5
02/06/2007 (10:45 am)
The simplest way to work with 3D math is just not do it at all, and purchase TGB :)
#6
IMO math is an integral part of game programming. people like to sometimes say that math isn't really necessary for game programming, but the fact is that lack of math skills WILL severely limit what you can do in code.
ya know what the funny thing is? you're taking the time to study calculus but theres no real use for it in game programming. I can't imagine one practical application of differentiating a function. while working on my current project, I can recall only one instance in which I actually used a bit of calculus for integrating a trig function. Ive found the most useful math to know is plain old algebra for things like proportions, ratios, rates, kinematics and trigonometry. knowing when and how to make use of a basic proportion can be a very useful skill, much more useful than taking a derivative. just my 2 cents...
02/06/2007 (11:32 am)
congrats Beerskunk! IMO math is an integral part of game programming. people like to sometimes say that math isn't really necessary for game programming, but the fact is that lack of math skills WILL severely limit what you can do in code.
ya know what the funny thing is? you're taking the time to study calculus but theres no real use for it in game programming. I can't imagine one practical application of differentiating a function. while working on my current project, I can recall only one instance in which I actually used a bit of calculus for integrating a trig function. Ive found the most useful math to know is plain old algebra for things like proportions, ratios, rates, kinematics and trigonometry. knowing when and how to make use of a basic proportion can be a very useful skill, much more useful than taking a derivative. just my 2 cents...
#7
Given my C/C++ background, the actual game engine, especially the physics engine, is far more interesting to me than the scripting layer. I'm all for abstraction, but I enjoy getting my hands dirty. :)
02/06/2007 (11:40 am)
Some of the more advanced material, generally restricted to the actual game engine, involve some innovative techniques that are difficult, if not impossible, to solve without the use of derivatives. For me, it's more of an exercise in learning something for the pleasure of learning it. Whether or not I ever find a real world application for the knowledge isn't of utmost importance.Given my C/C++ background, the actual game engine, especially the physics engine, is far more interesting to me than the scripting layer. I'm all for abstraction, but I enjoy getting my hands dirty. :)
#8
Probably 95% of what you will do will not involve practicing any math skills. If you ever get stuck in a situation where you need to do the other 5%, then things like Calc, Linear Algebra, etc get very useful. Most of this comes into play for advanced features, though. Any time you are reading a paper and trying to implement the theory it describes, it almost certainly contains equations you will need to be able to read and partially understand.
Aside from that, though. Sean is on the money :) At one point I could do a neat party trick of using a Taylor series to do a sin/cos without a calculator...however not only did I never get to use that particular trick, I can't remember much of anything beyond geometric series.
02/06/2007 (12:14 pm)
I disagree with Sean H. on his calculus point 5% of the time. Probably 95% of what you will do will not involve practicing any math skills. If you ever get stuck in a situation where you need to do the other 5%, then things like Calc, Linear Algebra, etc get very useful. Most of this comes into play for advanced features, though. Any time you are reading a paper and trying to implement the theory it describes, it almost certainly contains equations you will need to be able to read and partially understand.
Aside from that, though. Sean is on the money :) At one point I could do a neat party trick of using a Taylor series to do a sin/cos without a calculator...however not only did I never get to use that particular trick, I can't remember much of anything beyond geometric series.
#9
02/06/2007 (12:20 pm)
lol, Pat was that a party trick to try and impress girls? :-)
#10
"Hey girl, I bet I know your sin!"
02/06/2007 (4:14 pm)
Ya, it probably was. The line went something like this:"Hey girl, I bet I know your sin!"
#11
02/07/2007 (10:31 am)
I'm in my 1st year at Devry U and I have some great math classes coming up that are just going to be daunting!!! Ive heard of calculus, and of coarse algebra, Ive even played with them a little, But Ive got this one called Discrete math!! Could you guys clue me as to what this is going to be like, it's the only one I'm not familiar with:) And it sounds like you as apprehensible at diving back in as I am.
#12
I'm taking a discrete math course for CS majors - and we've covered Set Theory, Proofs, Recurrences, Logic, Combinatorics, and some other stuff that I don't remember.
It's awesome. And painful, but I don't plan on having to prove too many algorithms after college. A lot of the stuff we've covered I've covered at least a little bit before in high school or other classes, so it's not terrible.
Good luck!
02/07/2007 (11:09 am)
@BobbyI'm taking a discrete math course for CS majors - and we've covered Set Theory, Proofs, Recurrences, Logic, Combinatorics, and some other stuff that I don't remember.
It's awesome. And painful, but I don't plan on having to prove too many algorithms after college. A lot of the stuff we've covered I've covered at least a little bit before in high school or other classes, so it's not terrible.
Good luck!

Torque 3D Owner Tom Perry
O and I don't think I will ever "enjoy" it :P