Fangames > Programming Questions

How much math is actually used when making an avoidance?

<< < (2/2)

Habluka:

--- Quote from: L4Vo5 on October 08, 2016, 01:09:41 AM ---Wait, calculus? when do you use calculus?

--- End quote ---

When deciding on what to make the individual constants to synchronize certain kinds of attacks and patterns with audio cues or planning out how to make certain objects move in certain ways.  It's very basic and not exactly necessary, but it helps get rid of a lot of trial and error.

klazen108:
As an example of how calculus is useful in game design, imagine you have an object you want to move into a position. However, instead of just moving at a constant speed and snapping into place, you want it to start out fast and kinda "slide" into place at the end, smoothly.

To start out, you might want to plot its position as a function of time, and a semi parabola works perfectly for us. In addition, you know that its speed will start out at some value, and decrease to zero at the final point. Understanding that velocity is the derivative of position (stick with me), you can link these two functions together and with some set conditions like distance and desired time to complete, you can calculate the initial speed and acceleration you should give your object to reach the target with your desired movement. To apply this in gamemaker, you would calculate the initial speed and gravity using the above method, and then set an alarm to stop it after the number of ticks you want, and the math handles the rest! (And did I mention it looks real neat!)

This is what you learn in the 100-level math course "Calculus I with Analytic Geometry", which is the study of functions and how you can shape them to have desired properties. Very neat stuff, and incredibly helpful when dealing with physics calculations.

Additionaly, if you're interested in learning more about math and how it applies to game design, TJ's doing some on-stream math lessons! Here's his first one, Distances, Triangles, and Trig: For Game Makers!

Navigation

[0] Message Index

[*] Previous page

Go to full version