Questions tagged [mathematics]

Mathematics questions deal with the arithmetic, geometry, calculus, formulae and other calculations used in the development of a game.

This tag is for questions about the math needed to produce some result in a game. These questions can involve complete formulae and algorithms, or they could just be about the math for a particular step in the process. Examples of mathematics questions include:

  • Create a formula for damage given different present variables
  • Determine the change in momentum for two objects after a collision
  • Find the largest parabolic distance for a projectile path
  • Produce specific beautiful, scintillating patterns of colorful bullet death

For questions specifically about using a complete algorithm to achieve a specific result, you can also use .

Resources:

2031 questions
171
votes
13 answers

What math should all game programmers know?

Simple enough question: What math should all game programmers have a firm grasp of in order to be successful? I'm not specifically talking about rendering math or anything in the niche areas of game programming, more specifically just things that…
Tetrad
  • 30,154
  • 12
  • 97
  • 144
126
votes
13 answers

How to develop RPG Damage Formulas?

I'm developing a classical 2d RPG (in a similar vein to final fantasy) and I was wondering if anyone had some advice on how to do damage formulas/links to resources/examples? I'll explain my current setup. Hopefully I'm not overdoing it with this…
user127817
  • 1,863
  • 3
  • 15
  • 13
62
votes
10 answers

Moving ships between two planets along a bezier, missing some equations for acceleration

OK, I already posted this over at math.stackechange.com but didn't get any answers :( First of here's a picture of my problem, the description follows afterwards: So I got all the points and values set up. The ship starts out moving around the left…
Ivo Wetzel
  • 2,472
  • 3
  • 19
  • 18
54
votes
4 answers

How are imaginary numbers useful in video game creation?

I learned about imaginary numbers in school and they seemed so impractical, so I asked my teacher what they were used for and he said "video game creation". I just want to know if this is true and if so how is it used during the creation process.
Daosof
  • 651
  • 1
  • 6
  • 13
54
votes
2 answers

What is a quaternion?

What is a quaternion, and do how they work? Also, what advantages do you gain using three points on a 2D plane? Finally, when is it considered good practice to use quaternions?
SirMathhman
  • 817
  • 1
  • 6
  • 16
52
votes
7 answers

What are atan and atan2 used for in games?

I am having some trouble understanding Math.tan() and Math.atan() and Math.atan2() . I have basic knowledge of trigonmetry but the usage of SIN, COS, and TAN etc for game development is very new to me. I am reading on some tutorials and I see that…
sutoL
  • 631
  • 1
  • 6
  • 7
47
votes
3 answers

How to determine which thrusters to turn on to rotate the ship?

The configuration of the ship changes dynamically, so I have to determine which thruster to turn on when I want to rotate the ship clockwise or counter clockwise. The thrusters are always axis aligned with the ship (never at an angle) and are either…
migimunz
  • 741
  • 5
  • 9
47
votes
4 answers

A ball hits the corner, where will it deflect?

I need to brush up my trigonometry and hope you can help here with a simple mathematical model. Here is my model so far in the image attached. I am aware that the frame animation has other problems when the ball is moving very fast, but for now I…
Lumis
  • 964
  • 3
  • 10
  • 21
44
votes
3 answers

How to create adjustable formula for RPG level up requirements?

I'm trying to create a formula that can be modified simply by changing two values: number_of_levels, and last_level_experience. This is to enable people modding the game to change the levelling requirements. I've got it so that I can specify the…
Truncheon
  • 547
  • 1
  • 5
  • 15
41
votes
4 answers

Why are radians preferred over degrees in game development?

I've been looking up the definition of radians and found out that mathematicians prefer them because they are derived from pi instead of being completely arbitrary like degrees. However, I have not found a compelling reason to use them in game…
Michael Stum
  • 2,573
  • 6
  • 30
  • 41
40
votes
7 answers

How do idle games handle such large numbers?

Just wondering how games such as Tap titans and Cookie Clicker handle such large numbers. I am trying to implement an idle game however the largest number format supported by C# is decimal. I am looking to support up to 10^500; that needs to be…
MathHelp
  • 419
  • 1
  • 4
  • 4
39
votes
11 answers

In Pong, how do you calculate the ball's direction when it bounces off the paddle?

I'm trying to wrap my head around this very Hello World-y problem in game development. I've created a TicTacToe game in XNA so I guess the next step would be a Breakout clone. Keep in mind that I have no knowledge on game programming or even what…
Sergio
38
votes
2 answers

Why do we use the Pythagorean theorem in game physics?

I've recently learned that we use Pythagorean theorem a lot in our physics calculations and I'm afraid I don't really get the point. Here's an example from a book to make sure an object doesn't travel faster than a MAXIMUM_VELOCITY constant in the…
Starkers
  • 961
  • 2
  • 12
  • 21
36
votes
5 answers

How can I calculate current level from total XP, when each level requires proportionally more XP?

In my game, XP needed to reach the next level is Current Level × Level Threshold . Given that, how can I get my current level from the total XP ever earned? For example: Level Threshold = 50 Current Level = 1 Starting at level 1, I would need (1 ×…
Jay van Diyk
  • 361
  • 1
  • 3
  • 3
35
votes
12 answers

Random number in a range, biased toward the low end of the range

I have an input of two values, let's say 1 and 10. Lesser numbers should overall occur more often in the output than higher numbers, while there is a peak in the probability at #2: 1: very common 2: extremely common 3: very common 4: common 5:…
Standard
  • 495
  • 1
  • 4
  • 8
1
2 3
…
99 100