It is currently Sat Jun 23, 2018 6:40 am

All times are UTC - 7 hours





Post new topic Reply to topic  [ 17 posts ]  Go to page 1, 2  Next
Author Message
PostPosted: Fri May 04, 2018 10:47 am 
Offline
User avatar

Joined: Thu Jul 06, 2017 3:37 pm
Posts: 12
How many of you think math is important in video game development? I've been trying to build my own game that involves throwing objects/calculating trajectories with vectors and matrices however, I've been struggling to get it work. It has been a bit too long for me to recall on them and math was never really my strongest subject. The tutorials I've found on YouTube aren't close enough to what I want to do with my game. I tried just creating it myself with some math tutorials like KhanAcedemy, Paul's Online Notes, and Study Pug but I am quite lost at the moment and can't get it work. Do you guys know any websites closely tied to developing games? That would be lots of helps to me and others looking to start building their first game.


Last edited by Jayden Garrison on Mon May 14, 2018 4:10 pm, edited 1 time in total.

Top
 Profile  
 
PostPosted: Fri May 04, 2018 12:17 pm 
Offline
User avatar

Joined: Mon Feb 07, 2011 12:46 pm
Posts: 985
I think math is certainly important in video game development (and also many games other than video games too), although what kind of math is important is difference depending on what kind of game. I did not find math a difficult subject though; it is easier to understand than language arts and social studies and so on. Also, I do not know the websites closely tied to developing games, as mostly I have figured out the things by myself, looking up stuff on Wikipedia and so on when I was unsure.

_________________
.


Top
 Profile  
 
PostPosted: Fri May 04, 2018 12:28 pm 
Offline
User avatar

Joined: Wed Sep 07, 2005 9:55 am
Posts: 319
Location: Phoenix, AZ
It depends on the type of game, but I do feel a basic understanding of math and physics helps. While working on a Zelda-type game, everything was very simple and basic. On the other hand, a platformer project was a lot more complex. Some of that was by choice, such as having elastic collisions instead of simple ejections. It's really a matter of how far you want to take the simulation vs approximating things.


Top
 Profile  
 
PostPosted: Fri May 04, 2018 1:15 pm 
Offline
User avatar

Joined: Mon Sep 15, 2014 4:35 pm
Posts: 3339
Location: Nacogdoches, Texas
I don't really think you need anything more than trigonometry for simple 2D games? If you don't have one already, make a sine/cosine table because it's essential for some more complicated (but still relevant) problems.

Now, with 3D graphics, it's probably a whole other story...


Top
 Profile  
 
PostPosted: Fri May 04, 2018 1:49 pm 
Offline

Joined: Sun Sep 19, 2004 11:12 pm
Posts: 20165
Location: NE Indiana, USA (NTSC)
Velocity is the integral of acceleration, and displacement is the integral of velocity. That's calculus. And when acceleration depends on some other variable, that's differential equations.


Top
 Profile  
 
PostPosted: Fri May 04, 2018 1:53 pm 
Offline
User avatar

Joined: Sat Jan 09, 2016 9:21 pm
Posts: 400
Location: Central Illinois, USA
tepples wrote:
Velocity is the integral of acceleration, and displacement is the integral of velocity. That's calculus. And when acceleration depends on some other variable, that's differential equations.


But you can do all of that pretty easily without having the slightest clue about what all those words mean.

_________________
My games: http://www.bitethechili.com


Top
 Profile  
 
PostPosted: Fri May 04, 2018 3:40 pm 
Offline
User avatar

Joined: Sun Jan 22, 2012 12:03 pm
Posts: 6348
Location: Canada
gauauu wrote:
But you can do all of that pretty easily without having the slightest clue about what all those words mean.

You can do a lot of things without knowing much math. That doesn't mean it's not useful or applicable. If you don't know what you don't know, it might be hard to see what you could have used from it. Understanding more math can give you a lot of tools to work with that might do a job better or more easily.

Like, someone can give you a recipe for a parabolic jump, by adding acceleration to velocity to position. That's fine at first, but when you need to modify it, analyze it, do something more complicated... it can make the difference between tweaking values all night until the curve "looks" the way you want (and possibly giving up), and being able to just dictate a curve that, e.g. passes through specific points, has the velocity you want at those points, stays in the air for a specific amount of time, is attracted to a moving magnet, etc... or sometimes it helps to know if it's actually impossible to build the curve you're asking for. Instead of a long period of trial and error, then giving up, you might have realized much sooner that you should try something else.

Here's a basic list of areas of math that I think are pretty useful to games. This is also pretty much the same categories of math you'd find as requirements for a general Computer Science degree:

  • Geometry - The basic stuff of shapes, angles, measurement, etc. Trigonometry, i.e. understanding angles and circles has a lot of applications elsewhere too.
  • Linear Algebra - Especially important for geometry, intersections, collision, motion, etc. Matrices and other methods to understand the relationship between 1D, 2D, 3D, and higher dimensions.
  • Calculus - Useful for anything to do with curves, motion, curved surfaces, shapes. Relationships between surface are and volume, questions about how much or how long for various processes that happen over time. (Combined with Linear Algebra this is kind of the backbone of a lot of 3D rendering topics.)
  • Discrete Math - If Calclus deals with smooth, continuous curves, Discrete Math is instead individual steps. Integers. Graphs and connections. Ways of dealing with collections of things. Insights into modular arithmetic.
  • Statistics & Probability - Probability, tendencies, odds, expectations. Not just making a prediction but having an idea of how reliable it is. Extremely applicable to AI, and provides a lot of tools for analysis. (Strongly correlated with Discrete Math as well.)
  • Formal Logic - Sometimes is just really helps to be able to work through logic mechanically.

All of these are well worth developing a basic understanding of. Eventually the deeper stuff becomes more specialized and less generically applicable, but the foundation level of each of these topics is very practical knowledge.


Top
 Profile  
 
PostPosted: Fri May 04, 2018 6:11 pm 
Offline

Joined: Thu Aug 20, 2015 3:09 am
Posts: 371
If you understand this, you're doing okay.


Top
 Profile  
 
PostPosted: Fri May 04, 2018 6:21 pm 
Offline
User avatar

Joined: Sun Jan 22, 2012 12:03 pm
Posts: 6348
Location: Canada
Rahsennor wrote:
If you understand this, you're doing okay.

That author is pretty good at burying a useful tip in rhetoric that makes makes me not want to read it at all. (And completely ignores some reasons/situations where it might be completely appropriate to use Euler integration as well.)


Top
 Profile  
 
PostPosted: Fri May 04, 2018 9:45 pm 
Offline

Joined: Thu Aug 20, 2015 3:09 am
Posts: 371
rainwarrior wrote:
That author is pretty good at burying a useful tip in rhetoric that makes makes me not want to read it at all. (And completely ignores some reasons/situations where it might be completely appropriate to use Euler integration as well.)

I had a much better link bookmarked but it's 404 now. Verlet integration is still the most complex math I've used in actual game code, though, which was the point I was trying to make.


Last edited by Rahsennor on Fri May 04, 2018 9:47 pm, edited 1 time in total.

Top
 Profile  
 
PostPosted: Fri May 04, 2018 9:46 pm 
Offline

Joined: Tue Feb 07, 2017 2:03 am
Posts: 449
Everything in a computer is a number. Everything it does is a number, everything you make it do is modifying numbers. So basically a computer is a glorified calculator and so you really have to understand maths. Putting numbers in and out of A,X and Y is Algebra. Boolean Algebra is the only way you can understand AND/OR/EOR BNE/BEQ/BCC/BCS/BPL/BMI etc

If you want a smaller target set, taking what rainwarrior said, I would put Boolean Algebra and Linear Algebra as the "must" haves, and then the others are "as needed".


Top
 Profile  
 
PostPosted: Fri May 04, 2018 10:16 pm 
Offline
User avatar

Joined: Sun Jan 22, 2012 12:03 pm
Posts: 6348
Location: Canada
Rahsennor wrote:
rainwarrior wrote:
That author is pretty good at burying a useful tip in rhetoric that makes makes me not want to read it at all. (And completely ignores some reasons/situations where it might be completely appropriate to use Euler integration as well.)

I had a much better link bookmarked but it's 404 now. Verlet integration is still the most complex math I've used in actual game code, though, which was the point I was trying to make.

Ah I think half the content in the article is really good, especially the diagrams, and I think the concept is explained well. It's just that the other half is extremely and pointlessly arrogant, and wrongly positions Euler as invalid/obsolete, which it really isn't.

e.g. in NES development, it's probably a good tradeoff of accuracy vs CPU usage to stick with regular Euler integration in most cases. (...and if you've got CPU to spare, RK4 might be more applicable too? This Verlet method is a middle ground, between "fast" and "accurate".)

Anyhow, sorry for the off topic critique of that article.

Oziphantom wrote:
If you want a smaller target set, taking what rainwarrior said, I would put Boolean Algebra and Linear Algebra as the "must" haves, and then the others are "as needed".

I'd say for 3D graphics and animation, Calculus and Linear Algebra are a must. If you were making a turn based RPG, may Stats and Probability would be the most important one on my list. It depends what kinda stuff you want to do, but I tried to give a brief description of how each is used... kinda difficult to go into everything (and BTW, I think Calculus is still fairly useful in an NES/2D context too).


Top
 Profile  
 
PostPosted: Sat May 05, 2018 12:28 am 
Offline

Joined: Tue Feb 07, 2017 2:03 am
Posts: 449
rainwarrior wrote:
Oziphantom wrote:
If you want a smaller target set, taking what rainwarrior said, I would put Boolean Algebra and Linear Algebra as the "must" haves, and then the others are "as needed".

I'd say for 3D graphics and animation, Calculus and Linear Algebra are a must. If you were making a turn based RPG, may Stats and Probability would be the most important one on my list. It depends what kinda stuff you want to do, but I tried to give a brief description of how each is used... kinda difficult to go into everything (and BTW, I think Calculus is still fairly useful in an NES/2D context too).

Code:
World->Screen->MetaSprite->Sprite
             \
              ->MetaTile->Tile
Space conversion and concepts is something I see a lot of people new to game dev really struggle with, and I feel having some basic grasp of Linear Algebra would really assist them in working through the logic and understanding how to think in terms of multiple Spaces. Even if you are doing 2D in 3D you need to be able to get to the sprite origin and then +/- to make the billboard.
I agree you will probably end up coding more Calculus but you will always be thinking and planning in LA.

As per the original topic, there are a number of books on the subject.
There is a dedicated Maths for Games Programmers book. I've not read it though. All of the Prima La Mothe series have a section that covers the basics of maths. If you want a from "this is a vector and this is a point" all the way down to "now you have made a software perspective correct textured rasterizer" this "even thicker than Petzold" book covers it all in great detail https://www.amazon.com/Tricks-Programmi ... 0672318350 I would recommend any La Mothe book though he has a great talent for making it very approachable. Even if it is how to do voice control with a resister based DAC on a parallel port with debug strings on 2nd MDA adapter ISA card ;)


Top
 Profile  
 
PostPosted: Sat May 05, 2018 7:25 pm 
Offline

Joined: Thu Aug 20, 2015 3:09 am
Posts: 371
rainwarrior wrote:
Ah I think half the content in the article is really good, especially the diagrams, and I think the concept is explained well. It's just that the other half is extremely and pointlessly arrogant, and wrongly positions Euler as invalid/obsolete, which it really isn't.

Yeah, I linked it for the diagrams. It wasn't until I saw them (or rather these - archive.org to the rescue again) that I really understood why Verlet was more accurate. I knew the math checked out, but seeing the difference made it stick.

For anyone actually following my links, see also position Verlet. Not having a velocity term to keep updated can be quite handy.

rainwarrior wrote:
e.g. in NES development, it's probably a good tradeoff of accuracy vs CPU usage to stick with regular Euler integration in most cases. (...and if you've got CPU to spare, RK4 might be more applicable too? This Verlet method is a middle ground, between "fast" and "accurate".)

In a basic platformer the only acceleration is gravity, which is constant, so you need a second order integrator. Less will always be inaccurate and more won't buy you anything. (I'm not counting collision response because you generally don't want that to be accurate anyway, for gameplay reasons. Most players would like to stay on the ground unless they press jump.)

But for the NES I agree it's probably overkill. You can't beat Euler for simplicity.


Top
 Profile  
 
PostPosted: Sun May 06, 2018 12:21 am 
Offline

Joined: Tue Feb 07, 2017 2:03 am
Posts: 449
For a NES Euler is mostly overkill ;) For most things Pos += Delta is all you need.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 17 posts ]  Go to page 1, 2  Next

All times are UTC - 7 hours


Who is online

Users browsing this forum: No registered users and 8 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group