Math for Game Development 1: Arithmetic
Heyyy i am Olcay ÇİFTÇİ from Turkey. While stepping into the game development industry as a software engineer, I wanted to blog the notes of my math for game development workshops. This blog will consist of 6 different sections and the first section is arithmetic.
Rounding → It can be used to round values such as hp(health point), damages etc. With Round If the number is greater than .5 rounded up else down, Floor rounds down, Ceiling rounds up.
We should use the round process last, otherwise there may be big differences between the damages.
5.1 * 4.7+2.5 = 26.27 if we round→ 26
if we round first → 5 * 5 + 3 = 28
28 -26 = 2 difference occurred.
If there is such a difference in only three transactions, the difference will gradually increase in hundreds of transactions and the consistency will disappear.
Multiplication → Velocity, in time velocity factor, time difference
Remainders → Can be used with mod in detecting even, odd numbers
Squaring, Cubing & Powers→ when we are thingking about Area, textures, pixels, voxel games.
BODMAS
Charts & Graphs
Some time-based information, increments and decrements in games can be displayed with charts and graphs.
Gradient of a Line
The Gradient (also called Slope) of a straight line shows how steep a straight line is.
Gradient is the vector that, when calculated at a point, shows the direction in which the function increases maximum at that point
Distance, Speed, Time
In Speed x Time graph, under the slope area will give us total distance to travel.
The dependent variable (the thing you can control) is usually measured on the y-axis. This may be speed, or it could be something else entirely.
e(Euler)
On a two-dimensional graph that increases as the powers of the numbers increase, the slopes of all numbers at a certain point are greater than the distance of that point. However, in the graph of powers of the Euler number, its slope at that point is equal to the distance.
rate of acceleration, one way of looking at it is the rate of acceleration at which your position in space
if you take e and you raise it to its power, you always end up with your velocity equaling that graphs y value .
Logarithms
Logarithm can be used when operations are performed with very high or very low numbers in games. It is used to determine the actual distance between two points whose mathematical position is known. Logarithm calculation is needed in determining the point where the thrown ball will fall, in compound interest calculations and in space sciences.
Just ask the question, how many times do i need to multiply something by itself to get some result? :)
Permutations
How many ways can i order these things?, how much state can i create? permutations will answer this questions.
Scientific Notation
As the numbers used in the game get bigger and bigger, at some point they will be really big numbers with lots of multi-digits. We can overcome this problem with scientific notation.
Scientific notation is a way of writing very large or very small numbers. A number is written in scientific notation when a number between 1 and 10 is multiplied by a power of 10. For example, 650,000,000 can be written in scientific notation as 6.5 ✕ 10⁸ and also we can show this number with e notation 6.5e8
We have come to the end of my first blog. I hope it was useful. Please comment the parts that need to be corrected or that you want to add about arithmetic. This way, we all learn new things together. :)
Good work.