Welcome, Guest. Please login or register.

Login with username, password and session length

 
Advanced search

1411490 Posts in 69371 Topics- by 58428 Members - Latest Member: shelton786

April 24, 2024, 08:13:27 PM

Need hosting? Check out Digital Ocean
(more details in this thread)
TIGSource ForumsDeveloperTechnical (Moderator: ThemsAllTook)What Kind Of Math Will I Need To Learn For Programming?
Pages: [1] 2
Print
Author Topic: What Kind Of Math Will I Need To Learn For Programming?  (Read 3254 times)
The Sane Psycho
Level 0
*


View Profile
« on: October 31, 2014, 01:47:40 PM »

So, a few years ago, it was my dream to be a video game developer. Eventually, I gave up on that dream. However, recently, I decided to once again pursue that dream. Now, I know that I will need to know some math before I start learning programming (in case you're wondering, I have no programming experience whatsoever). I know I will at least need algebra. I was just wondering what other kinds of math I will need to learn before I start programming. If it helps, I plan to start with Python, then learn Visual Basic, and then learn C#, and finally, learn C++. Those are the ones I plan on learning, but I'll probably learn a few others along the way. Any help with this will be greatly appreciated.
« Last Edit: October 31, 2014, 01:52:57 PM by The Sane Psycho » Logged
zacaj
Level 3
***


void main()


View Profile WWW
« Reply #1 on: October 31, 2014, 01:51:14 PM »

Trig, almost definitely.  Beyond that it depends on the types of games you plan to make. 
Logged

My twitter: @zacaj_

Quote from: mcc
Well let's just take a look at this "getting started" page and see--
Quote
Download and install cmake
Noooooooo
ThemsAllTook
Administrator
Level 10
******



View Profile WWW
« Reply #2 on: October 31, 2014, 01:55:23 PM »

I was able to get away with nothing more than basic arithmetic for my first game. Trigonometry is a pretty big help as zacaj mentioned, and is simple enough to learn in less than an hour. If you want to get fancier, I've written some tutorials on vector, quaternion, and matrix math that might be helpful. I've needed algebra once or twice, but not nearly as much as those others.
Logged

Dacke
Level 10
*****



View Profile
« Reply #3 on: October 31, 2014, 02:06:01 PM »

I know that I will need to know some math before I start learning programming

No, you really don't. In order to make certain games it's good to know some trigonometry. But you really don't need to know any of that before you start learning the basics of programming. Don't hesitate, just dive into it Smiley
Logged

programming • free software
animal liberation • veganism
anarcho-communism • intersectionality • feminism
InfiniteStateMachine
Level 10
*****



View Profile
« Reply #4 on: October 31, 2014, 04:10:37 PM »

yeah I tried doing a lot of math classes as a pre-requisite and they didn't really stick. Once I programmed a few games then went back and studied linear algebra it stuck a lot more because I could see where I needed it.
Logged

The Sane Psycho
Level 0
*


View Profile
« Reply #5 on: November 01, 2014, 02:55:59 AM »

Hey, thanks for the responses, guys! You have been really helpful. I will definitely learn some trig (I haven't had a math class since 11th grade, and I never learned trig). However, I am going to take Dacke's advice and dive into the programming first, and whatever math I need, I'll learn on the way. As I plan making games in a lot of different genres, I probably will need the math at some point, but it might be easier for me to learn it in unison with my programming rather than before it.
Logged
InfiniteStateMachine
Level 10
*****



View Profile
« Reply #6 on: November 01, 2014, 10:48:53 AM »

I should mention at a later point in your studies you can pick up a math textbook focused on math for games.

I have a couple. This is the one I prefer:

http://www.amazon.com/Mathematics-Programming-Computer-Graphics-Second/dp/1584502770/ref=asap_B001K8753Q_1_3?s=books&ie=UTF8&qid=1414867721&sr=1-3
Logged

BigThink
Level 0
**


View Profile WWW
« Reply #7 on: November 04, 2014, 02:13:34 PM »

I know that I will need to know some math before I start learning programming

No, you really don't. In order to make certain games it's good to know some trigonometry. But you really don't need to know any of that before you start learning the basics of programming. Don't hesitate, just dive into it Smiley

Exactly what I thought:)
Logged

Hey there! Just opened an YouTube channel about various game development topics! Check it out https://www.youtube.com/channel/UCGCv7wwpwETEH0kkd_CYlfQ
ஒழுக்கின்மை (Paul Eres)
Level 10
*****


Also known as रिंकू.


View Profile WWW
« Reply #8 on: November 04, 2014, 03:26:07 PM »

i'd say algebra is essential, trig is very useful, and higher than that is mainly useful if you want to code 3D engines or do something fancy

but like, i'd say that 80% of games could be coded with algrebra knowledge only (things like basic knowledge of exponents and square roots), a further 15% would require trig, and the last 5% would require higher math
Logged

Dacke
Level 10
*****



View Profile
« Reply #9 on: November 04, 2014, 03:41:09 PM »

Many games can be coded using only basic arithmetic and logic.

For example, games that take place on a grid can often be coded using only integers.
« Last Edit: November 04, 2014, 04:04:12 PM by Dacke » Logged

programming • free software
animal liberation • veganism
anarcho-communism • intersectionality • feminism
ஒழுக்கின்மை (Paul Eres)
Level 10
*****


Also known as रिंकू.


View Profile WWW
« Reply #10 on: November 04, 2014, 04:29:06 PM »

Many games can be coded using only basic arithmetic and logic.

For example, games that take place on a grid can often be coded using only integers.

well, you'd still at least need the distance formula to calculate distances between any two given squares, which involves exponents and square roots. so it depends on what you mean by basic arithmetic i guess
Logged

Dacke
Level 10
*****



View Profile
« Reply #11 on: November 04, 2014, 04:30:14 PM »

No, I mean games that don't care about euclidean distance. Like, say, Sokoban or Chess.
Logged

programming • free software
animal liberation • veganism
anarcho-communism • intersectionality • feminism
ஒழுக்கின்மை (Paul Eres)
Level 10
*****


Also known as रिंकू.


View Profile WWW
« Reply #12 on: November 04, 2014, 04:33:24 PM »

if you want to write chess without an AI, i guess that is true, but if you want to write an AI for chess you will probably need more math than basic addition/subtraction/division/multiplication stuff (which is what i think of when i hear the phrase basic arithmetic)

for the AI, you'd need to know at least statistics and probability
Logged

Dacke
Level 10
*****



View Profile
« Reply #13 on: November 04, 2014, 05:05:38 PM »

Sure, for AIs you need more. But there are plenty of games that work fine as singleplayer or local multiplayer. Games that rely on grids, logic, text, puzzles etc.

Obviously you will be better off in the long run if you learn some math. It's pretty limiting to not know how to calculate a distance. But it also isn't necessary for some game types.

Personally, I've found most use from trig, vectors, graph theory, complexity theory and combinatorics (probably in that order).

But programming can be considered it's own branch of mathematics and it is (after all) the most important one for making games.
Logged

programming • free software
animal liberation • veganism
anarcho-communism • intersectionality • feminism
Sik
Level 10
*****


View Profile WWW
« Reply #14 on: November 04, 2014, 06:44:02 PM »

if you want to write chess without an AI, i guess that is true, but if you want to write an AI for chess you will probably need more math than basic addition/subtraction/division/multiplication stuff (which is what i think of when i hear the phrase basic arithmetic)

Weird, for chess AI I thought you could get away with just addition (since chess AI is basically analyzing all possible moves and picking the one you decided would have the highest score).

But yeah, for many games you can get away with jut basic arithmetic. Just look at pretty much any game made during the 3rd console generation, every game there was forced to do it that way, no exception (the only common exception where sine look-up tables I think). Somewhat the same with the 4th but having hardware multiply and divide meant developers dared to do some more complex operations if they would yield much more useful or interesting results (e.g. using multiplication to compare distances).
Logged
ஒழுக்கின்மை (Paul Eres)
Level 10
*****


Also known as रिंकू.


View Profile WWW
« Reply #15 on: November 04, 2014, 06:58:35 PM »

well chess ai's can't check every possible move obviously, because the possible moves in chess are too astronomically high that they outnumber the atoms in the universe. good chess ai's tend to consult a huge database of past games with similar piece positions. they do look a few moves ahead too when no such info is in the database, but afaik the difference between good and bad chess ai's isn't the algorithm that adds up points, it's in the database algorithms
Logged

Dacke
Level 10
*****



View Profile
« Reply #16 on: November 05, 2014, 02:52:04 AM »

Chess AI:s are a bit more complex. You need stuff like: an opening book, a state heuristic (to evaluate a board state), pruning (alpha-beta and probably something more aggressive), a priority queue (to know what next to explore), heuristics for when you've found a move that is good enough and state hashing (remembering states you have already explored).

Just exploring states would be too slow. Just using an opening book would break down past the early mid-game, as there are too many possible states to store.

It's possible you could get away with using only +-*/, but you'd still need to understand some non-trivial math.
Logged

programming • free software
animal liberation • veganism
anarcho-communism • intersectionality • feminism
oahda
Level 10
*****



View Profile
« Reply #17 on: November 05, 2014, 03:25:53 AM »

Do note that you don't always necessarily need to know how things work to be able to know when and how to use them.

For example, atan2 is commonly used to calculate the angle between two objects, but you don't need to know how or why that works. You only need to know the syntax to do so (and might even wrap it up in a function or your framework at hand might already have one).

You can use the theory of Pythagoras' theorem to check for collision between circles, but you don't have to understand it – just copy the code and wrap it into a circle collision checking function and you're good to go.

I personally prefer understanding, and I do understand these, but I absolutely wouldn't have to understand them to be able to use them in game making. But understanding obviously opens up a lot of new and exciting possibilities sometimes.
Logged

ஒழுக்கின்மை (Paul Eres)
Level 10
*****


Also known as रिंकू.


View Profile WWW
« Reply #18 on: November 05, 2014, 03:36:58 AM »

yeah that's true, there are people who failed high school algebra who still manage to make games. but often talking to such people and explaining to them how to do new things is often a nightmare, because their knowledge is so limited

for instance, someone once asked me how to make an experience point / level up system. their first idea was to give the player a level up for every 1000 experience points. i explained that most rpgs don't work like that, they use a partly exponential system where each level takes more xp to get to than the previous xp, using a formula, often something like this:

experience to next level = level*150 + level*level*20 + 100;

i told them they could create a formula like that and graph it, and then they could see the curve of experience growth on a graph over time (like on a graphing calculator or some online equivalent) and get a sense for how it works

but *even that* they had trouble understanding, they were like 'it has to be simpler than that!' and wanted to stick with the 1000 experience points per level system because it was 'easier to code'

(not that that system is impossible to get working either, suikoden actually uses a 1000 xp per level system, it just makes the xp you get depend on the difference between the enemy's level and your own. i wonder if the programmer of suikoden didn't know how to do it the other way, though. and that system can be easily exploited too because if you take a really low level character, join them up with your high level party, and fight a high level enemy, that low level character, at the end of the battle, would gain so many levels that they often skyrocket *above* the other characters in level. i actually used that trick a lot in suikoden to hyperlevel characters.)
Logged

Eendhoorn
Level 6
*

Quak


View Profile
« Reply #19 on: November 05, 2014, 04:46:32 AM »

I suck at maths,  but knowing vectors and kind of understanding some trigonometry is enough for almost everything.
Logged

Pages: [1] 2
Print
Jump to:  

Theme orange-lt created by panic