Thread: Game Programming general questions... and Math?

  1. #1
    Registered User
    Join Date
    Oct 2010
    Posts
    4

    Game Programming general questions... and Math?

    I'm in a sort of weird predicament. Let me start out with a brief synopsis of why I am where I am now:

    I started making web pages 10 years ago and absolutely loved it. I loved HTML, I learned CSS, I moved on to simple javascript and.... stopped. However I still have a great passion for it. I love coding (no matter how simple) and seeing the fruits of my work displayed right there on the screen. I decided, hey, I like video games and I like making web pages, so why not be a game programmer?

    I know this may sound silly, but it seemed to fit so well into something I'd enjoy. I really do enjoy web page "programming" and I figured I would love to study more in depth, higher level languages because it's fun to me. Now I'm wondering if I made a mistake being a Computer Science major. I don't know the first thing about anything past javascript. I'm wondering now how likely it would be that I would enjoy my major JUST because I like web design. I will be entering my second semester of computer science this upcoming January.

    Here's my first question: How likely is it that I would also enjoy much harder languages if I immensely enjoy my simple web page languages? I know they are entirely different, I know the first response will always be "you don't know until you try," and really, I'm getting to it... but has anyone else done this? Gone into programming because of web pages and enjoyed it?

    Here's my second question: Math. Let's talk math. I'm good at math, really I am. I'm in Calculus 1 right now and am passing with a A- to Bish (he hasn't posted grades, I'm guessing). I get math concepts. I understand it. I can do it. But, I don't like it. I don't mind algebra at all (easy as cake), and trig was decent when I took it. I'm just wondering how much calculus has to do with game programming. I can do math, I just don't want to. I understand there will be math in game programming, don't get me wrong, but I don't want to be a math genius and labor over intensive math problems my whole day. How much math is involved with game programming? Are there certain areas of game programming I could go into that aren't as math intensive? I've heard some people say I have to take math in my major just to see if I have a logical way of looking at things, I've heard people say game programming is only math, I've heard some parts of game programming are math-intensive, some aren't... I'm totally lost. I'm really not sure who to listen to.


    I know this is long winded but I'm really having a miniature crisis. I would love more than anything to program games. It sounds like a good idea... I just want to make sure it is a good idea. If all else fails, I am also a web design minor.
    Last edited by MsJordan; 10-27-2010 at 02:31 AM.

  2. #2
    Registered User rogster001's Avatar
    Join Date
    Aug 2006
    Location
    Liverpool UK
    Posts
    1,472
    I would love to study more in depth, higher level languages
    Just a terminology point> When referring to powerful languages like C and C++ you would say 'lower level' (it's the other way round in computing!) meaning you can access layers 'lower down' towards the actual core machine instructions.

    there is a section in the FAQs about game programming and maths which is just a little advice on how much maths you should know,
    if you wanted to do any 3D programming then thats a big ask without understanding of all the transformations, rotations and what have you.
    For 2d games then it depends i suppose, in any game representing a dynamic system then you are going to need ways of representing 'cause and effect', deflections and angles etc, if you write a 'pong' style game then you still have to deal with the 'physics' of the ball moving and how it is deflected, how its speed changes etc.
    it is maths that provides the ability to express real world entities and effects via equations, and the computer allows us to represent those things as graphics elements interacting on the screen.

    So you just have to think about the type of game you would like to make and that should tell you how much maths you are likely to have to build in.
    there are thousands of games you could make with little maths at all.
    I have not written many games at all but with any program i have usually had to learn a little maths formula of one kind of another, but i am not talking about anything complex really, I am rubbish at maths, but if you can understand how to implement and manage that little formula 'X' within your code so it does what you need then thats how you pick up your little repetoire of maths code snippets to accomplish things, of course it is much better to truly understand a thing rather than just blindly use it, but you have to start somewhere. stuff like returning the cardinal number of a node at row and column position in a 2d array, or the reverse extracting the relative row and column from a node, determining if a number is odd or even, etc, all simple little things but really useful that can be a source of much pondering until you find out the little bit of maths that makes it easy.
    Thought for the day:
    "Are you sure your sanity chip is fully screwed in sir?" (Kryten)
    FLTK: "The most fun you can have with your clothes on."

    Stroustrup:
    "If I had thought of it and had some marketing sense every computer and just about any gadget would have had a little 'C++ Inside' sticker on it'"

  3. #3
    Password:
    Join Date
    Dec 2009
    Location
    NC
    Posts
    587
    Most math won't really be math, it will be turning math formulas into code, which is pretty easy in most cases. To give you an idea, I'm taking a high school Advanced Placement Comp. Sci. class, which counts as, IIRC, 3 credit hours at any college, and the only math they require is Alg I, a high school freshman class. Which implies that other than being able to interpret what a formula is doing, there's little advanced math in CS.

  4. #4
    Registered User
    Join Date
    Oct 2008
    Posts
    1,262
    Quote Originally Posted by User Name: View Post
    Most math won't really be math, it will be turning math formulas into code, which is pretty easy in most cases. To give you an idea, I'm taking a high school Advanced Placement Comp. Sci. class, which counts as, IIRC, 3 credit hours at any college, and the only math they require is Alg I, a high school freshman class. Which implies that other than being able to interpret what a formula is doing, there's little advanced math in CS.
    Well, IMHO there is quite some matrix/vector calculations that you should understand for most games. Collision detection, for one, makes heavy use on those.

  5. #5
    Registered User
    Join Date
    Oct 2010
    Posts
    4
    Thank you everyone for your responses!

    Quote Originally Posted by rogster001 View Post
    Just a terminology point> When referring to powerful languages like C and C++ you would say 'lower level' (it's the other way round in computing!) meaning you can access layers 'lower down' towards the actual core machine instructions.
    Sorry about the terminology mix-up. In my Intro to CS class my professor refers to those languages as higher level, so this is from where I got the idea that they were called that.

    Quote Originally Posted by rogster001 View Post
    there is a section in the FAQs about game programming and maths which is just a little advice on how much maths you should know
    Thank you, I will be sure to check out the FAQ as well.



    Also what I'm gathering from the above posts is that math will be in my possible future career, but it is more knowing WHAT it does rather than "coming up with" it? I guess what I mean is that what it seems like everyone is saying is that I will need to know math and understand it (which I do) rather than developing COMPLEX formulas. I'm okay with having a little algebra, trig, geometry, etc. be a part of my job, I really don't mind that, but I just don't want programming to be math theory.

    Let me clean up my question a bit: is game programming all math? Is it developing complex equations and math theory? I am okay with a little math, I just don't want it to be all math. I am looking at programming 3-D games.



    And again, thank you all for taking the time to read and respond to my question. I really do deeply appreciate it.

  6. #6
    C++ Witch laserlight's Avatar
    Join Date
    Oct 2003
    Location
    Singapore
    Posts
    28,413
    Quote Originally Posted by MsJordan
    In my Intro to CS class my professor refers to those languages as higher level, so this is from where I got the idea that they were called that.
    They are higher level with respect to say, assembly language. If it is not obvious by now, "higher" and "lower" are relative terms
    Quote Originally Posted by Bjarne Stroustrup (2000-10-14)
    I get maybe two dozen requests for help with some sort of programming or design problem every day. Most have more sense than to send me hundreds of lines of code. If they do, I ask them to find the smallest example that exhibits the problem and send me that. Mostly, they then find the error themselves. "Finding the smallest program that demonstrates the error" is a powerful debugging tool.
    Look up a C++ Reference and learn How To Ask Questions The Smart Way

  7. #7
    Registered User VirtualAce's Avatar
    Join Date
    Aug 2001
    Posts
    9,607
    Most math won't really be math, it will be turning math formulas into code, which is pretty easy in most cases. To give you an idea, I'm taking a high school Advanced Placement Comp. Sci. class, which counts as, IIRC, 3 credit hours at any college, and the only math they require is Alg I, a high school freshman class. Which implies that other than being able to interpret what a formula is doing, there's little advanced math in CS.
    I disagree.
    Math in games can get pretty hairy and covers linear algebra and calculus. As games get more and more realism added to them the math just gets more and more complex. Even if you are using 3rd party libraries you should still understand the underlying math or you won't be nearly as effective.

  8. #8
    Registered User
    Join Date
    May 2009
    Posts
    64
    Game programming is so broad. There's a graphics, physics, sound, ai, and etc. You're a God if you master all of those.

    I also want to create 3D games and I choose to go with graphics and sometimes with physics. I usually do Linear algebra on it. Yeah, I know there are some formulas out there but if you really want to be a good at it, you should understand how it was derived. The hardest math I ever encounter was quaternions. I don't know if the book I just saw was bad but honestly, I don't understand some of it.

    You should love math. I know I'm not very good in math but I love it because it's hard. I don't know if that's the right word but you get the point.

    If you want to create an efficient and realistic graphics, you should start improving your math.

    Great graphics programmers don't just look on codes or formulas, they understand it and make it more efficient and faster.

  9. #9
    Registered User
    Join Date
    Oct 2010
    Posts
    4
    Thank you everyone for adding more information to this thread. I appreciate all the responses

    Quote Originally Posted by sarah22 View Post
    You should love math. I know I'm not very good in math but I love it because it's hard. I don't know if that's the right word but you get the point.

    If you want to create an efficient and realistic graphics, you should start improving your math.

    Great graphics programmers don't just look on codes or formulas, they understand it and make it more efficient and faster.
    Thank you for your input. You put more insight into a subject I don't really know too much about. However, I don't really feel that your quote, "you should start improving your math" really pertains to me. I'm really good at math as I stated in my original post. I just don't really like it that much. I would be absolutely fine with linear algebra. I don't care for calculus all too much to be honest. That's really what I'm concerned about.


    I really think I should reiterate again that I can do math and comprehend how it is done.


    I don't actually have a problem doing math, I'm just wondering if there is a branch of 3D game programming that focuses less on math than other branches.

  10. #10
    Registered User VirtualAce's Avatar
    Join Date
    Aug 2001
    Posts
    9,607
    I think what sarah22 is getting at is that people normally enjoy themselves when they are doing what they enjoy. If you do not like math then programming a game will force you to do something you do not enjoy. Being good at something does not necessarily mean you enjoy doing it. Normally people tend to enjoy what they are good at but obviously there are exceptions to the rule.

  11. #11
    Registered User
    Join Date
    Oct 2010
    Posts
    4
    Quote Originally Posted by Bubba View Post
    I think what sarah22 is getting at is that people normally enjoy themselves when they are doing what they enjoy. If you do not like math then programming a game will force you to do something you do not enjoy. Being good at something does not necessarily mean you enjoy doing it. Normally people tend to enjoy what they are good at but obviously there are exceptions to the rule.
    Thank you, that makes a lot of sense. Indeed, if math is part of game programming I will either have to learn to like it or give up on the idea it seems (in order to enjoy my career). It is something I will definitely have to give thought on, but I have time at least.

  12. #12
    Registered User
    Join Date
    Nov 2010
    Posts
    11
    Check out Processing.js
    This fits your situation!
    Processing.js is an open programming language for people who want to program images, animation, and interactions for the web without using Flash or Java applets. Processing.js uses Javascript to draw shapes and manipulate images on the HTML5 Canvas element. The code is light-weight, simple to learn and makes an ideal tool for visualizing data, creating user-interfaces and developing web-based games.

  13. #13
    Registered User VirtualAce's Avatar
    Join Date
    Aug 2001
    Posts
    9,607
    How does that help the OP?

  14. #14
    Frequently Quite Prolix dwks's Avatar
    Join Date
    Apr 2005
    Location
    Canada
    Posts
    8,057
    It's amazing what you can do with just a little bit of math. With just a perspective calculation formula and a vague notion of how gravity works, you can write star-cluster simulations with "gravity" (just move each star towards each other star). Or 3D boxes. If you think about it a bit more you can come up with a top-down maze with collision detection, or a 3D one.

    A little embarrassing to admit it, but in one of my first games I didn't know the distance calculation formula that is a derivative of Pythagoras's Theorem: distance = sqrt(x_diff*x_diff + y_diff*y_diff). Then I was reading my math textbook for fun and I stumbled across this; I was so excited I immediately re-implemented my game with distances and auto-orientation and auto-acceleration of the user's spaceship. (This was a really long time ago, okay?)

    But when you know more about math you can do things much more simply and effectively. Quick example: the first time I tried to do arbitrary line-line collision intersection I couldn't do it; I only got 90-degree angle lines working. A year later I tried to solve the same problem as better programmer and I mastered all the atan2() cases to solve the collision detection. Somewhat more recently I reimplemented this problem again, but using vectors instead of y=mx+b lines, and it's so much simpler! [I typed in a text editor for about ten minutes, derived the formula, plugged it into my program and it just worked . . . .] The right tool makes a huge difference . . . .

    I think that the same general principles that make web design or JavaScript appealing apply to other forms of computer science as well: attention to detail, logical thinking, and creating something absolutely amazing. You just learn about more tools and more about what is possible. I didn't start with the JavaScript route but I know other people who have, and it's certainly possible . . . . I think the math grows on you once you realize how much everything is based on it.

    I'm convinced that you can do interesting things with as little or as much math as you are comfortable with. I hope you'll consider sticking with game programming, but regardless, best of luck with your studies.
    dwk

    Seek and ye shall find. quaere et invenies.

    "Simplicity does not precede complexity, but follows it." -- Alan Perlis
    "Testing can only prove the presence of bugs, not their absence." -- Edsger Dijkstra
    "The only real mistake is the one from which we learn nothing." -- John Powell


    Other boards: DaniWeb, TPS
    Unofficial Wiki FAQ: cpwiki.sf.net

    My website: http://dwks.theprogrammingsite.com/
    Projects: codeform, xuni, atlantis, nort, etc.

  15. #15
    Registered User
    Join Date
    Sep 2008
    Location
    Toronto, Canada
    Posts
    1,834
    I highly doubt that the wiz-kid game programmers really do fundamental physics/ray-tracing/mapping etc. I believe they use sophisticated tools.... they may do some modeling/sculpture, and scan those in as reference points. Mostly these game developers are harvested for their imagination. All the underlying rendering is locked away in proprietary libraries and graphics engines.

    Now if you want to develop those low-level geometry engines then that's another story. Then you're not doing game development but rather furthering the state-of-the-art 3-D rendering on multi-core, specialized platforms.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. What you need
    By Shakti in forum Game Programming
    Replies: 2
    Last Post: 01-03-2006, 01:53 PM
  2. 3d math questions
    By linuxdude in forum Game Programming
    Replies: 3
    Last Post: 01-04-2005, 10:07 PM
  3. Game Programming FAQ
    By TechWins in forum Game Programming
    Replies: 5
    Last Post: 09-29-2004, 02:00 AM
  4. it's not much of a game, but...
    By blasta in forum Game Programming
    Replies: 6
    Last Post: 11-21-2002, 11:43 AM
  5. Very simple question, problem in my Code.
    By Vber in forum C Programming
    Replies: 7
    Last Post: 11-16-2002, 03:57 PM